You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Skriloff, Nicholas" <Sk...@darden.virginia.edu> on 2005/07/22 15:22:03 UTC
Friendly URL Servlet Path Problem.
We are using friendly URLs within the confines of Tapestry 3.0.3. I
have a service called EnrollmentReportService declared in our
application file. The service's job is to return the list of courses for
which a student is enrolled as a pdf. IT is working fine most of the
time except for when I run my automated web test.
<service name="EnrollmentReportService"
class="edu.darden.registrar.student.reports.EnrollmentReportService"/>
Web.xml has the following
<servlet-mapping>
<servlet-name>registrar-student</servlet-name>
<url-pattern>*.tap</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>registrar-student</servlet-name>
<url-pattern>*.svc</url-pattern>
</servlet-mapping>
If I am at working directly in firefox and click the submit button, I
get a url generated like follows
http://localhost:8100/registrar-student/Home.tap?service=EnrollmentRepor
tService&sp=...
However, when I run my automated Selenium test, where the test clicks
the submit button, I get
http://localhost:8100/registrar-student/home.svc?service=EnrollmentRepor
tService&sp=
THIS CAUSES MY HOME PAGE TO COME UP INSTEAD OF MY REPORT. NOTICE THE
DIFFERENCE BETWEEN HOME.TAP? AND HOME.SVC.
ONCE THAT HAPPENS, EVEN IF I GO BACK INTO FIREFOX AND ACT AS A USER
AGAIN, THE PROBLEM PERSISTS.
Any Thoughts?
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Friendly URL Servlet Path Problem.
Posted by Paul Ferraro <pa...@gmail.com>.
How does your custom service implement IEngineService.getLink(...)?
If you are closely adhering to the code outlined at
http://wiki.apache.org/jakarta-tapestry/FriendlyUrls then this method
should look something like this:
public static final String SERVICE_NAME = "EnrollmentReportService";
public ILink getLink(IRequestCycle cycle, IComponent component,
Object[] parameters)
{
String suffix =
cycle.getEngine().getSpecification().getProperty("org.apache.tapestry.service-url-suffix");
// This ILink implementation refers to the one outlined at
http://wiki.apache.org/jakarta-tapestry/FriendlyUrls
return new Link(cycle, SERVICE_NAME + suffix, null, parameters);
}
All custom services should also override
AbstractService.getServiceContext() like so:
protected String[] getServiceContext(RequestContext requestContext)
{
return
requestContext.getParameters(Tapestry.SERVICE_QUERY_PARAMETER_NAME);
}
Assuming your service-url-suffix = ".do", this will generate urls that
look like:
http://localhost:8100/registrar-student/EnrollmentReportService.do
Much prettier...
Paul
Skriloff, Nicholas wrote:
>We are using friendly URLs within the confines of Tapestry 3.0.3. I
>have a service called EnrollmentReportService declared in our
>application file. The service's job is to return the list of courses for
>which a student is enrolled as a pdf. IT is working fine most of the
>time except for when I run my automated web test.
>
> <service name="EnrollmentReportService"
>class="edu.darden.registrar.student.reports.EnrollmentReportService"/>
>
>Web.xml has the following
>
> <servlet-mapping>
> <servlet-name>registrar-student</servlet-name>
> <url-pattern>*.tap</url-pattern>
> </servlet-mapping>
> <servlet-mapping>
> <servlet-name>registrar-student</servlet-name>
> <url-pattern>*.svc</url-pattern>
> </servlet-mapping>
>
>If I am at working directly in firefox and click the submit button, I
>get a url generated like follows
>http://localhost:8100/registrar-student/Home.tap?service=EnrollmentRepor
>tService&sp=...
>
>However, when I run my automated Selenium test, where the test clicks
>the submit button, I get
>http://localhost:8100/registrar-student/home.svc?service=EnrollmentRepor
>tService&sp=
>
>THIS CAUSES MY HOME PAGE TO COME UP INSTEAD OF MY REPORT. NOTICE THE
>DIFFERENCE BETWEEN HOME.TAP? AND HOME.SVC.
>
>ONCE THAT HAPPENS, EVEN IF I GO BACK INTO FIREFOX AND ACT AS A USER
>AGAIN, THE PROBLEM PERSISTS.
>
>Any Thoughts?
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org