• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Apache ErrorDocument and the query string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Apache ErrorDocument and the query string


  • Subject: Apache ErrorDocument and the query string
  • From: Hugi Thordarson <email@hidden>
  • Date: Thu, 10 Jan 2013 11:10:34 +0000

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: URL re-writing at the root of the domain
  • Next by Date: Small change to properties loading
  • Previous by thread: Re: URL re-writing at the root of the domain
  • Next by thread: Small change to properties loading
  • Index(es):
    • Date
    • Thread