• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is this possible

 
slicker
Posts: 1108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm currently using a servlet that opens a URLConnection and does an inquiry/request to a new server. The calling servlet passes any info to the client.

What I'd rather to is have the client call servlet A, servlet A call/redirect/forward to servlet B (different server), which will process data & return results to a client.

Is this possible?
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
response.sendRedirect should do the job.
 
John Dunn
slicker
Posts: 1108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
doesn't sendRedirect just make the client make a second call? Is there a way I can do this without the client even knowing?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Dunn:
doesn't sendRedirect just make the client make a second call? Is there a way I can do this without the client even knowing?



No.
Even with sendRedirect, you could run into issues under SSL if you're using. Browsers (correctly) alert the user if a request is being made to a domain that is different from the one they originally established the secure connection with.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you redirect to a URL on this other server, then what the person looking at the browser will see in the address bar, after that happens, is that other URL. If you don't want them to see that URL, for whatever reason, then your options are limited.

You can't forward to a URL outside your application. So if you don't want to redirect, you're limited to the setup you have now, namely to do the URLConnection yourself. Bear in mind that if what the other server returns includes links (e.g. images), those links may be relative to the other server's URL and hence wouldn't work with your server's URL. You would have to fiddle with them to make them absolute links.
 
John Dunn
slicker
Posts: 1108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not using a browser, per se. Client app has a built in IE browser client. I basically get an xml inquiry, parse, do some lookups based on fields. If I determine the inquiry is of type "A" or "B", (instead of "C", "D", "E"), I update a few fields, add a few fields and resend the altered inquiry to another system and WAIT for a response. Response gets sent back unaltered to the client.

I'd like to get an inquiry, parse, do the lookups, and if I determine type "A" or "B", forward/redirect the altered inquiry to the other system and let that system return to the client. In my case the "other" system is on another host, behind the firewall but still another host.

=====================

Perhaps, what I need to do in this scenerio is to return the altered inquiry to the client and be done with it, letting them make the second call on their own.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Dunn:
I'm currently using a servlet that opens a URLConnection and does an inquiry/request to a new server. The calling servlet passes any info to the client.

What I'd rather to is have the client call servlet A, servlet A call/redirect/forward to servlet B (different server), which will process data & return results to a client.

Is this possible?






you have to activate servlet chaining.it is easy if u can use the java web server provided by java soft.
in that the manage tab
u are allowed to instantiate the servlet chaining.
the servlets will be seperated with commas
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlet chaining is an outdated feature that you won't find in modern containers. You can get similar results with requestDispatchers.

Still this doesn't help the user who is talking about resources in another server.
 
reply
    Bookmark Topic Watch Topic
  • New Topic