My application frequently needs to do HTTP GET and POST to external
webservices. What I have been doing to date is:
                HttpURLConnection foo = (HttpURLConnection) 
url.openConnection();              
foo.setDoOutput(true);          foo.setRequestMethod("POST");               
foo.getOutputStream.write(.....)                InputStream response =
foo.getInputStream();          
but it appears that I'm really supposed to be obtaining the connection from
the container rather than rolling my own. 
 Does TomEE provide a built-in HttpURLConnection factory? 
 Is there an example of how to use it anywhere? 
 I have seen this:  HTTPConnectionFactory
<https://github.com/apache/tomee/blob/master/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java>
  
but it does not seem to return an object on which I can set the request
method, etc.   
 How badly out of spec is the way I'm doing it now? Will this break if I
know I'm never going to be in a multiple JVM or clustered environment?  (bad
assumption, I know.) 




--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Outbound-HTTP-best-practices-tp4676703.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to