Providing liferay user id into orbeon form runner generated xml - java

I make portal based on Liferay, which has funcionality associated with Orbeon. I run Orbeon form runner inside html frame and I want to insert some extra data like Liferay-User-Id into xml generated by filled form. Is there some possibility to make that or other idea that helps me provide, user's id who filled form, to database?
regards

Since Orbeon Forms 4.4, the Liferay proxy portlet allows you to propagate user information as headers. This is possible because the portlet has access to Liferay user information.
From within an iframe, it's a different story. If you manage to set URL parameters, then you can retrieve them from your form with the xxf:get-request-parameter() function.

Related

Filtering a Web Service Data Control in JDeveloper

I have a web service data control in JDeveloper 12.2.1.3.0 which I show in a table on a page fragment, but I need to filter by one of the attributes and show the filtered data in the table and I don't know how to do that because there is no Named Criteria tab in the data control configuration page.
I looked at the data control configuration file but didn't find any option for adding a filter.
Any help will be really appreciate it, thank you all in advance!
One solution is to call or implement a web service, that returns the data already sorted and/or filtered.
If this can't be done, you have to get the data from the web service in a POJO model and filter/sort it yourself.

how to update values automatically from database

i am doing mvc project and i want to update the web page automatically when the web page is loaded.
Ex: web page 1 is used to add the companies in database,web page 2 is used to delete the companies,when the web page 2 is loaded automatically in the web page 2 select box should appear with the values as company names to delete the companies from database.
i am expecting to use ajax here to automatically load the data but problem is to fetch the data from database i am using java class instead of jsp or servlet,so i am not understanding how to fetch the data from java class and use to load automatically in web page 2 for the select box.
Please help me on the same.
In this scenario, you have to use servlet, with which ajax will interact to fetch the values on page2. In servlet, you can call you java class to make database connection. Hope it helps!

Can Multiple different Servlets be run Sequentially in a java EE project?

I am having a html page, which takes in the username and password and takes it to the servlet for authenticating. If authenticated, it gets a link to go to another html page, which accepts input for placing a order, this inputs are finally passed to a servlet, which makes the data persistent by storing it in the database,
By far, i can make a html page for username and password and a servlet for authenticating. even the link for going to another html page, which accepts the input of the order details also works, after that, the servlet does not work.
Using Glasfish Server and netbeans for development.
check Servlet Filter : they are invoked before/after a servlet, and are used to handle authentication, caching, etc

angularjs secure role based tabs

I am developing an application in which i am using angularjs at client side and java,spring at server side,all communication is in the form of JSON.
The problem i am getting is about security.
I have multiple roles, user can have and based on these roles,tabs on UI are visible or not.
If i use JSP then it is easy to use taglib for this problem because jsp is compiled at server and returned html will not have html section for hidden tabs and there is no way by which end-user can see these tabs or their URL part.
But how to solve this problem in angular based application because whatever code i write in angular file,user can change it by firebug etc. and can see the tabs and their URLs.
example : i have following in my html :
Users
I want to hide this thing completely if user is not having required role.
One solution can be writing some directive but user can edit the script of this directive and can see this thing in html.
You need to do 2 things :
Implements an angular Service, giving your client side the authorization (obtained by REST)
Then, on the server side :
you need to protect ALL RESOURCES (html, angular controllers, angular services, rest resources) depending on the user's rights.
May you can protect only Rest Resources if Client side's ones are not critical (I don't mind if my user get my html).
This way, the user won't see the tabs he is not supposed to, but more important, he can't bypass your security in order to show it.
By protecting HTML, I mean that for the tab XX I use ng-include="'tabXX.html'", and I protect this html with Spring Security the same way I protect RestResources.

Redirecting to GWT Custom page from application link(other App)

Redirecting application link to Java - GWT Custom page.
Whenever user will login through my APP.
and user hit button(say add record) then redirection should happen i.e. page should redirected to GWT custom page from application link.
How to call servlet when application link hit by button?
after that How to call GWT page from called servlet.
Wants to show GWT custom page with data present in REQUEST.
Hidden fields available on UI Screen which is developed in GI .
These fields can be passed to GWT custom applications launched from the application link.
APP(UI) --> SERVLET---> GWT page(UI with data present in request i.e jsessionid,hidden fields)
what changes need to do in web.xml ?
Plz provide any helpful document,link,sample code and any idea
Hope for the best co-operation
Thanks in advance.
Do you already have a fixed login page (servlet) tah you must use? Then do this:
Window.Location.assign(loginUrl) will take you to a new page. Your GWT app will be "closed" and all state will be lost.
Your login servlet should redirect back to your GWT page when done. Usually this is done by supplying a URL parameter when invoking login page - check the login servlet. Usually something like http://yourserver.com/login?returnTo=GwtAppUrl.
At this point your user is logged in, which means that servlet has set a session cookie. From this point on (until logout or session time-out) your GWT and GWT-RPC will use this session automatically (browser sends session cookie) - you don't have to do anything.
You can pass some data back to GWT by fragment identifier http://yourserver.com/login?returnTo=GwtAppUrl#somePage/parameter1/parameter2. However better option is to just use GWT-RPC to get the data from server.
Otherwise, if you are making everything from scracth, you can use GWT do do the login: How to implement a login page in a GWT app?

Categories

Resources