Hi
I am writing a small J2EE-based Framework that allows in a very
simple way to retrieve results from a http-request.
public interface HttpRequests {
public String post(URL url);
public String post(URL url, Properties nameValuePairs);
public String get(URL url);
public String get(URL url, Properties nameValuePairs);
} /* simplyfied */
The implementation of the interface will be at hand to the
developer inside an Enterprise Java Bean. Of course it should
be very performant and I decided to use commons-httpclient.
I tried to figure out how I can use the
MultiThreadedHttpConnectionManager
but at the same time not violating the J2EE paradigmas inside
an EJB-implementation.
The example given in:
http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src
/examples/MultiThreadedExample.java?view=markup
is not very suitable, since the host is a (almost) fixed value. Or is
the
meaning that I will make a
httpClient.getHostConfiguration().setHost(...)
or even
httpClient.setHostConfiguration(...)
for every call to a function of the interface above or its
implementation respectively?
The other problem is that inside a stateless EJB it is not allowed to
define non-final but static fields since every instance of the EJB
(inside the
container) has access to the this field. This provokes race
conditions...
But because the implementation of
MultiThreadedHttpConnectionManager
seems to be thread safe one might make an exception here.
This poses the question if this static field should hold an instance of
MultiThreadedHttpConnectionManager
or possibly of
HttpClient
?
I hope I will not start a large discussion thread. Unfortunately
I am missing detailed documentation for this kind of J2EE-application.
Thanks for helping
Armin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]