|
Re: Getting at content :o(: msg#00174web.mason.user
On Wed, 20 Aug 2003, Gareth Kirwan wrote: > I'm generating a request with: > my $ua = LWP::UserAgent->new(); > $ua->agent('InsLink/$Revision: 1.25 $ ' . $ua->agent); > $ua->timeout( 20 ) if defined( 20); > > my $request = HTTP::Request->new( POST => > 'http://devel.e-travelsure.com/xml/Inslink.xml' ); > $request->content_type('application/xml'); > $request->content( $m->scomp('InitialRequest-xml.mc') ); > > my $response = $ua->request($request); > > My question is: How does Inslink.xml get at what I would have expected to > have been $r->content ? Since $r->content will return an XML document instead of an x-www-form-urlencoded document, CGI or Apache::Request will probably not know what to do with it. And since you can only call $r->content once, you are going to have to get to it before they do. I suggest writing a handler which will intercept the content before mason does. Something like this might work: use HTML::Mason::ApacheHandler; my $ah = HTML::Mason::ApacheHandler->new ( ..name/value params.. allow_globals => qw( $xml_content ), ); ... sub handler { my $r = shift; # grab xml content before the request does. undef $HTML::Mason::Commands::xml_content; if ($r->uri =~ m/\.xml$/) { $HTML::Mason::Commands::xml_content = $r->content; } $ah->handle_request($r); } (Maybe we should allow user-defined classes for args_method, instead of only CGI and "mod_perl".) ~ John Williams ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Weird bug - Redirect failing when eval inside a DESTROY method: 00174, Vadim O. Ustiansky |
|---|---|
| Next by Date: | Re: Mason component to output image: 00174, John Williams |
| Previous by Thread: | Getting at content :o(i: 00174, Gareth Kirwan |
| Next by Thread: | Mason component to output image: 00174, Adam Roth |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |