• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request Object

 
Charan raj
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we get Request Object in JSf
How ever i have Used request object through
FacesContext Object but it throws exception
Thanks in Advance
 
Andres Quinones
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think is not very clear your question. Please be try to explain it better.
 
Joe Matthew
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are looking for the Request Object, FacesContext is the place to take it from. What is the exception? Your post can have more details.
 
Charan raj
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FacesContext faces=getFacesContext().getCurrentInstance();
ExternalContext ext=faces.getExternalContext();
RenderRequest req=(RenderRequest)ext.getRequest();

I took the request Object from the above code :

The Excepion is:

0000022 jsf E com.sun.faces.lifecycle.InvokeApplicationPhase execute #{pc_LoginPage.doSbmAction}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.sun.faces.context.MyHttpServletRequestWrapper incompatible with javax.portlet.RenderRequest
javax.faces.FacesException: #{pc_LoginPage.doSbmAction}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.sun.faces.context.MyHttpServletRequestWrapper incompatible with javax.portlet.RenderRequest
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:79)
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18100
51
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you have a portlet JSF app. I'm rusty on that, but I seem to recall that for portlets, you don't get an HttpRequest - they have their own specialized equivalents.
 
Andres Quinones
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charan I think that your Exception is being generated because you probably need to cast the Request to HttpServletRequest.


Hope this helps.
 
Joe Matthew
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Portal depending on which Portal you are using, returns a PortalRequest. The best way to find out is to take that request as an object and print the class. You will find out the name of request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic