[Resteasy-users] RestEasy client in a multi-threaded invironment
Hi, I'm working with a RestEasy client (proxy) which should be accessible from several threads in parallel. From the reference guide [1] I learned that I need to configure a custom ApacheHttpClient4Engine instance so it uses a thread-safe HTTP client connection manager. This works as expected but there is a constructor of ApacheHttpClient4Engine which takes a HttpContext and made me curious. HttpContext is not intended for multi-threaded access (see comments on BasicHttpContext and SyncBasicHttpContext), but ApacheHttpClient4Engine does not perform any sort of synchronization. Is there any way of passing a new context instance per request issued by the engine? Thanks, --Gunnar [1] http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html_single/#transport_layer -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] RestEasy client in a multi-threaded invironment
What is the HttpContext used for anyways? Never used it. For multithreaded access, I've wrote and used the extension methods to ResteasyClientBuilder to configure connection pools and such. I honestly am trying to hide Apache HTTP Client with Resteasy (and in the future JAX-RS) apis. On 1/29/2014 12:14 PM, Gunnar Morling wrote: Hi, I'm working with a RestEasy client (proxy) which should be accessible from several threads in parallel. From the reference guide [1] I learned that I need to configure a custom ApacheHttpClient4Engine instance so it uses a thread-safe HTTP client connection manager. This works as expected but there is a constructor of ApacheHttpClient4Engine which takes a HttpContext and made me curious. HttpContext is not intended for multi-threaded access (see comments on BasicHttpContext and SyncBasicHttpContext), but ApacheHttpClient4Engine does not perform any sort of synchronization. Is there any way of passing a new context instance per request issued by the engine? Thanks, --Gunnar [1] http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html_single/#transport_layer -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] RestEasy client in a multi-threaded invironment
pre-emptive for what protocol? Digest? For basic auth, resteasy has a filter or utility methods you can use instead. On 1/29/2014 12:36 PM, Gunnar Morling wrote: I'm invoking an authenticated endpoint and am using HttpContext to pass in an AuthCache instance which is needed to enable pre-emptive authentication. Is there any alternative way for setting credentials and have them pre-emptively sent which doesn't require to touch HttpClient specifics? --Gunnar 2014/1/29 Bill Burke bbu...@redhat.com mailto:bbu...@redhat.com What is the HttpContext used for anyways? Never used it. For multithreaded access, I've wrote and used the extension methods to ResteasyClientBuilder to configure connection pools and such. I honestly am trying to hide Apache HTTP Client with Resteasy (and in the future JAX-RS) apis. On 1/29/2014 12:14 PM, Gunnar Morling wrote: Hi, I'm working with a RestEasy client (proxy) which should be accessible from several threads in parallel. From the reference guide [1] I learned that I need to configure a custom ApacheHttpClient4Engine instance so it uses a thread-safe HTTP client connection manager. This works as expected but there is a constructor of ApacheHttpClient4Engine which takes a HttpContext and made me curious. HttpContext is not intended for multi-threaded access (see comments on BasicHttpContext and SyncBasicHttpContext), but ApacheHttpClient4Engine does not perform any sort of synchronization. Is there any way of passing a new context instance per request issued by the engine? Thanks, --Gunnar [1] http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html_single/#transport_layer -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net mailto:Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net mailto:Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] RestEasy client in a multi-threaded invironment
Yeah, docs fell through the cracks on that: org.jboss.resteasy.util.BasicAuthHelper org.jboss.resteasy.client.jaxrs.BasicAuthentication You can use the filter if the same user is invoking in separate threads. Otherwise you'll have to generate the header per request. On 1/29/2014 1:17 PM, Gunnar Morling wrote: Basic Auth; Do you have a pointer to these filters/utilities? That sounds like what I need. Is there an example or test somewhere (couldn't find that in the ref guide)? Thanks, --Gunnar 2014/1/29 Bill Burke bbu...@redhat.com mailto:bbu...@redhat.com pre-emptive for what protocol? Digest? For basic auth, resteasy has a filter or utility methods you can use instead. On 1/29/2014 12:36 PM, Gunnar Morling wrote: I'm invoking an authenticated endpoint and am using HttpContext to pass in an AuthCache instance which is needed to enable pre-emptive authentication. Is there any alternative way for setting credentials and have them pre-emptively sent which doesn't require to touch HttpClient specifics? --Gunnar 2014/1/29 Bill Burke bbu...@redhat.com mailto:bbu...@redhat.com mailto:bbu...@redhat.com mailto:bbu...@redhat.com What is the HttpContext used for anyways? Never used it. For multithreaded access, I've wrote and used the extension methods to ResteasyClientBuilder to configure connection pools and such. I honestly am trying to hide Apache HTTP Client with Resteasy (and in the future JAX-RS) apis. On 1/29/2014 12:14 PM, Gunnar Morling wrote: Hi, I'm working with a RestEasy client (proxy) which should be accessible from several threads in parallel. From the reference guide [1] I learned that I need to configure a custom ApacheHttpClient4Engine instance so it uses a thread-safe HTTP client connection manager. This works as expected but there is a constructor of ApacheHttpClient4Engine which takes a HttpContext and made me curious. HttpContext is not intended for multi-threaded access (see comments on BasicHttpContext and SyncBasicHttpContext), but ApacheHttpClient4Engine does not perform any sort of synchronization. Is there any way of passing a new context instance per request issued by the engine? Thanks, --Gunnar [1] http://docs.jboss.org/__resteasy/docs/3.0.6.Final/__userguide/html_single/#__transport_layer http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html_single/#transport_layer --__--__-- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.__net/gampad/clk?id=123612991__iu=/4140/ostg.clktrk http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk _ Resteasy-users mailing list Resteasy-users@lists.__sourceforge.net mailto:Resteasy-users@lists.sourceforge.net mailto:Resteasy-users@lists.__sourceforge.net mailto:Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/__lists/listinfo/resteasy-users https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com --__--__-- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds.
Re: [Resteasy-users] jaxrs client proxies
JAX_RS does not merge annotations between interfaces and classes. Either the jaxrs annotations are on the interface, or they are on the class. On 1/29/2014 3:19 PM, Kristoffer Sjögren wrote: Hi Im trying to create a jaxrs client proxy from an interface that looks roughly like this. public interface SimpleService { @GET @Path(basic) @Produces(text/plain) String getBasic(); } There is a service side implementation which is registered using the Application.getSingletons(). @Path(/simple) public class SimpleJaxrs implements SimpleService { String getBasic() { ... } } The problem is that @Path method annotations on the interface is not inherited to the implementation so method endpoints are never registered. 1) I don't want to put a @Path annotation on the interface because that is the address to find an implementation. Its an interface so I want to have any number of implementations, right? 2) I do want to have @Path annotations on interface methods because its part of the interface contract. Having @Path annotations on the implementation is redundant because it already implements the interface. Does this make sense? Is it possible to do? Cheers, -Kristoffer -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com -- WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users