You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bernard Lange <be...@man.poznan.pl> on 2006/05/31 14:15:16 UTC

Tapestry 3.0.4 and Friendly URLs patch problem

Hello all,

I'm trying to set our Tapestry 3.0.4-based system to work with FURLs. 
I've followed information from the tutorial 
<http://wiki.apache.org/tapestry/FriendlyUrls> - applied patch and 
created Link and services implementations.

So far so good. It seems to ALMOST work if I set up my servlet mappings 
as follows: (excerpt from web.xml):

     <servlet-mapping>
	    <servlet-name>high</servlet-name>
	    <url-pattern>/</url-pattern>
     </servlet-mapping>
	
     <servlet-mapping>
         <servlet-name>high</servlet-name>
         <url-pattern>*.htm</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>high</servlet-name>
         <url-pattern>*.reset</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>high</servlet-name>
         <url-pattern>*.do</url-pattern>
     </servlet-mapping>	

The first problem with the patch I've enountered is 
BaseEngine.extractServiceName method implementation which throws 
exception if no FURL suffix is matched.

It happens everytime when the application root is accessed ( 
"localhost:8080/edu-high/" - servletPath  is '/' string). I believe this 
method should in such  a situation defaults to 'Tapestry.HOME_SERVICE' 
as the original tapestry BaseService does when no 'service' parameter 
was found. So I've patched it to use home service if none of the FURL 
suffixes is found in servletPath variable.

It seems that it works now. But was this change necessary?


However, my concern is that the mappings above are my 'developer' 
settings. The production mappings are quite different:

     <servlet-mapping>
	    <servlet-name>high</servlet-name>
	    <url-pattern>/oswiata/</url-pattern>
     </servlet-mapping>
	
     <servlet-mapping>
         <servlet-name>high</servlet-name>
         <url-pattern>*.htm</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>high</servlet-name>
         <url-pattern>*.reset</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>high</servlet-name>
         <url-pattern>*.do</url-pattern>
     </servlet-mapping>

Note that the servlet is now available under '/oswiata/' mapping not the 
'/'.

That causes several problems with FURLs patch.

First of all generated links point to: '/edu-high/' not to 
'/edu-high/oswiata/'

i.e.
'/edu-high/asset.do?sp=logo.gif&sp=MDSUMGOESHERE'
'/edu-high/eduHigh:SchoolDetailsBasicView.htm'
'/edu-high/eduHigh:MainRE.htm?service=direct&amp;service=1&amp;service=%24TopMenu.%24UserSwitch.%24DirectLink%240&amp;sp=429626729'
etc.

Secondly, if I try to test asset service (or any other service different 
from page and external) and access an asset via  '/edu-high/oswiata/' i.e.

'http://localhost:8080/edu-high/oswiata/?sp=logo.gif&sp=MDSUMGOESHERE'

I get an ApplicationRuntimeException exception "Engine does not 
implement a service named 'oswiata/asset'" - this is the result of 
assumption that service name starts after first '/' in servletPath...

Any suggestions how to make this things work? I cannot change my 
production servlet-mapping to '/'...

Do I have to find out the way to generate proper links/service/page 
names based on servlet-mapping value?

Any help would be appreciated. Sorry for long post.


Regards,
Bernard

PS. This may be helpful:

My context path is set to '/edu-high' so my app is accessible under 
address localhost:8080/edu-high/

My .application loooks as follows:

<application name="high" 
engine-class="pl.psnc.edu.tapestry.high.application.engine.HighEngine">
     <description>HighSchool Application</description>

     <!-- friendly URLs configuration -->
     <property name="org.apache.tapestry.page-url-suffix" 
value=".htm"></property>
     <property name="org.apache.tapestry.reset-url-suffix" 
value=".reset"></property>
     <property name="org.apache.tapestry.service-url-suffix" 
value=".do"></property>

     <service name="home" 
class="pl.psnc.tapestry.furl.service.FURLHomeService"/>
     <service name="restart" 
class="pl.psnc.tapestry.furl.service.FURLRestartService"/>
     <service name="reset" 
class="pl.psnc.tapestry.furl.service.FURLResetService"/>
     <service name="page" 
class="pl.psnc.tapestry.furl.service.FURLPageService"/>
     <service name="external" 
class="pl.psnc.tapestry.furl.service.FURLExternalService"/>
     <service name="direct" 
class="pl.psnc.tapestry.furl.service.FURLDirectService"/>
     <service name="action" 
class="pl.psnc.tapestry.furl.service.FURLActionService"/>
     <service name="asset" 
class="pl.psnc.tapestry.furl.service.FURLAssetService"/>

....

</application>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry 3.0.4 and Friendly URLs patch problem

Posted by Bernard Lange <be...@man.poznan.pl>.
Bernard Lange wrote:
> 'http://localhost:8080/edu-high/oswiata/?sp=logo.gif&sp=MDSUMGOESHERE'

Correction. The link goes of course as:
'http://localhost:8080/edu-high/oswiata/asset.do?sp=logo.gif&sp=MDSUMGOESHERE'

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org