Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Trailing slash added

Trailing slash added

2007-01-15       - By Rashmi Rubdi

 Back
-- -- Original Message ----
From: Len Popp <len.popp@(protected)>
To: Tomcat Users List <users@(protected)>
Sent: Monday, January 15, 2007 12:06:09 PM
Subject: Re: Trailing slash added


>>If you move a file you will have to fix some links, no matter what
>>sort of URLs you use. If nothing else, the links that referred to the
>>moved file will be broken.

Yes

>>But regardless, there are many web sites
>>that do use relative URLs, and that would be a problem in this case.

Yes, there's nothing wrong with using relative URLs. But using context relative
URLs minimizes
the amount of changes that need to be made to the *file that contains them*, as
opposed to just relative URLs mentioned inside a file.

Consider index.jsp with this directory structure:

/folder1/folder2/index.jsp

And the code in index.jsp with relative URLs

<a href="../../page1.jsp">Link Text</a>
<a href="page2.jsp">Page 2</a>

If index.jsp is moved from /folder1/folder2/index.jsp  , to /folder1/index.jsp
then because there are relative URLs inside index.jsp, they need to be changed
as follows:

<a href="../page1.jsp">Link Text</a>
<a href="folder2/page2.jsp">Page 2</a>

But, if all URLs inside index.jsp were context relative as follows:

<a href="/page1.jsp">Link Text</a>
<a href="/folder1/folder2/page2.jsp">Page 2</a>

Then, no matter how many times you move index.jsp the code inside index.jsp
that refers to context relative URLs won't change. The amount of code that
needs to change appears small in this case but it can save a lot of work,
typing and debugging (if the IDE doesn't take care of the changes) on larger
projects.

But whatever code is refering to index.jsp itself will have to change - that's
unavoidable - but at least you've minimized amount of code that needs to be
changed *inside index.jsp itself*.


>>It doesn't matter if it's done by URLRewriteFilter or some other
>>method because it's the browser that interprets the relative URLs, not
>>the server. If the containing page's URL looks like a file when it's
>>really a directory, the browser will get them wrong. That's why the
>>usual behaviour for servers is to use a re-direct to add "/" or
>>"/index.html" or something. The only other correct response to a
>>"bare" directory name would be to return an error, which is
>>inconvenient for users.

I don't really understand why one would want to get rid of the trailing slash.

-Rashmi



__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ______
__ __
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.