tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DIGLLOYD INC <digllo...@diglloyd.com>
Subject Re: simple JSP redirect to another page -- how to deal with relative URLs
Date Sun, 27 Apr 2008 20:13:21 GMT
David,

I want to redirect perhaps a dozen links in directories that have a  
main page accessed something like:
/stuff/start-page.html

In thinking about this, maybe my best solution is to rename the main  
page to "index.html" for simplicity and use the org.tuckey.web.filters.urlrewrite.UrlRewriteFilter

  with basic patterns.

Lloyd

On Apr 25, 2008, at 1:38 PM, David Fisher wrote:

> Seconded.
>
> DIGLLOYD said the following:
>
>> 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.
>
> The only trouble I've had with redirects is when you redirect to a  
> page which redirects to a page which redirects to a page. Browsers  
> consider more than a few redirects in a row to be a bad thing and  
> they stop. My experience taught me (about 7 years ago) that more  
> then 2 was pushing things.
>
> DIGLLOYD are only replacing a single generation of files, as you do  
> this "relinking" how many links do you want to "forward" or  
> "redirect"?
>
> Regards,
> Dave
>
> On Apr 25, 2008, at 3:27 PM, David Smith wrote:
>
>> Never mind .. I saw your other responses and the best solution is  
>> the redirect option.  After following the redirect, the browser  
>> will have the correct URL for calculating the full url of each of  
>> the page's resources.
>>
>> --David
>>
>> David Smith wrote:
>>> I see the problem.  You could use absolute paths in jsp includes  
>>> and the servlet container would understand them as relative to the  
>>> webapp's root as opposed to the server's root:
>>>
>>> Say you have this file layout
>>>
>>> webapp
>>> |    index.jsp
>>> |    article1
>>> |        index.jsp
>>> |        article1.html
>>> |    article2
>>> |        index.jsp
>>> |        article1.html
>>>
>>> article2/index.jsp could simply have <jsp:include file="/article1/ 
>>> article1.html" /> and it would find article1.html in the article1  
>>> folder.
>>>
>>> --David
>>>
>>> DIGLLOYD INC wrote:
>>>> I previously asked about remapping URLs and got some helpful  
>>>> responses. In a nutshell, this was recommended:
>>>> http://tuckey.org/urlrewrite/
>>>>
>>>> Looks very good for some purposes.
>>>>
>>>> But I also want to solve a much simpler problem--
>>>>
>>>> I have a very large amount of static content (articles), with  
>>>> each article in its own directory.  A main Table of Contents  
>>>> links to the start page in each directory, which is *not*  
>>>> index.html (eg some-main-page.html).  I don't want to rename or  
>>>> change those pages as they have world-wide direct links to them-- 
>>>> they have to stay as-is.  But I do want to insert an index.jsp  
>>>> page without altering any content.
>>>>
>>>> For many of these folders inserting a trival index.jsp solves the  
>>>> index-page problem:
>>>> <%@ include file="the-main-page.html" %>
>>>>
>>>> (though I do wonder if google consider this unacceptable  
>>>> duplicate content)
>>>>
>>>> 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" />
>>>>
>>>> The jsp:forward directive seems perfect, but the flaw of not  
>>>> changing the current location (eg no "cd" is done first) makes it  
>>>> useless for this purpose.  Or does it?  Is there something I'm  
>>>> missing here?
>>>>
>>>> Alternately, is there some other trivial solution?
>>>>
>>>> URL-rewriting is not appropriate in this case; there is no  
>>>> particular pattern, just a fair number of specific cases.  I was  
>>>> hoping for a simple 1-line index.jsp in each directory.
>>>>
>>>> Lloyd
>>>>
>>>>
>>>> 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: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message