Good morning everyone!
Some while ago I stopped using URL rewrites, preferring to use the Apache
ErrorDocument directive to route requests to a direct action in my WO
application that then handles the URLs. This works fine apart from a little
wrinkle:
When Apache uses ErrorDocument to handle a URL it stores the requested url and
its query string into two separate headers, "redirect_url" and
"redirect_query_string". Since the query string is not part of the URI, query
parameters (form values) are not parsed and not accessible from the application
(in the traditional way).
I'm currently handling this by appending the query string to the URL in
dispatchRequest, then creating a new request with the new uri and dispatching
it:
-----------------------------------------------------------
@Override
public WOResponse dispatchRequest( WORequest r ) {
String queryString = r.headerForKey( "redirect_query_string" );
if( queryString != null ) {
String uri = r.uri() + "?" + queryString;
r = new ERXRequest( r.method(), uri, r.httpVersion(),
r.headers(), r.content(), r.userInfo() );
}
return super.dispatchRequest( r );
}
-----------------------------------------------------------
This works, but I don't like it since I'm (1) Creating two request objects for
every request and (2) More importantly, I don't want this logic in
dispatchRequest since this functionality is part of a non-intrusive framework
(ie. no classes in the application should have to inherit from special classes
in the framework).
So: Does anyone have any great ideas on how to get those damned query
parameters into my form values dictionary, without hacking around in the
Application class?
Oh, here's the Apache config:
-----------------------------------------------------------
ErrorDocument 404 /Apps/WebObjects/Application.woa/wa/URLHandlerAction/handleURL
-----------------------------------------------------------
Cheers,
- hugi
// Hugi Thordarson
// http://ww.godurkodi.is/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]