File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes redirect issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "redirect issues" Watch "redirect issues" New topic

redirect issues

shreehari nair

Joined: Mar 05, 2008
Posts: 1
I have created a redirect component

when the system finds a missing page, it will throw a 301 ( Moved Permanently ) and redirect to a page

I am implementing the redirect as shown below

but when i use the above code,

if you specify

and when you give

why is it so , am i missing something ? is there any better way to throw 301 and redirect ?

master's .. please help me
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Have you checked the HTTP headers in the response?

I am wondering if the first is being detected by the container as a directory request and is being automatically redirected to the welcome file, rather than running through your '301' code.

The correct behaviour when a resource is not available is to return 404. Doing otherwise may have unforeseen consequences.
I agree. Here's the link:
subject: redirect issues
It's not a secret anymore!