tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Servlet Mapping Strategy w/ user-specific URLs
Date Thu, 09 Jan 2003 18:09:33 GMT


On Thu, 9 Jan 2003, Jeffrey Winter wrote:

> Date: Thu, 9 Jan 2003 09:35:09 -0500
> From: Jeffrey Winter <jeffreywinter@attbi.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> Subject: Re: Servlet Mapping Strategy w/ user-specific URLs
>
>
> > At 01:48 PM 1/8/2003, you wrote:
> > >So you're talking about using the sorts of Filters available as of the
> > >Servlet 2.3 spec?  That actually sounds promising, I'll take a look at
> it.
> >
> > Yep.
>
> Okay, one question about this: in the Filter, I'd parse the url and
> determine
> which servlet should be the target, either the "UserServlet" or
> "ResourceServlet"
> and then create an apporpriate RequestDispatcher.  Then call,
>
>     dispather.forward(...);
>
> This would happen instead of calling, say,
>
>     chain.doFilter(...);
>
> So basically, this would need to be the last Filter in any FilterChain that
> I may create, because the chain would be broken since I wouldn't be calling
> doFilter() in that Filter.
>
> Does this sound about right or is there something I'm missing?

It's perfectly legal for your Filter to return instead of calling
chain.doFilter(), if you know that the response has already been created.
It sounds like you are on a reasonable path.

Regarding how to create the "appropriate" RequsetDispatcher, there are two
different ways to do that:

  ServletContext.getRequstDispatcher() matches a servlet by path

  ServletContext.getNamedDispatcher() matches a servlet by
  servlet name

You might find the latter one more useful for your use case, since you are
deliberately *not* using request URI mapping to select which servlet to
run.

Craig


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message