You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by Andrew Jaquith <an...@gmail.com> on 2010/02/25 22:02:49 UTC

WikiPaths and HTTP request parameters

All --

I've been doing some non-automated UI/quality checks on the current
3.0.0 builds. Things are moving along nicely, but one issue that has
popped up is the URL syntax for downloading attachments. However, it's
just a symptom of a bigger issue that needs to get solved for
hierarchical WikiPaths (sub-pages).

The root of the issue: how to represent WikiPath parameters in URLs.
For example: a page in the top level of the wiki space page hierarchy
called "Main" has a simple WikiPath: main:Foo (the "Foo page in the
'main' space"). Easy, right?

For comparison, a subpage "Bar" would have this WikiPath:
main:Foo/Bar. Again, pretty easy, right?

The difficulty is in how the URL should be encoded/ A straight
URL-encoding of the path looks like this: page=main%3AFoo%2FBar

But this doesn't always work well. I've found that inclusion of the
encoded slashes in a "clean URL" (such as AttachmentActionBean!)
causes the container to act funny. For example, this URL causes the
container to do something completely unexpected:

    http://localhost:8080/JSPWiki/attach/main%3Amain%2Fjsp-api.jar

And by "unexpected," I mean get a 400 error and zero-length response:

HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Thu, 25 Feb 2010 20:49:05 GMT
Connection: close

By contrast, a partial url-encoding (where the forward slash between
main are not encoded) works fine, and the attachment downloads as it
should:

    http://localhost:8080/JSPWiki/attach/main%3Amain/jsp-api.jar

Anybody have any idea on why one URL works, and the other does not?
The easiest "fix" would be to use a path separator (in the URL at
least) that isn't a slash. This would also solve the situation where
we aren't using clean URLs, and the page or path needs to be included
as a regular "page" parameter.

Andrew