Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

post to a different system's servlet

 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am posting from a servlet on my domain to a different domain's Servlet; what is the method that needs to be used.

Is it response.redirect or forward that needs tobe used.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither will allow you to access a foriegn servlet.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then what is the method for invoking a foreign servlet from ur servlet.
 
Ajith Anand
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may use a java.net.HttpURLConnection to do the Post....
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ajith Anand:
You may use a java.net.HttpURLConnection to do the Post....


There should be other easier way to do this.

HppUrlConnection is not very reliable(it can lock ur threads and need extra programming to take care of releasing the threads) and is bi-directional, which is not necessary in cases.
 
Ajith Anand
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kishore Dandu:


There should be other easier way to do this.

HppUrlConnection is not very reliable(it can lock ur threads and need extra programming to take care of releasing the threads) and is bi-directional, which is not necessary in cases.



In what sense is not reliable ??? I dont understand about the threads that you are talking about...locking and releasing ???

I dont think there is another way to do a post from one servlet to another....
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ajith Anand:



In what sense is not reliable ??? I dont understand about the threads that you are talking about...locking and releasing ???

I dont think there is another way to do a post from one servlet to another....


What i mean is, there is no effective timeout mechanism when u are using Httpurlconnection. It will holdup ur process that is trying to use it(that is what I meant by thread).
 
Ajith Anand
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jakarta commons httpclient would be an option...if you are keen on timeouts..etc
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kishore Dandu:


What i mean is, there is no effective timeout mechanism when u are using Httpurlconnection. It will holdup ur process that is trying to use it(that is what I meant by thread).


that's not a problem in the HttpUrlConnection but rather in the way you use it.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeroen Wenting:


that's not a problem in the HttpUrlConnection but rather in the way you use it.


can u elaborate on this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic