-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Huntly,

Huntly Cameron wrote:
| I've run into a strange problem with redirecting from a servlet when
using a
| normal domain name (www.xyz.com)  Basically up until now I was just
testing
| my app using the http://locahost/<webAppName> URL.  The servlet redirect
| worked fine with with the page displaying fine. The URL would look
something
| like this:  http://localhost/<webAppName>/<aPage>.jsp
|
| When I try run the servlet from the proper URL it redirects me to
| www.xyz.com/<webAppName>/<aPage>.jsp but it comes up with a page not found
| error.  If I then remove the web app name from the URL, the page
works!  :-S

It looks like your xyz.com deployment is using the ROOT context instead
of 'webAppName' as the context path. Could that be the problem?

| To do the redirect I'm using the following:
| response.sendRedirect(response.encodeRedirectURL("<aPage>.jsp"));

It's always a good idea to use fully-qualified URLs when doing redirects
- -- at least, a redirect that starts with '/' if you are staying within
the same domain name. I would code this like this:

response.sendRedirect(response.encodeRedirectURL(request.getContextPath()
+ "/<aPage>.jsp"));

This will work even when you change the context path, which is nice.

Hope that helps a bit,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkihn2oACgkQ9CaO5/Lv0PA1CgCgmW/A1l1ImcW2Slpy0S0fb128
hL4AoIHlQoMoxj4vCKKk4+cWLWE25rp5
=vSNd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to