aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes http request through java code Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "http request through java code" Watch "http request through java code" New topic
Author

http request through java code

swapnel surade
Ranch Hand

Joined: Mar 05, 2009
Posts: 129
Hi,

I'm building an application in which I'm sending HTTP request through java code.



but when I'm listening in thread at given port I'm getting 2 request for single button click.

is there any problem in the code...

thanks
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8263

I don't see anything obviously wrong. Does this code get called twice?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4422
    
    2

While it is not hard to get a basic GET or POST to work using just the Java libraries, there is a lot more to doing it properly and completely.

Things like "chunked" responses must be supported, and my code was in production for several months before I even knew that it could happen.

I strongly recommend just using the Apache Http client library. Its easy to use, does all the edge cases properly, handles normal and SSL, etc.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: http request through java code
 
Similar Threads
Problem with HttpURLConnection
Generate HTTP PUT request
Client 2 Servlet
Communication between a Swing Client and a Servlet via HttpURLConnection
Set the header fields for a HttpUrlConnection