File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HttpServletRequest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HttpServletRequest" Watch "HttpServletRequest" New topic
Author

HttpServletRequest

S Sravs
Ranch Hand

Joined: Feb 25, 2008
Posts: 85
can we get HttpServletRequest object in listeners?
if so how?
if not why?

Thanks inadvance.
manokaran.d durairaj
Greenhorn

Joined: Oct 03, 2007
Posts: 1
HttpServletRequest not in Listeners. Because Listeners only look for event.like attribute added removed and also .don't want the client request or response.
Aditya Singh
Ranch Hand

Joined: Mar 06, 2008
Posts: 62
Pls refer -http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequestEvent.html
Steve James
Ranch Hand

Joined: Apr 12, 2009
Posts: 44
Definately possible

There is a Listener called as ServletRequestListener , it has got a method called public void requestInitialized(ServletRequestEvent rre)

and from ServletRequestEvent.getServletRequest() which returns the ServletRequest.


I am just a brick in the wall of Java
Abdul Rahman
Ranch Hand

Joined: Jul 04, 2008
Posts: 63
Hi Vijaya,

can we get HttpServletRequest object in listeners?
if so how?
if not why?


There are 8 listeners and 6 events associated with these listeners. out of these 6 events only ServletRequestEvent Class has got a method getServletRequest().
so if you are writing a class that implements ServletRequestListener interface, then you get ServletRequestEvent. From this event you can call getServletRequest(). you will have to cast it to HttpServletRequest.
You will not get request objects in other listeners because the API does not provide for it.

Hope this helps.


Abdul
SCJP5, SCWCD5, [scwcd wall of fame]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpServletRequest