Alan Campbell

Greenhorn
+ Follow
since Nov 26, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Alan Campbell

I managed to get it to work by creating a wrapper around the request object and modifying the values that way. I got the idea from another post in this forum.

I have posted the code below in case anyone else is looking to do something similar (sorry if its a bit of a long post).

This is my HTML page:-



This is my servlet code:-



And this is my wrapper code:-

16 years ago

Originally posted by Paul Clapham:
There's been a lot of conversation since you posted this but I'm surprised you haven't realized that the answer is:

YES.



There may have been a lot of conversation but no one actually said that I could or couldnt do it. I just wanted clarification.

Thank you both for your time and patience.

Alan
16 years ago

Originally posted by Bear Bibeault:
Will it always be true that they apps reside in the same instance? A forward, even a cross-context forward cannot span servers.



Yes, this will always be the case.

In any case, it's moot here because you need to generate a new request to satisfy the expected requirements of the web service.



So, does that mean that its not possible to create a new request object?
[ November 26, 2008: Message edited by: Alan Campbell ]
16 years ago

Originally posted by Bear Bibeault:
What's the relationship between the sender and receiver? If they're not in the same web application, a forward is out of the question.

If the receiving server is remote, you need to create a new request to it. How could it possibly have anything to do with the current request on a different server?



Really? I have to admit, I am new to working with servlets (been doing it 3 days now!), but the code that I posted above (the MBProxyTest servlet) calls the DisplayParameters servlet. Both of these servlets run on the same server and in the same instance of Tomcat, but in different contexts ( had to switch this on in Tomcat, by default it was disabled - crossContext=true). They are seperate web applications. It works in that MBProxyTest can successfully forward to DisplayParameters, which displays the parameters that were entered in the HTML form.
[ November 26, 2008: Message edited by: Alan Campbell ]
16 years ago
Thanks for replying.

I had thought about creating a new connection but thought that using forward (servlet to servlet) might be more efficient from a connectivity point of view (not having to go through the tcp/ip, http connectiong 'thing').

I am rapidly coming to the conclusion it is not possible to create a new request object 'on the fly' and that the only way would be to create a brand new connection. Is this a correct conclusion?

Alan
16 years ago
Hi,

I am trying to write a test web page with associated servlet (running in Tomcat) to send a test message to a third part servlet (also running in Tomcat).

The third party servlet expects a request in the following format:-



I have written a HTML page that will allow the tester to put in up to 5 parameters (name and value) put a XML message:-



When the form posts to the servlet, all of the parameters are specified in the body, which isnt what the third party servlet wants. So, I placed my own servlet in the path MBProxyTest which could take the request and rebuild it in the correct format and forward it to the third party servlet.



The problem is that I cant work out how to create a new request so that I can pass the correctly formated message to the third party servlet.

Any suggestions?

Alan
16 years ago