You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ramsay Domloge <rd...@arkemedia.com> on 2003/04/10 14:43:47 UTC

Re: URL Redirect

By default, Tomcat will serve "index.jsp" for a given directory, if no 
file is specified.

When you surf to www.google.com you are not specifying what file you 
want and therefore get the default.

You need to create a JSP/HTML page in the root directory called 
index.jsp (if you are only using Tomcat) or index.html if you are using 
Tomcat with Apache. The page will only contain the following:

<html>
	<head>
		<META http-equiv="refresh" content="0; URL=zyx/abc/index.jsp">
	</head>
</html>

This will be returned to the browser which will then automagically 
request the correct page.

If you care, this is the crap way to do it. It is slow and requires a 
second request from the browser, so for a single page request 2 
round-trips are required. A better solution is to create a servlet that 
serves the correct page without redirecting the browser. It will just 
perform a server-side redirect, which is far faster and leaner.

If you want a quick and dirty solution, go for the meta tag, if you want 
to do it properly it's time to learn Java and make a servlet.

Ramsay



krip pane wrote:
> Hi All,
> 
> First my thanks to all who have responded to my
> question - especially to Daniel Graham for providing a
> detailed explaination.  
> 
> To clarify on the "newbie" part, I've a sys admin
> (HP&Sun) experience, with no jsp background. I've been
> thrown supporting tomcat role at my job & to learn  on
> the fly.  Thus, I would like to first apologize for
> asking the obvious (trivial) questions, second I would
> appreciate any help I can garner from this group to
> learn the technology faster.
> 
> Thanks
> 
> 
> 
> --- Micael <ca...@harbornet.com> wrote:
> 
>>Hi, KRIP,
>>
>>If you do  not understand those answers, you
>>probably need to be a little 
>>more explicit about how "newbie" you are, so that
>>someone can tell how to 
>>help you.  Those are pretty basic answers for most
>>people on this 
>>site.  Are you brand new?  Do you know jsp at all? 
>>Let us know, then we 
>>can be more helpful.
>>
>>At 12:44 PM 4/9/03 -0700, krip pane wrote:
>>
>>>Hi Yoa,
>>>
>>>I'm a newbie...Can you please expand on the
>>
>>solution
>>
>>>Thanks
>>>
>>>
>>>--- "Shapira, Yoav" <Yo...@mpi.com> wrote:
>>>
>>>>Howdy,
>>>>Or a simple HTML file sitting at the root with a
>>>><META REFRESH...> tag
>>>>pointing to your index.jsp URL.
>>>>
>>>>Yoav Shapira
>>>>Millennium ChemInformatics
>>>>
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>From: Daniel Graham
>>>>
>>>>[mailto:danny@sound.ee.umist.ac.uk]
>>>>
>>>>>Sent: Wednesday, April 09, 2003 3:12 PM
>>>>>To: Tomcat Users List
>>>>>Subject: Re: URL Redirect
>>>>>
>>>>>try
>>>>>
>>>>>response.sendRedirect( ".... your url " );
>>>>>
>>>>>DG
>>>>>----- Original Message -----
>>>>>From: "krip pane" <jk...@yahoo.com>
>>>>>To: "tomcat" <to...@jakarta.apache.org>
>>>>>Sent: Wednesday, April 09, 2003 8:09 PM
>>>>>Subject: URL Redirect
>>>>>
>>>>>
>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>Can someone please help in redirecting url's
>>
>>with
>>
>>>>>>tomcat as standalone server.
>>>>>>
>>>>>>I would like to redirect all requests for
>>>>>>http://www.abc.com/xyz/abc/index.jsp
>>>>>>
>>>>>>so that when a user types
>>>>>>http://www.abc.com
>>>>>>
>>>>>>they'll be redirected to the first URL.
>>>>>>
>>>>>>TIA
>>>>>>
>>>>>>
>>>>
>>__________________________________________________
>>
>>>>>>Do you Yahoo!?
>>>>>>Yahoo! Platinum - Watch CBS' NCAA March
>>
>>Madness,
>>
>>>>live on your
>>>>desktop!
>>>>
>>>>>>http://platinum.yahoo.com
>>>>>>
>>>>>>
>>>>
>>---------------------------------------------------------------------
>>
>>>>>>To unsubscribe, e-mail:
>>>>
>>>>tomcat-user-unsubscribe@jakarta.apache.org
>>>>
>>>>>>For additional commands, e-mail:
>>>>
>>>>tomcat-user-help@jakarta.apache.org
>>>>
>>---------------------------------------------------------------------
>>
>>>>>To unsubscribe, e-mail:
>>>>
>>>>tomcat-user-unsubscribe@jakarta.apache.org
>>>>
>>>>>For additional commands, e-mail:
>>>>
>>>>tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>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:
>>>>tomcat-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail:
>>>>tomcat-user-help@jakarta.apache.org
>>>>
>>>
>>>
>>>__________________________________________________
>>>Do you Yahoo!?
>>>Yahoo! Platinum - Watch CBS' NCAA March Madness,
>>
>>live on your desktop!
>>
>>>http://platinum.yahoo.com
>>>
>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe, e-mail:
>>
>>tomcat-user-unsubscribe@jakarta.apache.org
>>
>>>For additional commands, e-mail:
>>
>>tomcat-user-help@jakarta.apache.org
>>
>>
>>
>>LEGAL NOTICE
>>
>>This electronic mail  transmission and any
>>accompanying documents contain 
>>information belonging to the sender which may be
>>confidential and legally 
>>privileged.  This information is intended only for
>>the use of the 
>>individual or entity to whom this electronic mail
>>transmission was sent as 
>>indicated above. If you are not the intended
>>recipient, any disclosure, 
>>copying, distribution, or action taken in reliance
>>on the contents of the 
>>information contained in this transmission is
>>strictly prohibited.  If you 
>>have received this transmission in error, please
>>delete the message.  Thank 
>>you  
>>
>>
>>
>>
> 
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>tomcat-user-help@jakarta.apache.org
>>
> 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
> http://platinum.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

-- 
    Ramsay Domloge
       Lead Developer

  W : http://www.arkemedia.com
  T : +44 1256 869 200
  F : +44 1256 329 119
  E : mailto:RDdomloge@arkemedia.com

                                                                            
============================================================================
                                                                            
            A R K E M E D I A   T E C H N O L O G I E S   L T D             
                                                                            
       VIEW POINT    BASING VIEW    BASINGSTOKE    HAMPSHIRE    RG21 4RG    
                                                                            
                          http://www.arkemedia.com                          
                                                                            
                         mailto:info@arkemedia.com                          
                                                                            
         Tel : +44 1256 869 200              Fax : +44 1256 329 119         
                                                                            
============================================================================
                                                                            
 The information in this e-mail and in any attachments is confidential and  
 is intended solely for the attention and use of the named addressee(s).    
                                                                            
============================================================================
                                                                            
 If you are not the intended recipient, or a person responsible for passing 
 it on to the intended recipient, you are not authorised to hold a copy of  
 this information and you must therefore not disclose, copy, distribute, or 
 retain this message or any part of it. MAILTO:Administrator@arkemedia.com  
                                                                            
============================================================================



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: URL Redirect

Posted by krip pane <jk...@yahoo.com>.
Thank you Ramsay....any suggestions on good technical
java books for a beginner like me.


--- Ramsay Domloge <rd...@arkemedia.com> wrote:
> By default, Tomcat will serve "index.jsp" for a
> given directory, if no 
> file is specified.
> 
> When you surf to www.google.com you are not
> specifying what file you 
> want and therefore get the default.
> 
> You need to create a JSP/HTML page in the root
> directory called 
> index.jsp (if you are only using Tomcat) or
> index.html if you are using 
> Tomcat with Apache. The page will only contain the
> following:
> 
> <html>
> 	<head>
> 		<META http-equiv="refresh" content="0;
> URL=zyx/abc/index.jsp">
> 	</head>
> </html>
> 
> This will be returned to the browser which will then
> automagically 
> request the correct page.
> 
> If you care, this is the crap way to do it. It is
> slow and requires a 
> second request from the browser, so for a single
> page request 2 
> round-trips are required. A better solution is to
> create a servlet that 
> serves the correct page without redirecting the
> browser. It will just 
> perform a server-side redirect, which is far faster
> and leaner.
> 
> If you want a quick and dirty solution, go for the
> meta tag, if you want 
> to do it properly it's time to learn Java and make a
> servlet.
> 
> Ramsay
> 
> 
> 
> krip pane wrote:
> > Hi All,
> > 
> > First my thanks to all who have responded to my
> > question - especially to Daniel Graham for
> providing a
> > detailed explaination.  
> > 
> > To clarify on the "newbie" part, I've a sys admin
> > (HP&Sun) experience, with no jsp background. I've
> been
> > thrown supporting tomcat role at my job & to learn
>  on
> > the fly.  Thus, I would like to first apologize
> for
> > asking the obvious (trivial) questions, second I
> would
> > appreciate any help I can garner from this group
> to
> > learn the technology faster.
> > 
> > Thanks
> > 
> > 
> > 
> > --- Micael <ca...@harbornet.com> wrote:
> > 
> >>Hi, KRIP,
> >>
> >>If you do  not understand those answers, you
> >>probably need to be a little 
> >>more explicit about how "newbie" you are, so that
> >>someone can tell how to 
> >>help you.  Those are pretty basic answers for most
> >>people on this 
> >>site.  Are you brand new?  Do you know jsp at all?
> 
> >>Let us know, then we 
> >>can be more helpful.
> >>
> >>At 12:44 PM 4/9/03 -0700, krip pane wrote:
> >>
> >>>Hi Yoa,
> >>>
> >>>I'm a newbie...Can you please expand on the
> >>
> >>solution
> >>
> >>>Thanks
> >>>
> >>>
> >>>--- "Shapira, Yoav" <Yo...@mpi.com> wrote:
> >>>
> >>>>Howdy,
> >>>>Or a simple HTML file sitting at the root with a
> >>>><META REFRESH...> tag
> >>>>pointing to your index.jsp URL.
> >>>>
> >>>>Yoav Shapira
> >>>>Millennium ChemInformatics
> >>>>
> >>>>
> >>>>
> >>>>>-----Original Message-----
> >>>>>From: Daniel Graham
> >>>>
> >>>>[mailto:danny@sound.ee.umist.ac.uk]
> >>>>
> >>>>>Sent: Wednesday, April 09, 2003 3:12 PM
> >>>>>To: Tomcat Users List
> >>>>>Subject: Re: URL Redirect
> >>>>>
> >>>>>try
> >>>>>
> >>>>>response.sendRedirect( ".... your url " );
> >>>>>
> >>>>>DG
> >>>>>----- Original Message -----
> >>>>>From: "krip pane" <jk...@yahoo.com>
> >>>>>To: "tomcat" <to...@jakarta.apache.org>
> >>>>>Sent: Wednesday, April 09, 2003 8:09 PM
> >>>>>Subject: URL Redirect
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hi,
> >>>>>>
> >>>>>>Can someone please help in redirecting url's
> >>
> >>with
> >>
> >>>>>>tomcat as standalone server.
> >>>>>>
> >>>>>>I would like to redirect all requests for
> >>>>>>http://www.abc.com/xyz/abc/index.jsp
> >>>>>>
> >>>>>>so that when a user types
> >>>>>>http://www.abc.com
> >>>>>>
> >>>>>>they'll be redirected to the first URL.
> >>>>>>
> >>>>>>TIA
> >>>>>>
> >>>>>>
> >>>>
> >>__________________________________________________
> >>
> >>>>>>Do you Yahoo!?
> >>>>>>Yahoo! Platinum - Watch CBS' NCAA March
> >>
> >>Madness,
> >>
> >>>>live on your
> >>>>desktop!
> >>>>
> >>>>>>http://platinum.yahoo.com
> >>>>>>
> >>>>>>
> >>>>
>
>>---------------------------------------------------------------------
> >>
> >>>>>>To unsubscribe, e-mail:
> >>>>
> >>>>tomcat-user-unsubscribe@jakarta.apache.org
> >>>>
> >>>>>>For additional commands, e-mail:
> >>>>
> >>>>tomcat-user-help@jakarta.apache.org
> >>>>
>
>>---------------------------------------------------------------------
> >>
> >>>>>To unsubscribe, e-mail:
> >>>>
> >>>>tomcat-user-unsubscribe@jakarta.apache.org
> >>>>
> >>>>>For additional commands, e-mail:
> >>>>
> >>>>tomcat-user-help@jakarta.apache.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>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
> >>
> 
=== message truncated ===


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org