"DIGLLOYD INC" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Christopher,
>
> Well, I'm not a web expert, so if there's a better way (redirect) I'm  all 
> ears.
>
> From what I can find by googling, redirects have a slew of issues of 
> their own. But I'm a newbie at this, so I might be misunderstanding.
>
> How would I do a redirect in Tomcat for my stated issue, keeping in  mind 
> that doing so is case-by-case, not a nice regexp pattern.
>

If I were given this problem, I'd probably write a Filter that uses a 
properties files to resolve references.  Something like:

    public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
    throws IOException, ServletException {
         if(request instanceof HttpServletRequest && response instanceof 
HttpServletResponse) {
              HttpServletRequest hrequest = (HttpServletRequest)request;
              HttpServletResponse hresponse = (HttpServletResponse)response;
              String req = hrequest.getServletPath();
              if(req.length() > 0)
                    req = req.substring(1).replace('/','.');
              String where = map.get(req);
              if(where != null) {
                   hresponse.sendRedirect(where);
                   return;
             }
        }
        chain.doFilter(request, response);
    }

> Lloyd
>
> On Apr 25, 2008, at 1:05 PM, Christopher Schultz wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Lloyd,
>>
>> DIGLLOYD INC wrote:
>> | My pages all use relative links eg "..", "./", etc.  So this works
>> | ***when the page being included is in the same directory**.
>> |
>> | But when the include page is in another directory, none of the 
>> relative
>> | links work.  None of these variants do the right thing; any  referenced
>> | images cannot be found.
>> |
>> | <%@ include  file="../ReviewInfo.html" %>
>> | <jsp:include file="../ReviewInfo.html" %>
>> | <jsp:forward page="../some-other-page.html" />
>>
>> This is a very weird way to do things. You should either generate
>> content /or/ forward. Why are you doing both?
>>
>> Instead of using a forward, why not do a redirect? That way, the new
>> request has the correct URL and your relative paths should be correct.
>>
>> - -chris
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iEYEARECAAYFAkgSOW4ACgkQ9CaO5/Lv0PCZtgCgwMQ2Nq53WFJV1qA2UtOVT62P
>> aroAoLf5WOFn4FKM/4PN1TtFukZPSUkI
>> =/4tC
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> Lloyd Chambers
> http://diglloyd.com
>
> [Mac OS X 10.5.2 Intel, Tomcat 6.0.16]
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to