Hi,

 +tool.content.want.relative = false
 +tool.link.want.relative = false

I set to true bot it did't work and I can't used $link.setPage('something')
.setAction('something.ReqFormAction').getRelativeLink() because the last
method doesn't exist.

For link's tool, I use the RelativeTemplateLink class which provide relative
link.

For content's tool, I override the class ContentURI by my own class called
RelativeContentURI. I reimplement the getURI method where I call
super.getURI and I delete the "http://serverAdress:port"; part of the adress.

package com.myapp.util;

import org.apache.turbine.util.ContentURI;
import org.apache.turbine.util.Log;

/**
* @author tcmt8300
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class RelativeContentURI extends ContentURI {

   /* (non-Javadoc)
    * @see org.apache.turbine.util.ContentURI#getURI(java.lang.String)
    */
   public String getURI(String arg0) {

       String URI = super.getURI(arg0);

       String relativeURI = URI.replaceAll("^http://[^/]*","";);

       Log.debug( "debug", "Building URI " + relativeURI + " <- " + URI);

       return relativeURI;

   }
}

and I set the following property in TurbineResource.properties :

tool.request.content=com.myapp.util.RelativeContentURI


However, I didn't find a Turbine 2.2 solution for this problem...

Thanks a lot for your help.

Thibaud


2007/1/12, Thib <[EMAIL PROTECTED]>:

Hi,

Thanks for your help. I succeed using relative link. I modified the
TurbineResources file and I replaced the line :

tool.request.link=org.apache.turbine.util.template.TemplateLink

by

tool.request.link=org.apache.turbine.util.template .RelativeTemplateLink

and all the generated link are now relative.

I have the same problem with the "content tool" which generates absolute
images and javascripts' links. I don't find any class which allow to
generate relative link... Any idea ?

2007/1/11, AFrieze <[EMAIL PROTECTED]>:
>
> Thib wrote:
> > Hi,
> >
> > I'm using tdk 2.2 ( I know it's an very old version but I can't
> > migrate to
> > Turbine 2.3 ).
> >
> > We installed the web application under a Http-Reverse-Proxy but the
> > web app.
> > doesn't work because all the link are absolute. I read that by default
> > the
> > $link parser generate absolute link as
> > http://serverAdress:Port/myApp/servlet/myApp/template/MyPage.vm.
> >
> > I found a solution in the turbine mailing list here :
> >
> 
http://mail-archives.apache.org/mod_mbox/jakarta-turbine-dev/200307.mbox/[EMAIL 
PROTECTED]
> 
<http://mail-archives.apache.org/mod_mbox/jakarta-turbine-dev/200307.mbox/[EMAIL 
PROTECTED]
> >
> >
> >
> > It's specified that the following properties make the $link tool
> > generating
> > relative link :
> >
> >  +tool.content.want.relative = false
> >  +tool.link.want.relative = false
> >
> >
> > I try to use it in my configuration but it doesn't work.
> >
> > One solution can be to implement a new $link tools but it will be very
> > hard
> > for me :(
> >
> > What do you think about this problem ? The $link configuration has
> always
> > exist or it is present only in the last version ?
> >
> > Thanks a lot.
> >
> > Best regards
> >
> HI
>
>   I have never dealt with your exact problem, but would this work?
>
> In your Velocity Template....
>
>
> $link.setPage('something').setAction(' something.ReqFormAction
> ').getRelativeLink()
>
> $link.setPage('something').setAction('something.ReqFormAction
> ').getAbsoluteLink()
>
> Hope this helps
> AFrieze
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to