David,

Maybe I'm missing something in your reply but I don't think I'm doing either
a forward or a dispatch. Here's the scenario...
- Simple app has (let's say) 10 pages
- A couple of pages are jsps using Struts forms. These are considered
'secure' pages and require a person to be logged in
- Some pages are straight html. These are 'unsecure' pages
- One page is a servlet. This is an 'unsecure' page
- App uses a Filter with a url-pattern of '/*'
- Filter interrogates the requested url to determine if requested page is a
'secure' page. 
- If request is for a secure page, and user is not logged in, the request is
redirected to a login page
- If request is not for a secure page then the doFilter method just does the
following:
     chain.doFilter(request, response);
     return;

My problem is that if the user requests the below address, the following
lines of code in the doFilter method get one result and the same lines of
code in the servlet give a different result.

requested address:
    http://localhost/app1/servlet/package.ServletName 

doFilter code snippet:
    HttpServletRequest hreq = (HttpServletRequest)request;
    HttpServletResponse hres = (HttpServletResponse)response;
    // This results in '/servlet'
    String requestedUrl = hreq.getServletPath();
  
servlet code snippet:
    // This results in '/servlet/package.ServletName'
    String requestedUrl = hreq.getServletPath();



David Friedman-2 wrote:
> 
> Are you doing a "forward" or a "dispatch".   One of them handles mappings
> differently because you are inside the application already and won't use
> the
> filters a second time.   That is why the latest version of the servlet
> spec
> allows you to specify which one in your web.xml mappings.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-OT--request.getServletPath%28%29-val-not-same-in-Filter---Servlet-tf2152125.html#a5964193
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to