• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling URL in servlet

 
Kanchan Singh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I want to send few data to an URL and that URL return me some status flag.
My problem is I dont Know how to call that URL in a servlet and catch the returned information for further processing.

Any help highly appriciated.

Thanks

Kanchan
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I think from the servlet there is only one way requestdispacher to forward your request. and that

will not change the URL patterns.

 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kanchan Singh wrote:My problem is I dont Know how to call that URL in a servlet and catch the returned information for further processing.

If that's what you want do , i.e calling an URL from servlet and processing the response, here is the link with good example. The core and soul is java.net.URLConnection class
 
Kanchan Singh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks for your reply.
I dont want to pass the control to another URL I dont know how the implenation is there.
That URL is reurning me with boolean value.
I want to call that URL and get the boolean value it is returning.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kanchan Singh wrote:I dont want to pass the control to another URL I dont know how the implenation is there.

You're NOT passing any control if you're talking about the example I have given.
You're just hitting a URL with URLConnection class's object, after successful connection, you can open the Output stream, which contains the Boolean object/text.

Just try the example, and let us know what you get OR what went wrong for you ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!