• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest  RSS feed

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we get HttpServletRequest object in listeners?
if so how?
if not why?

Thanks inadvance.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpServletRequest not in Listeners. Because Listeners only look for event.like attribute added removed and also .don't want the client request or response.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls refer -http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequestEvent.html
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!