File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Forwarding to a dynamic URL within a servlet... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Forwarding to a dynamic URL within a servlet..." Watch "Forwarding to a dynamic URL within a servlet..." New topic
Author

Forwarding to a dynamic URL within a servlet...

Randal Cobb
Greenhorn

Joined: Jun 20, 2005
Posts: 1
Hello all,

I have a "different" sort of request... I have a client that wants to publish a given URL but redirect to some other URL based on something in the existing URL. For example, a user may type in: http://some.server.com/someValue/some.page. But, what the servlet does is, reads the URL coming in and replaces a certain portion for some other value. Using the above, the URL would become http://some.server.com/codebasea/some.page (basically, replacing the 'someValue' with 'codebasea').

I've tried forwarding, but, the server (WebSphere 5.1) keeps doing a Java core dump as soon as I try to forward... I have code like this:
request.setAttribute("someattribute", someValue);
String forwardPage = new String("/" + calcCodebase(<someValue> ); <-- this generates the new URL replacing the necessary values as needed
request.getRequestDispatcher(forwardPage).forward(request, response);

Any suggestions on how else this might be accomplished?

Thanks in advance!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61598
    
  67

Any suggestions on how else this might be accomplished?


Why would you want to find out another means to do it before finding out why this means doesn't work?

There are two essentail pieces of info you have left out of your report:

1) What is the URL to which you are forwarding?

2) What is the error dump?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Forwarding to a dynamic URL within a servlet...