Yeah, I figured that out a bit later. The problem seems to be that Tomcat is just ignoring the call to /servlet/Whatever. The situation is like this, I'm trying to get as specific as possible now. The code looks like this: <form name=insertForm action=/servlet/CatalogServlet onSubmit="return validate()">
And if someone clicks on that button they get a 404 and Tomcat returns the error that it can't find /servlet/CatalogServlet. This exists without any <context> stuff setup in server.xml. The problem is that in the original call to the original servlet we have apache redirecting the request to http://our.server.com:8080/spike/servlet/OurServlet and when OurServlet calls OtherServlet via the code above it tries to locate it on http://our.server.com:8080/servlet/OtherServlet and that doesn't work. It has to have the /spike/ in there. So... Any idea how I can do that? One of the issues is that I can't change the code in the servlet itself (Otherwise fixing this would be trivial). Josh ----- Original Message ----- From: "Jacob Kjome" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Tuesday, May 07, 2002 12:01 PM Subject: Re[2]: Tomcat redirect > Hello joshua, > > Well, actually, all you've done here is specify a context called > "servlet" which has it's docbase sitting on the file system as > "/spike/servlet". This would assume that you are on a Unix system and > you have a directory called "spike" off the root of your sytem with a > directory called "servlet" inside that. > > In this case, the address to your webapp would be: > > http://myserver.com/servlet/ > > However, I would avoid calling your context "servlet" because I think > it will conflict with the default servlet mapping that Tomcat provides > for you. In fact I think you are confusing the /servlet/* mapping that Tomcat provides > for all webapps via its default web.xml with setting up a context. > > Let's assume that you place your new context in Tomcat's 'webapps" > directory and it is called "myservlets". You can either not bother > explicitly stating the <Context> for this webapp in the Server.xml and > let Tomcat create a default one for it, or you can go ahead and > specify it like this: > > <Context path="/myservlets" docBase="myservlets"> > > The path says that requests to http://myserver.com/myservlets refer to > a Tomcat-served Servlet context. > > The docBase says where the context's directory exists on the file > system. Here, we are saying that it exists in the current directory > (relative the webapps directory). You could also put this elsewhere > on your file system, but you must then provide a path relative to > webapps directory by saying something like "../../../../myservlets" > which says "myservlets" is located 4 directories back from wherever > the "webapps" directory exists or you can specify a hardcoded path > like "C:\myapps\myservlets" on windows or "/myapps/myservlets" on > Unix. > > Now with that set up, calling your servlet that redirects to another > servlet might go something like this: > > http://myserver.com/myservlets/servlet/MyRedirectServlet > > which might redirect to another servlet "MyRedirectResultServlet" > > You'd have to make sure that the redirection goes to > "/servlet/MyRedirectResultServlet" in order for Tomcat to catch this > request as a request to this other servlet. > > Did that answer the question or am I missing something? Bottom line, > rename your context to something other than "servlet" to avoid > confusion. > > Jake > > Tuesday, May 07, 2002, 10:08:41 AM, you wrote: > > jw> I was hoping of something within the Tomcat configuration itself since we > jw> don't use an index.jsp file. To be more specific about my problem, Whenever > jw> a servlet calls another servlet in Tomcat it isn't intercepting the > jw> /servlet/ directive and replacing it with /spike/servlet/ which is what it > jw> should be doing. Perhaps I'm overlooking something obvious in the > jw> configuration that will do this, but I've tried putting a > jw> <Host name="DEFAULT" > > jw> <Context path="/servlet" > jw> docBase="/spike/servlet" /> > jw> </Host> > > jw> Entry in the server.xml file, but that didn't seem to do it either... > jw> Someone smack me with a clue stick and tell me what I'm doing wrong? > > jw> Josh > jw> ----- Original Message ----- > jw> From: "Oki DZ" <[EMAIL PROTECTED]> > jw> To: "Tomcat Users List" <[EMAIL PROTECTED]> > jw> Sent: Monday, May 06, 2002 8:17 PM > jw> Subject: Re: Tomcat redirect > > > jw> On 05/07 04:19 joshua wentworth wrote: > >> I am trying to have Tomcat redirect certain requests to other applications > >> or other sites. But I can't find anything in the documentation or in any > jw> of > >> the messageboards about any kind of forward or redirect function in > jw> Tomcat. > >> Is there such a function, and if so where can I find documentation on it? > > jw> You can use the following in my index.jsp, so that the main page will be > jw> redirected to some other location: <% > jw> response.sendRedirect(response.encodeRedirectURL("<new URL>")); > %>> > > jw> Oki > > > > jw> -- > jw> To unsubscribe, e-mail: > jw> <mailto:[EMAIL PROTECTED]> > jw> For additional commands, e-mail: > jw> <mailto:[EMAIL PROTECTED]> > > > jw> -- > jw> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > jw> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- > Best regards, > Jacob mailto:[EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>