Darren,
Hmm, I see John already replied, but since I just finished writing this
message, here it is anyway....
To change the /myapp/servlet/myapp of the url generated by TemplateLink,
simply:
1. Call $link.setScriptName("/app") when outputting the url. (Turbine calls
the /myapp/servlet/myapp part the ScriptName)
2. Or simply create a class similar to TemplateLink to return what you want
in the toString() method. TemplatLink is used as a pull tool. You can create
your own pull tool to generate URLs in your app, so that you can get the
output you want.
To get relative URLs, simply rewrite the toString of TemplateLink to look
like org.apache.turbine.util.RelativeDynamicURI's toString. If you are like
me you'll maybe end up writing your own link pull tool.
In your turbine properties, look for the word TemplateLink. Change that line
to point to the class you would like to use to generate your URLS and then
$link will use that class instead of turbine's TemplateLink class.
3. and Understand that the part of which you speak is a combination is
essentially HttpServletRequest.getContextPath() +
HttpServletRequest.getServletPath() so you could put something like this in
your web.xml file:
<servlet>
<servlet-name>myapp</servlet-name>
<servlet-class>org.apache.turbine.Turbine</servlet-class>
<init-param>
<param-name>properties</param-name>
<param-value>/WEB-INF/conf/turbine/turbine.properties</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
and
<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
and in your server.xml you _may_ need
<Context path="/" docBase="@APP_ROOT@" debug="5" reloadable="false"/>
inside your <ContextManager> where @APP_ROOT@ is the full path to where you
application root is.
In this case you should now have $link returning /app in your templates
instead of /myapp/servlet/myapp.
All of this assumes Turbine 2.*
As John said, the simple approach is to write your own pull tool to do the
job.
-Peter
----- Original Message -----
From: "Darren Gilroy" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[EMAIL PROTECTED]>
Sent: Sunday, February 10, 2002 10:15 PM
Subject: TemplateLink
> Hi -
>
> I'm trying to place my turbine application behind an apache (1.3) proxy,
and
> I need some help.
>
> I have /app proxied to anotherhost:8180/myapp/servlet/myapp via ProxyPass,
> with ProxyPassReverse working too, but I need some help with the next
step.
>
> The $link object (org.apache.turbine.util.template.TemplateLink) and the
> $content object both return fully-qualified urls. I would like to adjust
> those urls so they don't include the /myapp/servlet/mayapp part, or,
> preferably, have those objects return relative URLs.
>
> Ideas, suggestions, how-tos for this next step?
>
> Thanks!
> -best-darr-
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>