[prev] [thread] [next] [Date index for 2005/05/22]
This is a multi-part message in MIME format.
------=_NextPart_000_004D_01C55EE2.E6346360
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi, I'm trying to write my own translation handler. The problem is that =
I'd like to map something like:
/foo.html to /bar/servlet/test
where /bar/ is supposed to be handled by mod_jk with something like:
<Location "/bar">
JkUriSet worker ajp13:localhost:8009
</Location>
When I tried to use mod_rewrite, the mapping took effect, but then =
apache tried to find the file: "/bar/servlet/test"=20
rather than applying the <Location/> to send to mod_jk.
I thought a mod_perl's PerlTransHandler will solve this problem, with a =
simple:
package Urlmap;
use strict;
use Apache2::Const -compile =3D> qw(DECLINED);
use Apache2::RequestRec;
sub handler{
my $r =3D shift;
my $uri =3D $r->uri;
my $target =3D "";
if($uri =3D~ m|^/foo.html|i){
$r->uri("/bar/servlet/test");
}
return Apache2::Const::DECLINED;
}
But it is giving me the same error, it returns a 404 file not found for =
"/bar/servlet/test".
So how can I change the URL, and still apply the <Location/> directive =
afterwards?
Thanks.
Z.
------=_NextPart_000_004D_01C55EE2.E6346360
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Hi, I'm trying to write my own =
translation handler.=20
The problem is that I'd like to map something like:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> /foo.html to=20
/bar/servlet/test</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>where /bar/ is supposed to be handled =
by mod_jk=20
with something like:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> <Location=20
"/bar"><BR> JkUriSet worker =
ajp13:localhost:8009<BR> =
</Location></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>When I tried to use mod_rewrite, the =
mapping took=20
effect, but then apache tried to find the file: "/bar/servlet/test"=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>rather than applying the =
<Location/> to send=20
to mod_jk.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I thought a mod_perl's PerlTransHandler =
will solve=20
this problem, with a simple:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>package Urlmap;<BR>use strict;<BR>use=20
Apache2::Const -compile =3D> qw(DECLINED);<BR>use=20
Apache2::RequestRec;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>sub handler{<BR> my =
$r =3D=20
shift;<BR> my $uri =3D =
$r->uri;<BR> my=20
$target =3D "";<BR> if($uri =3D~=20
m|^/foo.html|i){<BR> =20
$r->uri("/bar/servlet/test");<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> return=20
Apache2::Const::DECLINED;<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>But it is giving me the same error, it =
returns a=20
404 file not found for "/bar/servlet/test".</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>So how can I change the URL, and still =
apply the=20
<Location/> directive afterwards?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Z.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> </DIV>
<DIV><BR></DIV></FONT></FONT></DIV></BODY></HTML>
------=_NextPart_000_004D_01C55EE2.E6346360--
|
Help with PerlTransHandler
|
|
Re: Help with PerlTransHandler
|
Generated at 15:53 on 25 May 2005 by mariachi v0.52