Best way to consume http resource from EJB or Java EE webapp -
i have java ee 7 app jsf2, ejb3.1 , jpa etc. running in glassfish4 container.
at submission of facelet, want call external http resource (most using apache http client). response going text response, need parse , db stuff afterwards well.
my first idea call ejb, clint may spawn threads, not idea. have heard ways restrict httpclient in such way doesn't spawn threads e.g. use httpconnectionmanager, don't use timeouts etc. think loose performance.
what asynchronous ejb method can use / trigger httpclient ?
what best way achieve this?
what should manage connections ?
why not using jax-rs client in simple example:
client client = clientbuilder.newclient(); string content = client.target("http://www.google.de") .request(mediatype.text_html) .get(string.class);
more informations in java ee 7 tutorial.
Comments
Post a Comment