Women in Technology

Hear us Roar



Article:
  Writing Servlet 2.3 Filters
Subject:   How do i get the name/url of the resource being requested in the doFilter method of the filter.
Date:   2003-06-04 01:22:36
From:   anonymous2
Response to: How do i get the name/url of the resource being requested in the doFilter method of the filter.

HttpServletRequest hreq = ( HttpServletRequest )request;
String url = new String( hreq.getRequestURL() );


// This however excludes all the parameters.
// You can use this to get them:


java.util.Enumeration params = hreq.getParameterNames();
while ( params.hasMoreElements() ) {
String param = ( String )params.nextElement();
String value = hreq.getParameter( param )
}


// JTR