users@jsr311.java.net

trailing slash

From: Reto Bachmann-Gmür <reto.bachmann_at_trialox.org>
Date: Tue, 06 Jan 2009 10:56:37 +0100

according to section 3.7.3 a trailing slash in a Uri template is
ignored. To be able to easily use generate relative link I think it
would be better to have the implementation redirect to the location with
trailing slash if the path contains one.

Example

@Path("my-app/")
public class MyApp {

@GET
@Produces("text/html")
public String getEntryPage() {
return "<a href='subpage1'>subpage1</a><br><a href='subpage2'>subpage2</a>";
}

@Path("subpage1");
public Response getSubPage1() {
...
}

@Path("subpage2");
public Response getSubPage1() {
...
}

}

The generated link in this application work when the entry page is
invoked with a trailing slash but not when invoked without.

Wouldn't it be nice if implementation would "canonicalize" the request
uris by sending respective redirects?

Cheers,
Reto