On Fri, 6 Dec 2002, RXZ JLo wrote:

> Date: Fri, 6 Dec 2002 01:50:31 -0800 (PST)
> From: RXZ JLo <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: RE: static url routing
>
>
> --- "Noel J. Bergman" <[EMAIL PROTECTED]> wrote:
> > > my html files have long names like
> > > a_b_c_d_xyz213_e_f_g.html,
> > a_b_c_d_pqr983_e_f_g.html
> >
> > > is it possible to have urls like
> > > http://localhost:8080/myapp/html/xyz213
> > > point to the first file above?
> >
> > You can use either a Filter, or mod_rewrite in
> > Apache httpd.
> >
>
> I had a glance at javax.servlet.Filter - with this I
> cannot avoid entering a servlet, which will then wont
> be 'static' response.
>

You actually *can* avoid entering a servlet, so Filter is a very practical
way to do "redirect" type things, especially in the same webapp.

The normal flow of a Filter's doFilter() method usually looks like this:

  ... do some preprocessing ...
  chain.doFilter(request, response);
  ... do some postprocessing ...

However, there is *no* requirement that you actually call the
chain.doFilter() method to pass the request on.  It's entirely legal for
your Filter to do something that creates the response and returns, instead
of forwarding the rest of the call.

To do a redirect filter, then, you'd examine the request URI to determine
what kind of remapping is needed, and then do a
RequestDispatcher.forward() call to the remapped resource name.  After the
forward returns (which means that the actual response has been created),
simply return instead of calling chain.doFilter() to pass the request on.

>
> >     --- Noel
> >
>
> Thanks
> rf
>

Craig



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

Reply via email to