RE: Rewriting URLs in Tomcat

2004-07-29 Thread Shapira, Yoav

Hi,
I wrote Tomcat's Balancer webapp partially to address this need.  Check
it out.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: Jon Wingfield [mailto:[EMAIL PROTECTED]
>Sent: Thursday, July 29, 2004 6:26 AM
>To: Tomcat Users List
>Subject: Re: Rewriting URLs in Tomcat
>
>sendRedirect(...) tells the browser to use a resource in a different
>location. That location can be same webapp, different webapp, different
>server.
>
>forward(...) is for the same server only.
>In context:
>servletContext.getRequestDispatcher(path).forward(...);
>Out of context:
>servletContext.getContext(foreignContextName).getRequestDispatcher(path
).fo
>rward(...);
>
>For forwarding to a different context you have to have the relevant
>permissions or the servletContext.getContext(foreignContextName) call
>will return null. In tomcat the context doing the forwarding has to be
>marked as crossContext:
>http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html
>
>
>Jon
>
>PS the chained invocations above are illustrative only, not as I would
>normally code it ;)
>
>Jacob Weber wrote:
>
>> Tim Funk <[EMAIL PROTECTED]> wrote:
>>
>>>At http://funkman.home.comcast.net/ I have a project called
ServletUtils.
>>>You can use either RedirectFilter or ForwardFilter. They both can use
>regex's.
>>
>>
>> "Robert Harper" <[EMAIL PROTECTED]> wrote:
>>
>>>Have you tried the HttpServletResponse .sendRedirect( String url )
>method?
>>
>>
>>
>> Correct me if I'm wrong, but I think both of these approaches would
>> require the URL I'm requesting to be part of the same application as
the
>> one I'm redirecting to. So, for example, I couldn't redirect from:
>>
>> http://www.myserver.com/first_app/path
>>
>> to
>>
>> http://www.myserver.com/second_app/path
>>
>> Or am I missing something? This is what I'm trying to do.
>> Thanks,
>> Jacob
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Rewriting URLs in Tomcat

2004-07-29 Thread Jon Wingfield
sendRedirect(...) tells the browser to use a resource in a different 
location. That location can be same webapp, different webapp, different 
server.

forward(...) is for the same server only.
In context:
servletContext.getRequestDispatcher(path).forward(...);
Out of context:
servletContext.getContext(foreignContextName).getRequestDispatcher(path).forward(...);
For forwarding to a different context you have to have the relevant 
permissions or the servletContext.getContext(foreignContextName) call 
will return null. In tomcat the context doing the forwarding has to be 
marked as crossContext:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html

Jon
PS the chained invocations above are illustrative only, not as I would 
normally code it ;)

Jacob Weber wrote:
Tim Funk <[EMAIL PROTECTED]> wrote:
At http://funkman.home.comcast.net/ I have a project called ServletUtils.
You can use either RedirectFilter or ForwardFilter. They both can use regex's.

"Robert Harper" <[EMAIL PROTECTED]> wrote:
Have you tried the HttpServletResponse .sendRedirect( String url ) method?

Correct me if I'm wrong, but I think both of these approaches would 
require the URL I'm requesting to be part of the same application as the 
one I'm redirecting to. So, for example, I couldn't redirect from:

http://www.myserver.com/first_app/path
to
http://www.myserver.com/second_app/path
Or am I missing something? This is what I'm trying to do.
Thanks,
Jacob
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Rewriting URLs in Tomcat

2004-07-28 Thread Jacob Weber
Tim Funk <[EMAIL PROTECTED]> wrote:
> At http://funkman.home.comcast.net/ I have a project called ServletUtils.
> You can use either RedirectFilter or ForwardFilter. They both can use regex's.

"Robert Harper" <[EMAIL PROTECTED]> wrote:
> Have you tried the HttpServletResponse .sendRedirect( String url ) method?


Correct me if I'm wrong, but I think both of these approaches would 
require the URL I'm requesting to be part of the same application as the 
one I'm redirecting to. So, for example, I couldn't redirect from:

http://www.myserver.com/first_app/path

to

http://www.myserver.com/second_app/path

Or am I missing something? This is what I'm trying to do.
Thanks,
Jacob


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Rewriting URLs in Tomcat

2004-07-28 Thread Tim Funk
At http://funkman.home.comcast.net/ I have a project called ServletUtils.
You can use either RedirectFilter or ForwardFilter. They both can use regex's.
-Tim
Jacob Weber wrote:
Is it possible to have Tomcat interpret one URL, e.g.
http://www.mysite.com/dir/dir/file
to really load another one, e.g.
http://www.mysite.com/otherdir/otherfile.do
I think Apache can do this with mod_rewrite; is there a Tomcat 
equivalent? I need this to maintain backward compatibility for people 
using the old URL.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Rewriting URLs in Tomcat

2004-07-28 Thread Robert Harper
Have you tried the HttpServletResponse .sendRedirect( String url ) method?

Robert S. Harper
801.265.8800 ex. 255
> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Jacob Weber
> Sent: Wednesday, July 28, 2004 3:07 PM
> To: [EMAIL PROTECTED]
> Subject: Rewriting URLs in Tomcat
> 
> Is it possible to have Tomcat interpret one URL, e.g.
> 
> http://www.mysite.com/dir/dir/file
> 
> to really load another one, e.g.
> 
> http://www.mysite.com/otherdir/otherfile.do
> 
> 
> I think Apache can do this with mod_rewrite; is there a Tomcat
> equivalent? I need this to maintain backward compatibility for people
> using the old URL.
> 
> Thanks,
> Jacob
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Rewriting URLs in Tomcat

2004-07-28 Thread Jacob Weber
Is it possible to have Tomcat interpret one URL, e.g.

http://www.mysite.com/dir/dir/file

to really load another one, e.g.

http://www.mysite.com/otherdir/otherfile.do


I think Apache can do this with mod_rewrite; is there a Tomcat 
equivalent? I need this to maintain backward compatibility for people 
using the old URL.

Thanks,
Jacob


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]