aspose file tools
The moose likes Servlets and the fly likes filter, forward,ajax call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "filter, forward,ajax call" Watch "filter, forward,ajax call" New topic

filter, forward,ajax call

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 153
I have a request to my site, intercept it, and since I know there is nothing, I forward request to valid address

Then it arrives to the exact page that I want. On that page java script:

Now the prob is that ajax no longer calls to
but instead to
which does not exist there.

Any advice ?

I guess I have to change request, before I forward the whole thing ?

Searchable nature photo gallery:
Rob Spoor

Joined: Oct 27, 2005
Posts: 19905

Moving to Servlets.

How To Ask Questions How To Answer Questions
Markas Korotkovas

Joined: Jan 27, 2011
Posts: 21

In your second snippet you have "catchAjaxRequest.jsp" which is relative path, so when making the request the whole context is included (everything after the domain in your URL). In order to exclude the context add a / like this "/catchAjaxRequest.jsp". This will result in a URL like which is what you are looking for i think.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62123

The URL should start with the context path of the web application, which is not necessarily just /.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 153
Thank you both. That was helpful.
rocket mass heater kickstarter
subject: filter, forward,ajax call