I have something I'd like to to (or find some equivalent method for), that
isn't working like I hoped.
I have an app in glassfish that can have virtual 'partitions' inside it (not
anything to do with any sort of real partitions, it's just a way of choosing
behaviour of the program). Anyway, I want URLs that look like:
http://www.example.com/myapp/partition
This I can do without issue, however the problem is there is HTML, JS, and
images etc under there, normally accessed just under 'myapp',
e.g. '...com/myapp/picture.png'. This breaks down when it comes to my fancy
URLs, as I end up with
http://www.example.com/myapp/partition/picture.png, which of course doesn't
exist and so I get errors.
What I tried to do was write a servlet filter that took the URL that was
given, and rewrote it to remove the partition name (and store it in the
attributes for the webapp itself to worry about), so:
http://www.example.com/myapp/partition/picture.png
becomes
http://www.example.com/myapp/picture.png
In theory, this should work. However it doesn't (I get 404s), and I don't
quite know why. My guess is that before the request ever gets to my filter,
glassfish has already decided which servlet/file is going to receive it, and
me rewriting the URL (by changing what the request's getRequestURI() returns)
has no effect.
So my question is: is there a way to have a filter happen really early, and
affect the decision the server makes as to where a request gets dispatched
to, or is there some other way of doing this?
Cheers,
--
Robin <robin_at_kallisti.net.nz> JabberID: <eythian_at_jabber.kallisti.net.nz>
Hostes alienigeni me abduxerunt. Qui annus est?
PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
- application/pgp-signature attachment: stored