users@glassfish.java.net

Re: Using an HTTP Client from within Java EE application

From: Noah White <emailnbw_at_gmail.com>
Date: Thu, 26 Sep 2013 22:32:30 -0700

I believe the OP wants to use the HTTPclient in a managed environment so no JNDI lookup is even required, simply inject it (EE7 full compliant container):
@Resource private ManagedExecutorService mes;
Then use it to fire off some runnables which use Jersery 2 Client APIs to make (and response process) the outbound HTTP connections you need to make. The threads running the HTTP connections will be container managed.
-Noah

> On Sep 26, 2013, at 5:54 PM, Martin Gainty <mgainty_at_hotmail.com> wrote:
>
> you can implement ManagedExecutorService to asynchronously listen to resources pre-configured for JNDI access e.g.
> ctx.lookup("java:comp/env/concurrent/ThreadPool");
>
> http://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/ManagedExecutorService.html
>
> -Martin
>
>
>
> Subject: Re: Using an HTTP Client from within Java EE application
> From: emailnbw_at_gmail.com
> Date: Thu, 26 Sep 2013 16:20:28 -0700
> CC: users_at_glassfish.java.net
> To: users_at_glassfish.java.net
>
> Use it to manage instances of using the Jersey 2 client API to make outgoing connections.
>
> -Noah
>
>
> On Sep 26, 2013, at 4:08 PM, Witold Szczerba <pljosh.mail_at_gmail.com> wrote:
>
> How is the Managed Concurrency API related to HTTP outgoing connection pool?
> Can you provide an example?
> Regards,
> Witold Szczerba
> ---
> Sent from my mobile phone.
> On Sep 27, 2013 12:01 AM, "Noah White" <emailnbw_at_gmail.com> wrote:
> Why not use the Jersey 2 client API with the new EE7 Managed Concurrency APIs?
>
> -Noah
>
> On Sep 26, 2013, at 2:55 PM, Witold Szczerba <pljosh.mail_at_gmail.com> wrote:
>
> This is exactly what I was looking for, today, and couldn't find an answer.
> I am looking forward for solution to this problem. How could the JEE spec group went over that?
> Regards,
> Witold Szczerba
> ---
> Sent from my mobile phone.
> On Sep 24, 2013 5:01 PM, "Jan Algermissen" <jan.algermissen_at_nordsc.com> wrote:
> Hi,
>
> sorry, I guess I am not the first one to ask this, but searching really does not turn up anything useful for me so far.
>
> In the application In develop, I need to make outgoing HTTP requests. Given I should neither manage HTTP connections nor associated threads myself in an EE container, I wonder
>
> - whether Glassfish maybe comes with the appropriate JCA connector to do this already?
>
> - what other's do (besides ignoring the spec and simply firing up an Apache HTTP client withit's own thread pool)?
>
>
> Jan