Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Nitesh Kr Sahay
How to get HttpServletRequest from Icefaces portlets
6 de Abril de 2012 04:32
Resposta

Nitesh Kr Sahay

Ranking: Junior Member

Mensagens: 58

Data de entrada: 28 de Novembro de 2011

Mensagens recentes

Hi,
I am working with liferay 6.0+ ,I am Using the following code

ExternalContext extcontext = FacesContext.getCurrentInstance().getExternalContext();
RenderRequest req = (RenderRequest) extcontext.getRequest();
HttpServletRequest request = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(req));





to get the HttpServletRequest,but it throws an class cast exception...exception is as follows
java.lang.ClassCastException: com.liferay.portlet.ResourceRequestImpl cannot be cast to javax.portlet.RenderRequest


can any one guid me . What to do?
Neil Griffin
RE: How to get HttpServletRequest from Icefaces portlets
10 de Abril de 2012 14:59
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2145

Data de entrada: 26 de Julho de 2005

Mensagens recentes

Try this:

1ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
2PortletRequest portletRequest = (PortletRequest) externalContext.getRequest();
3HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(portletRequest);
Nitesh Kr Sahay
RE: How to get HttpServletRequest from Icefaces portlets
13 de Abril de 2012 06:21
Resposta

Nitesh Kr Sahay

Ranking: Junior Member

Mensagens: 58

Data de entrada: 28 de Novembro de 2011

Mensagens recentes

Thanks Neil for the sols............
Joshua Trudell
RE: How to get HttpServletRequest from Icefaces portlets
3 de Abril de 2013 10:39
Resposta

Joshua Trudell

Ranking: New Member

Mensagens: 8

Data de entrada: 3 de Abril de 2012

Mensagens recentes

Neil Griffin:
Try this:

1ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
2PortletRequest portletRequest = (PortletRequest) externalContext.getRequest();
3HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(portletRequest);



I tried this, and I got the following error:

117:38:37,227 ERROR [STDERR] java.lang.RuntimeException: Unable to get the portlet request from com.icesoft.faces.webapp.http.portlet.PortletExternalContext$4
217:38:37,228 ERROR [STDERR]     at com.liferay.portlet.PortletRequestImpl.getPortletRequestImpl(PortletRequestImpl.java:104)
317:38:37,228 ERROR [STDERR]     at com.liferay.portal.util.PortalImpl.getHttpServletRequest(PortalImpl.java:1760)
417:38:37,228 ERROR [STDERR]     at com.liferay.portal.util.PortalUtil.getHttpServletRequest(PortalUtil.java:467)
Neil Griffin
RE: How to get HttpServletRequest from Icefaces portlets
3 de Abril de 2013 11:40
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2145

Data de entrada: 26 de Julho de 2005

Mensagens recentes

From looking at the java.lang.RuntimeException, my best guess is that you are using ICEfaces 1.8 and not ICEfaces 2/3.

The problem is that ICEfaces 1.8 does not utilize the Portlet 2.0 RESOURCE_PHASE (ResourceRequest) for Ajax. Instead, ajax requests are made from the browser directly to the ICEfaces servlet. So the basic problem is that there isn't an underlying PortletRequest object with ICEfaces 1.8 Ajax.

Are you able to upgrade to ICEfaces 3.2 and Liferay Faces Bridge? If not, then what do you need to get from the underlying HttpServletRequest? Depending on what you need, there *might* be a way to get what you are looking for.
babu babu
RE: How to get HttpServletRequest from Icefaces portlets
16 de Julho de 2014 00:18
Resposta

babu babu

Ranking: New Member

Mensagens: 17

Data de entrada: 17 de Junho de 2011

Mensagens recentes

Neil Griffin:
Try this:

1ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
2PortletRequest portletRequest = (PortletRequest) externalContext.getRequest();
3HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(portletRequest);



Hi Neil,

Good to talk to you after long time.
This is another liferay member id of mine.

Currently, I work on Login Customization Hook.
I take one of your samples as the base from, https://github.com/liferay/liferay-faces.git. (The login registration portlets)

In the LoginBackingBean.java, below code is used,
LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
ActionRequest actionRequest = (ActionRequest) liferayFacesContext.getPortletRequest();
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(actionRequest);

I get the below classcst exception in the bolded line.

java.lang.ClassCastException: com.liferay.portlet.ResourceRequestImpl cannot be cast to javax.portlet.ActionRequest:
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:]

I tried the way you quoted in this blog, as well. But still get the same error.

You guidance would be very much helpful.

Thanks,
Nagaraj.
Neil Griffin
RE: How to get HttpServletRequest from Icefaces portlets
16 de Julho de 2014 08:46
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2145

Data de entrada: 26 de Julho de 2005

Mensagens recentes

Hi Nagaraj,

My best guess is that you are trying to submit the form with Ajax, which would explain the ClassCastException from ResourceRequest ActionRequest.

The LoginBackingBean requires a full page postback. If you are using p:commandButton, then try setting the ajax="false" attribute.

Kind Regards,

Neil
Neil Griffin
RE: How to get HttpServletRequest from Icefaces portlets
28 de Julho de 2014 07:08
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2145

Data de entrada: 26 de Julho de 2005

Mensagens recentes

Thanks for letting me know. I'm glad it is working for you now. emoticon
babu babu
RE: How to get HttpServletRequest from Icefaces portlets
29 de Julho de 2014 11:11
Resposta

babu babu

Ranking: New Member

Mensagens: 17

Data de entrada: 17 de Junho de 2011

Mensagens recentes

Hi Neil,

I understand. This is question is not relevant to this thread.

+ All,
My Apology guys.

Neil,

Need your help in Liferay SSL Configuration.
I'am all done with the steps following this blog.

https://www.liferay.com/web/meera.success/blog/-/blogs/liferay-portal-ssl-configuration

The liferay login page is loading successfully on https: (https://localhost:8443)
The problem start when I try to login.
when logging in with default test user. I get the "WebPage is Not Available" error.

At this time, my url in the browser is,

https://localhost/web/guest/home?p_p_id=58&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_58_struts_action=%2Flogin%2Flogin

I use the liferay jboss bundle - version: liferay-portal-6.2-ce-ga2

I tried extending https related portal properties,

company.security.auth.requires.https=true
session.enable.phishing.protection=false
web.server.protocol=https

But the issue remains same.

Your guidance would be very much helpful.


Thanks,
Nagaraj.
Neil Griffin
RE: How to get HttpServletRequest from Icefaces portlets
29 de Julho de 2014 11:20
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2145

Data de entrada: 26 de Julho de 2005

Mensagens recentes

See this post.
babu babu
RE: How to get HttpServletRequest from Icefaces portlets
29 de Julho de 2014 21:50
Resposta

babu babu

Ranking: New Member

Mensagens: 17

Data de entrada: 17 de Junho de 2011

Mensagens recentes

Neil Griffin:



HI Neil,

Sorry that post was mine. I wanted to post this thread as new.
At the same time, was a little specific toget it to your notice.
Hence why posted in two places.

Ofcourse no reply to that post as well till now. Waiting on it.

Luckily you saw it. Can you guide me through this problem?


Thanks,
Nagaraj.
babu babu
RE: How to get HttpServletRequest from Icefaces portlets
29 de Julho de 2014 22:20
Resposta

babu babu

Ranking: New Member

Mensagens: 17

Data de entrada: 17 de Junho de 2011

Mensagens recentes

Hi Neil,

Finally, I was able to crack the issue. Lesson learnt is in the post

https://www.liferay.com/community/forums/-/message_boards/message/40717480

Again, Thanks for your quick reponses always.

Thanks,
Nagaraj.
babu babu
RE: How to get HttpServletRequest from Icefaces portlets
24 de Setembro de 2014 06:46
Resposta

babu babu

Ranking: New Member

Mensagens: 17

Data de entrada: 17 de Junho de 2011

Mensagens recentes

babu babu:
Neil Griffin:




Hi Neil,

Not sure how to reach you. Is why messagin in this post.
Guys, please bare with me,

Neil,

This is me Nagaraj again.
Currently we are testing our portal application in the Liferay cluster environment.
And we are failing to achieve Session Replication.

It would be really great, can you take a look at the below post and help with your experience.

https://www.liferay.com/community/forums/-/message_boards/message/43112118

The person "Rahul Bhardwaj" who started the above post, is my team mate. We both work this issue currently.


Thanks,
Nagaraj.
babu babu
RE: How to get HttpServletRequest from Icefaces portlets
24 de Setembro de 2014 06:47
Resposta

babu babu

Ranking: New Member

Mensagens: 17

Data de entrada: 17 de Junho de 2011

Mensagens recentes

Neil Griffin:
See this post.



Hi Neil,

Not sure how to reach you. Is why messagin in this post.
Guys, please bare with me,

Neil,

This is me Nagaraj again.
Currently we are testing our portal application in the Liferay cluster environment.
And we are failing to achieve Session Replication.

It would be really great, can you take a look at the below post and help with your experience.

https://www.liferay.com/community/forums/-/message_boards/message/43112118

The person "Rahul Bhardwaj" who started the above post, is my team mate. We both work this issue currently.


Thanks,
Nagaraj.
Neil Griffin
RE: How to get HttpServletRequest from Icefaces portlets
24 de Setembro de 2014 08:12
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2145

Data de entrada: 26 de Julho de 2005

Mensagens recentes

Hi Nagaraj,

Juan (a Liferay employee and a member of the Liferay Faces team) is helping on the clustering issue.

Kind Regards,

Neil