jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Forward to another app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Forward to another app" Watch "Forward to another app" New topic

Forward to another app

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I thought I saw this question recently, so I apologize if I'm on old ground. A partner system provided an API to us as an EAR & WAR that we deploy on our server. We need to POST to a servlet of theirs. Easy enough from a form in the browser, but I'd like to forward to it. Here's what I tried so far ...

In this case the "other" context and "myapp" context are the same object, and I get a 404. I also tried the full path to the servlet in the getContext.

What's the right way to do this?? Thanks!!

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63343

I've never tried to do this so grain-of-salt this response...

I think that including the context path in your foreign URL may be wrong. You don't include the context path in an in-context forward, so I would think that once you create a dispatcher for the other context that the context path would be superfluous.

Just guessing...

(I assume you've done the appropriate server setup for cross-context access).
[ January 10, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Yup, I left /otherapp off the getRequestDispatcher and it went fine. Thanks!

I agree. Here's the link: http://aspose.com/file-tools
subject: Forward to another app
It's not a secret anymore!