This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSF and the fly likes Request Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Request Object" Watch "Request Object" New topic
Author

Request Object

Charan raj
Greenhorn

Joined: Jun 26, 2008
Posts: 8
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

Joined: Oct 09, 2006
Posts: 57
I think is not very clear your question. Please be try to explain it better.
Joe Matthew
Ranch Hand

Joined: Jun 10, 2008
Posts: 66
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.


Regards,<br />Joe<br /> <br />"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live."<br />--Martin Golding
Charan raj
Greenhorn

Joined: Jun 26, 2008
Posts: 8
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

Joined: Jun 25, 2001
Posts: 16101
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Andres Quinones
Ranch Hand

Joined: Oct 09, 2006
Posts: 57
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

Joined: Jun 10, 2008
Posts: 66
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Request Object