Fwd: Sitemesh Tapestry
Erik Hatcher <[email protected]> Thu, 21 Apr 2005 09:36:15 -0400
| Newsgroups | gmane.comp.web.sitemesh.general |
|---|---|
| Message-ID | <[email protected]> |
SiteMesh gurus,
A user of my SiteMesh Tapestry decorator has reported a bug, that
you'll see described in detail below.
The issue boils down to Tapestry using the servlet path as the prefix
to Tapestry generated URLs. Using the demo as an example, putting a
Tapestry PageLink in the Tapestry.html page (details below) causes the
link to look like this:
http://localhost:8080/sitemesh-example/tapestry.html?service=page/
Tapestry
When really it should look like this:
http://localhost:8080/sitemesh-example/tapestry?service=page/Tapestry
Tapestry, by default, uses the value returned by
request.getServletPath() as the URL prefix (with the context path
prepended, of course).
From my narrow point of view it seems that SiteMesh should be setting
the servlet path on the request wrapper when forwarding to the
decorator to the path of the decorator. Maybe this is against the
design principles of SiteMesh though? I assume its at least possible
to do this?
Luckily there is a workaround in Tapestry... subclass BaseEngine like
this:
public class TapestryEngine extends BaseEngine {
public String getServletPath() {
return getContextPath() + "/tapestry";
}
}
And replace "/tapestry" with whatever servlet mapping (typically
"/app") is used for the Tapestry ApplicationServlet.
Thoughts on this?
Thanks,
Erik
Begin forwarded message:
> From: Erik Hatcher <[email protected]>
> Date: April 21, 2005 6:15:22 AM EDT
> To: "Tapestry users" <[email protected]>
> Subject: Re: Sitemesh Tapestry
> Reply-To: "Tapestry users" <[email protected]>
>
> On Apr 20, 2005, at 3:20 PM, Naveen Nagulapally wrote:
>> I am trying to use tapestry sitemesh integration that you provided.
>> It works
>> pretty well, unfortunately, I have a problem.
>>
>> I configured sitemesh to use the decorator that you have designed.
>>
>>
>>
>> If I go to myJSP.jsp,
>>
>> Address: http://localhost:8080/myApp/myJSP.jsp
>>
>>
>>
>> The decorator is applied but all the other URLs generated by tapestry
>> components reference to myJSP.jsp rather than /app
>>
>> Example,
>>
>> 1. The url referencing any image is :
>> http://localhost:8080/myJSP.jsp?service= asset amp
>> sp=S%2Fimages%2Ffolder-closed.gif amp
>> sp=S47614fcee6bd1c46b4ef12eab4896642
>>
>> Instead of
>>
>> http://localhost:8080/app?service=asset
>> <http://localhost:8080/app?service=asset&sp=S%2Fimages%2Ffolder-
>> closed.gif&s
>> p=S47614fcee6bd1c46b4ef12eab4896642>
>> &sp=S%2Fimages%2Ffolder-
>> closed.gif&sp=S47614fcee6bd1c46b4ef12eab4896642
>>
>>
>>
>> As you can see, the request URL is myJSP,so url generated is wrong.
>>
>> What would be the easiest way to change this.
>
> Great question. I have just duplicated this issue with the
> sitemesh-example.war that SiteMesh includes (after applying my
> Tapestry decorator patch). I added <a jwcid="@PageLink"
> page="Tapestry">link back to this page</a> to decorators/Tapestry.html
> and it generated this link:
>
> http://localhost:8080/sitemesh-example/tapestry.html?service=page/
> Tapestry
>
> I have been using the Tapestry decorator, but without any Tapestry
> components to generate links so I hadn't seen this before.
>
> At this point all I'm doing is confirming the bug. I will look into
> this further when I can and let you know. Feel free to try to resolve
> this yourself somehow and let me know the fix if you discover it.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]