• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

redirecting the request to URL

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to redirect the request to url in different application through https. Problem is I cannot use request.sendRedirect because contents of the original request, such as POST parameters, will be lost. Is there any alternative.
Thanks
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use the requestdispatcher.forward() method.
 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
requestdispatcher.forward() method only works when you are forwarding the request in same application. In my case I am trying to forward request to another application.
 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gaurav Jain:
use the requestdispatcher.forward() method.

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use URL rewriting
 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by danny liu:
Use URL rewriting


URL rewriting is for session management.
Use a HttpClient to make a new post request.
 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brahim,
Can you explain what is HTTPClient and how to use it.
Thanks
Shak
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shakti Sharma:
Hi Brahim,
Can you explain what is HTTPClient and how to use it.
Thanks
Shak



http://jakarta.apache.org/commons/httpclient/
You can also use an URLConnection object.
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
requestdispatcher.forward() can be used to call requests from a different application also. For that you need to have the servlet context of that aaplication. I do not have the exact code with me, but i know that it can be done. Would try to post the exact code when i get hold of it.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can write a java httpclient to forward the request to another servlet in a different JVM.

URL url = new URL("http://www.xyz.com/anotherservlet");
URLConnection urlConn = url.openConnection();
urlConn.setUseCaches(false);
ObjectInputStream in = new ObjectInputStream(urlConn.getInputStream());
in.close();

-Hemanth
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic