my dog learned polymorphism*
The moose likes Servlets and the fly likes post to a different system's servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "post to a different system Watch "post to a different system New topic
Author

post to a different system's servlet

Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
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.


Kishore
SCJP, blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Neither will allow you to access a foriegn servlet.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
then what is the method for invoking a foreign servlet from ur servlet.
Ajith Anand
Ranch Hand

Joined: Aug 30, 2004
Posts: 40
You may use a java.net.HttpURLConnection to do the Post....


LXI Technologies P Ltd
[url]www.lxisoft.com[/url]
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
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

Joined: Aug 30, 2004
Posts: 40
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

Joined: Jul 10, 2001
Posts: 1934
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

Joined: Aug 30, 2004
Posts: 40
Jakarta commons httpclient would be an option...if you are keen on timeouts..etc
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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.


42
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: post to a different system's servlet