[opencms-dev] Static export: relativelinks_in_export + vfs link

Mariano Barcia opencms at colaborativa.net
Sun Feb 20 01:45:28 CET 2005


Dear all,

This issue reported by Patricio was part of a more general problem in
the static export affecting OpenCMS 5. I've submitted this as a bug here
http://www.opencms.org/bugzilla/show_bug.cgi?id=564. 

Digging into the CVS HEAD shows that this class has been deleted, so it
is likely that the problem is solved for future versions, isn't it Alex?


********
DESCRIPTION:
There are two bugs with relative links in static export

1) template resources;
2) vfs links

1) Relative links resolve using the jsp template base path, instead of
the
path of page that calls the template. Thus, relative paths are formed
within 
the /jsptemplates/ dir under the sys mod folder ("../../../../etc").
This was 
previouslt reported as a bug, see posts
http://mail.opencms.org/pipermail/opencms-dev/2003q2/005263.html
http://mail.opencms.org/pipermail/opencms-dev/2003q2/005260.html
http://mail.opencms.org/pipermail/opencms-dev/2003q2/005096.html

2) Relative links resolve OK in the export, but only for the "real"
resource, not for the link. The exported html file for a vfs link will
have
the relative link resolved as if the vfs link were the "real"
resource that points to. That is to say, jsp and html files
under the add-ons dir will have the relative links set correctly, but
vfs
links that point to them will not.
********

We have researched the issue, and found the following related posts in
the mailing-list archives.

http://mail.opencms.org/pipermail/opencms-dev/2003q2/005263.html
http://mail.opencms.org/pipermail/opencms-dev/2003q2/005260.html
http://mail.opencms.org/pipermail/opencms-dev/2003q2/005096.html

We found class com.opencms.util.LinkSubstitution as the "suspect", and
we are testing a patch for it  (attached).

Regards,
--mariano

-----Mensaje original-----
De: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] En nombre de Patricio Keilty
Enviado el: Martes, 15 de Febrero de 2005 10:04 p.m.
Para: The OpenCms mailing list
Asunto: [opencms-dev] Static export: relativelinks_in_export + vfs link

Hi all,
i´m trying to use relative links in static exported pages, which use vfs

links to jsp pages, let me explain it with an example:

- i have 2 pages: /test1.html and /test2.html
- /test1.html is a vfs link to a jsp page : /add-ons/elements/test1.html
- /add-ons/elements/test1.html does a redirect to /test2.html by means 
of a <cms:link/>
- /test2.html is a regular html page

graphically......


/test1.html  ------ vfs link -------> /add-ons/elements/test1.html  ( 
redirects to /test2.html via window.location = 
"<cms:link>/test2.html</cms:link>"; )
 

|
 

|
/test2.html                               <<----------------------

First tried NOT using relative links as relevant properties in 
opencms.properties show:
...
staticexport.path=export/
...
url_prefix_export=/${WEB_APP_NAME}/export
....
relativelinks_in_export=false

So far, it worked, pointing my browser to 
http://localhost/opencms/export/test1.html redirects me to 
http://localhost/opencms/export/test2.html.
This is export/test1.html resulting code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>

<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.location = "/opencms/export/test2.html";
//-->
</SCRIPT>
</BODY>
</HTML>

Then tried using relative links as for:
...
staticexport.path=export/
...
url_prefix_export=
....
relativelinks_in_export=true

This time accessing http://localhost/opencms/export/test1.html will 
produce a Error 404 page not found; as export/test1.html code is now:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>

<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.location = "../../test2.html";
//-->
</SCRIPT>
</BODY>
</HTML>

A jsp page, /test3.html which has exactly the same code as 
/add-ons/elements/test1.html will produce the following code, which
works:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>

<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.location = "test2.html";
//-->
</SCRIPT>
</BODY>
</HTML>

The problem seems to be that relative links replacement is done on the 
actual resource, the jsp page under /add-ons/elements, and not on the 
vfs link page ( /test1.html ). Is there any way to achieve this? Can´t 
afford to move jsp pages where regular html pages, that´s why i´m using 
vfs links in first place.

Any hints ?
( Using ver. 5.0.1 )

Regards

-- 
Patricio Keilty
Colaborativa.net



_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please
visit
http://mail.opencms.org/mailman/listinfo/opencms-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relative-links.patch
Type: application/octet-stream
Size: 920 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050219/12808eef/attachment.obj>


More information about the opencms-dev mailing list