How to hide paramters in url while displaying Birt report - java

I am calling the report from my application in JSF the connection parameters are captured by the application and sent to the Birt, the only problem and that parameters are visible in the address bar.
is there any way to hide them or encrypt them?
I need this because the data may come from applications with different connections.
I am using
window.open(
http://localhost:8081/birt5/run?__report=Report/Bound_Polici es_Report.rptdesign&Report_StartDate=05/20/2018&Repo rt_EndDate=05/30/2018&Report_InsuranceCompanyId=0&Re port_DomicileState=New+Mexico&Report_InsuranceCarrierId= 0&Report_BusinessType=All&__format=html&__title= Compquick
)
to load the new report.
Is there any solution to hide paramters if my requirement is that the Report
should open in new when I click on submit button in one JSF.
I would appreciate any help you could give. Thanks :)

Related

How to use "disabledReason" in Android Management API?

So, I'm being able to disable the device using the AMAPI(Android Management API), but I want to let the user know why his device is being disabled, so I started looking for a way to show why the device was disabled and I found the "disabledReason" property, but it's not working, or I don't know where is displaying the reason that I set.
If you know where is displaying or how to display the disabledReason I will be very thankful.
device.setState("DISABLED");
UserFacingMessage reason = new UserFacingMessage();
reason.setDefaultMessage("Reason why your device was disabled...");
device.setDisabledReason(reason);
androidManagementClient
.enterprises()
.devices()
.patch(device.getName(), device).execute();
There is an issue when using the disabledReason field in AMAPI. There is no message displayed on the device indicating why the device is disabled, and this issue has not yet been resolved, but you can see it on your JSON response if you set a customized disabledReason.defaultMessage.

Error message doesn't stay on view page using JSF

I am trying to send an error message from back bean class to view but it shows for a second and then went away. I don't know the reason please let me know what I am doing wrong.
For scope, I am using ManagedBean and RequestScoped
String msg = "Without 'Sample Id/Experiment Id' Keys file cannot proceed";
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, ""));
In my view, I am trying to get these error and these containers
<rich:messages globalOnly="true" />
<rich:messages for="gv" />
It shows these messages but doesn't stay there and vanish. Thank you in advance
JSF messages have basically a lifetime of a single request (but you can extend this via Flash Scope in JSF2) and thus disappear after a request finished.
rich:message components get auto-updated (i.e. ajaxRendered) by default. So it's very likely, that you have some AJAX-request, that triggers right after the message was shown on your page. Because of the request-scope of messages, no more messages are available in the new request and the rich:messages get updated again with empty content.
You can verify this by using your browsers developer tools or Firebug to watch network your traffic.

Reading GET/POST requests from the Browser on JAVA

I need to find a way of reading GET/POST requests from the WEB browser(Network) and retrieve the information like Status, Domain, Size, IP and the most important Timeline.
The main purpose of this is to measure requests count after each action on the WEB page and their execution time. Also this will help me to know if any requests(AJAX/JavaScript) are executing before I want to perform any actions on the WEB page.
Could you please help me with solution?
Assuming you don't want to tie yourself to a particular browser (via plugins or particular dev toolbars), need to capture responses from interactive user events (i.e. via simulated use of a website in a real browser, not dynamically created HTTP calls), and need to automate this, then a proxy server is the way to go.
Something like Browsermob can be set up as a proxy for all Selenium traffic. It can capture the entire content of all requests and responses, and let you generate you a (cross-browser) HAR file that you can then persist, visualise, or query via an API.
Obviously you could automate this, schedule the Selenium test runs, and either produce your own custom metrics with your own Java code; pipe the HAR into a JSON-savvy database for querying (say Elasticsearch) and visualisation, or just save the HARs for offline querying and diffing.
Some example code from the tests:
[...]
proxy.newHar("Test");
HttpGet get = new HttpGet(getLocalServerHostnameAndPort() + "/a.txt?foo=bar&a=1%262");
client.execute(get);
Har har = proxy.getHar();
HarLog log = har.getLog();
List<HarEntry> entries = log.getEntries();
HarEntry entry = entries.get(0);
HarRequest req = entry.getRequest();
[...]
Alternatively you can visualise the output by obtaining the HAR in string form and pasting into http://www.softwareishard.com/har/viewer/. That should give you something that looks very similar to the Network tab, but in a format that's easier to export, screenshot, and print.
Chrome comes with devtools by itself. Just hit 'F12'.
https://developer.chrome.com/devtools
Postman, it's useful for testing web services and API
https://www.getpostman.com/

JSF page load is very slow

I have a website with some images using the p:graphicsimage tag with the rendered attribute. So the images are only shown if the bean (db query) returns a true.
I also have a login form checking the user against a db. This works fine but my current problem is that the page needs a lot of time for loading the page(arround 25sec).
The bean method of the loginbutton is called ~20sec after pressing the loginbutton but I don't know what the server is doing during this time. Any idea how to check the server states or how to fix that problem?
My beans are ManagedBeans
Thanks in advance!
You can debug your method and benchmark the potential areas very old-school like
long startTime = System.currentTimeMillis();
method();
long endTime = System.currentTimeMillis();
System.out.println((endTime - startTime) + "ms")
or use a profiler like yourkit.
There are a couple of things you can do to improve performance of your screens
GZIP filter will reduce the initial load time significantly. It compresses the page contents while transferring to client browser. Refer to https://stackoverflow.com/a/35567295/5076414
You can additionally implement a cacheFilter to bring performance of
your screens at par with JavaScript based UI. This will cache the static content of your screen such as icons, images, stylesheets, javascripts etc. You can control what to cache and what to exclude. Refer to https://stackoverflow.com/a/35567540/5076414
For client side UI components, you can use Primefaces which is JQuery
based UI.
How to verify if my screen is using gzip and cache
To see if your contents are already usign gzip and cache, In your Google Chrome Browser -> right click on your screen -> inspect -> click network tab -> refresh your screen.
Click on the images, icons, stylesheets and see if you see following in response header
Cache-Control:max-age=2592000 if the status of element is 304 (coming from cache)
Content-Encoding:gzip if the status of element is 200

Redirect to Mobile pages in Struts

I have an existing web app which uses Struts for the forward-action...
I am trying to create a mobile version (mainly the UI design will be different) of this existing web app.
Now this app is using Struts 2 for the forward-action thing..
My question is can I extend this Struts XML to redirect based on desktop/mobile..
e.g. Let's say I have desktop.jsp and mobile.jsp...Now I detect where the user is coming from at a server level and have that info in the session..Can I update my stuts-config XML such that the only thing I need to change would be the "forward" JSP URL based on where the user is coming from?
I am looking at no change to the Action...only the forward URL for the JSP.
Please note that this question is not about "how to detect", but more about what approach to take once we have detected the browser and have that info from the server..
Thank you.
Better option is always to add a Filter here . and rest how to detect you know it.
Track all the request check for the header to find out if its coming from mobile ? and serve request according to it.
you can forward the request to another action which will handle the mobile specific data to load and maybe to have different results. One result pointing to desktop.jsp other pointing to the mobile.jsp.
sample:
public String execute(){
if(isMobile())
return "mobile";
else return "desktop";
}

Categories