You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2010 |
Jan
(1) |
Feb
(2) |
Mar
(6) |
Apr
(5) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
(8) |
Sep
(4) |
Oct
(2) |
Nov
(6) |
Dec
(4) |
| 2011 |
Jan
(4) |
Feb
(18) |
Mar
(9) |
Apr
(7) |
May
(6) |
Jun
(13) |
Jul
(11) |
Aug
(7) |
Sep
(12) |
Oct
(28) |
Nov
(12) |
Dec
(11) |
| 2012 |
Jan
(20) |
Feb
(21) |
Mar
(19) |
Apr
(12) |
May
(44) |
Jun
(23) |
Jul
(14) |
Aug
(26) |
Sep
(23) |
Oct
(7) |
Nov
(42) |
Dec
(15) |
| 2013 |
Jan
(62) |
Feb
(20) |
Mar
(14) |
Apr
(52) |
May
(29) |
Jun
(46) |
Jul
(20) |
Aug
(55) |
Sep
(27) |
Oct
(53) |
Nov
(29) |
Dec
(21) |
| 2014 |
Jan
(35) |
Feb
(44) |
Mar
(12) |
Apr
(37) |
May
(24) |
Jun
(17) |
Jul
(13) |
Aug
(1) |
Sep
(4) |
Oct
(13) |
Nov
(1) |
Dec
(1) |
| 2015 |
Jan
(11) |
Feb
(8) |
Mar
(10) |
Apr
(7) |
May
(17) |
Jun
(11) |
Jul
(13) |
Aug
(14) |
Sep
(6) |
Oct
(3) |
Nov
(7) |
Dec
(3) |
| 2016 |
Jan
(1) |
Feb
(4) |
Mar
(8) |
Apr
(2) |
May
(2) |
Jun
(10) |
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
|
From: John D. A. <joh...@gm...> - 2013-10-21 14:41:20
|
Pleas try updating your maven dependency to JAX-RS 2.0 since you're using a JAX-RS 2.0 REST provider. On Mon, Oct 21, 2013 at 10:16 AM, andrew simpson <and...@gm...> wrote: > hi, I'm using RestEasy 3.0.4.Final, with JBoss AS7.1.0, and trying to build > an arquillian test following the approach described here: > > https://gist.github.com/w0mbat/6317015 > > The test runs, the rest service is called, a reasonable result returned but > the test fails because of the getMediaType exception below. > > > I get an exception when I try to return a POJO via a JSON object... but not > when I just check the response code. > > > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 17.185 sec > <<< FAILURE! > testGetWebDoc(com.ams10961.rest.WebDocServiceRESTTest) Time elapsed: 2.394 > sec <<< ERROR! > java.lang.NoSuchMethodError: > javax.ws.rs.core.Response.getMediaType()Ljavax/ws/rs/core/MediaType; > at > org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:128) > at > org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:425) > at > org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.get(ClientInvocationBuilder.java:165) > at > com.ams10961.rest.WebDocServiceRESTTest.testGetWebDoc(WebDocServiceRESTTest.java:73) > > Any ideas what this could be? > > Thanks... > > Andrew > > I've tried later versions of the JBoss BOM (up to 1.0.7.FinaL), and other > versions of RestEasy (3.0.0, 3.0.2) > > The Test > > @Test > @RunAsClient > public void testGetWebDoc(@ArquillianResource URL base) throws Exception > { > > javax.ws.rs.client.Client client = ClientBuilder.newClient(); > WebTarget restRoot = client.target(base.toURI() + "rest"); > WebTarget webDocRestRoot = restRoot.path("/webdoc"); > > WebDoc response = webDocRestRoot > .queryParam( > "url", > "http://news.bbc.co.uk") > .request(MediaType.APPLICATION_JSON).get(WebDoc.class); > > client.close(); > > assertNotNull(response); > } > > The Service > > @GET > @Produces(MediaType.APPLICATION_JSON) > public WebDoc fetch(@QueryParam("url") String url) { > > logger.info("url: >"+url+"<"); > > WebDoc webDoc = null; > try { > webDoc = webDocFetchService.fetchWebDoc(url); > > // persist the WebDoc > webDocService.save(webDoc); > > return webDoc; > > } catch (WebDocFetchException e) { > throw new WebApplicationException( > Response.Status.INTERNAL_SERVER_ERROR); > } catch (WebDocParseException e) { > throw new WebApplicationException( > Response.Status.INTERNAL_SERVER_ERROR); > } > > } > > > When I change the client to the following (i.e. just return a response)I get > no exception > > Response response = restRoot > .path("/webdoc") > .queryParam( > "url", > > "http://news.bbc.co.uk") > > .request(MediaType.APPLICATION_JSON) > .get(); > > > Some relevant highlights from the pom.xml file. > > <!-- Define the version of the JBoss BOMs we want to import. The > JBoss > BOMs specify tested stacks. --> > <version.org.jboss.bom>1.0.4. > Final</version.org.jboss.bom> > > > <dependencyManagement> > <dependencies> > <dependency> > <groupId>org.jboss.bom</groupId> > <artifactId>jboss-javaee-6.0-with-tools</artifactId> > <version>${version.org.jboss.bom}</version> > <type>pom</type> > <scope>import</scope> > </dependency> > <dependency> > <groupId>org.jboss.bom</groupId> > <artifactId>jboss-javaee-6.0-with-hibernate</artifactId> > <version>${version.org.jboss.bom}</version> > <type>pom</type> > <scope>import</scope> > </dependency> > </dependencies> > </dependencyManagement> > > > <dependency> > <groupId>org.jboss.spec.javax.ws.rs</groupId> > <artifactId>jboss-jaxrs-api_1.1_spec</artifactId> > <scope>provided</scope> > </dependency> > > > <dependency> > <groupId>org.jboss.resteasy</groupId> > <artifactId>resteasy-client</artifactId> > <version>3.0.4.Final</version> > </dependency> > > > java version "1.6.0_27" > OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.2) > OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mod > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > |
|
From: andrew s. <and...@gm...> - 2013-10-21 14:16:57
|
hi, I'm using RestEasy 3.0.4.Final, with JBoss AS7.1.0, and trying to build an arquillian test following the approach described here: https://gist.github.com/w0mbat/6317015 The test runs, the rest service is called, a reasonable result returned but the test fails because of the getMediaType exception below. I get an exception when I try to return a POJO via a JSON object... but not when I just check the response code. Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 17.185 sec <<< FAILURE! testGetWebDoc(com.ams10961.rest.WebDocServiceRESTTest) Time elapsed: 2.394 sec <<< ERROR! java.lang.NoSuchMethodError: javax.ws.rs.core.Response.getMediaType()Ljavax/ws/rs/core/MediaType; at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:128) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:425) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.get(ClientInvocationBuilder.java:165) at com.ams10961.rest.WebDocServiceRESTTest.testGetWebDoc(WebDocServiceRESTTest.java:73) Any ideas what this could be? Thanks... Andrew I've tried later versions of the JBoss BOM (up to 1.0.7.FinaL), and other versions of RestEasy (3.0.0, 3.0.2) The Test @Test @RunAsClient public void testGetWebDoc(@ArquillianResource URL base) throws Exception { javax.ws.rs.client.Client client = ClientBuilder.newClient(); WebTarget restRoot = client.target(base.toURI() + "rest"); WebTarget webDocRestRoot = restRoot.path("/webdoc"); WebDoc response = webDocRestRoot .queryParam( "url", "http://news.bbc.co.uk") .request(MediaType.APPLICATION_JSON).get(WebDoc.class); client.close(); assertNotNull(response); } The Service @GET @Produces(MediaType.APPLICATION_JSON) public WebDoc fetch(@QueryParam("url") String url) { logger.info("url: >"+url+"<"); WebDoc webDoc = null; try { webDoc = webDocFetchService.fetchWebDoc(url); // persist the WebDoc webDocService.save(webDoc); return webDoc; } catch (WebDocFetchException e) { throw new WebApplicationException( Response.Status.INTERNAL_SERVER_ERROR); } catch (WebDocParseException e) { throw new WebApplicationException( Response.Status.INTERNAL_SERVER_ERROR); } } When I change the client to the following (i.e. just return a response)I get no exception Response response = restRoot .path("/webdoc") .queryParam( "url", "http://news.bbc.co.uk") .request(MediaType.APPLICATION_JSON) .get(); Some relevant highlights from the pom.xml file. <!-- Define the version of the JBoss BOMs we want to import. The JBoss BOMs specify tested stacks. --> <version.org.jboss.bom>1.0.4. Final</version.org.jboss.bom> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.bom</groupId> <artifactId>jboss-javaee-6.0-with-tools</artifactId> <version>${version.org.jboss.bom}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.jboss.bom</groupId> <artifactId>jboss-javaee-6.0-with-hibernate</artifactId> <version>${version.org.jboss.bom}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependency> <groupId>org.jboss.spec.javax.ws.rs</groupId> <artifactId>jboss-jaxrs-api_1.1_spec</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-client</artifactId> <version>3.0.4.Final</version> </dependency> java version "1.6.0_27" OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.2) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mod |
|
From: Mark J. <MJe...@id...> - 2013-10-21 09:58:33
|
I am using WildFly 8.0.0.Beta (which includes RestEasy 3.0.4). I am getting an exception (below) for every POST request to JAX-RS web services. I've done some digging, and found out that the exception occurs if in web.xml, I set resteasy.document.expand.entity.references to false (the recommended value to protect against XXE attacks). The POSTs all work fine if I set that to true (but obviously the WS is then vulnerable).
This post is a follow on from my post on JBOSS 4.2.3 and Resteasy 3.0.4 compatibility.
The (shortened) exception log message is:
09:16:10,504 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-7) Failed executing POST /services/1.0/tasks/subset/summary: org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"taskFilterSequence"). Expected elements are <{http://workflow.services.ewb.idbs.com<http://workflow.services.ewb.idbs.com/>}activeWorkflows>, ...
In JAXBXmlTypeProvider, the code does this if ...expand.entity.references is false (this is around line 91)
if (suppressExpandEntityExpansion())
{
unmarshaller = new ExternalEntityUnmarshaller(unmarshaller);
}
The ExternalEntityUnmarshaller.unmarshal method appears to create an XMLReader that is not namespace aware, i.e. no call to SAXParserFactory.setNamespaceAware(true).
The default JAXB marshaller that is used when ...expand.entity.references is true, IS namespace aware.
So, it would seem that the ExternalEntityUnmarshaller may need to also setNamespaceAware(true)? Is there a reason why it is not namespace aware? I don't know of the implications of this, so just asking for now. I don't want to have to set that expand.entity.references to true because of the vulnerability consequences.
The exception is:
09:16:10,504 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-10) Failed executing POST /services/1.0/tasks/subset/summary: org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"taskFilterSequence"). Expected elements are <{http://workflow.services.ewb.idbs.com<http://workflow.services.ewb.idbs.com/>}activeWorkflows>, ...
at org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider.readFrom(JAXBXmlTypeProvider.java:109) [resteasy-jaxb-provider-3.0.4.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:59) [resteasy-jaxrs-3.0.4.Final.jar:]
at org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:62) [resteasy-jaxrs-3.0.4.Final.jar:]
<Snip>
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"taskFilterSequence"). Expected elements are <{http://workflow.services.ewb.idbs.com<http://workflow.services.ewb.idbs.com/>}activeWorkflows>, ...
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:662)
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:258)
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:253)
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:120)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1063)
<snip>
... 40 more
________________________________
The information contained in this email may contain confidential or legally privileged information. If you are not the intended recipient any disclosure, copying, distribution or taking any action on the contents of this information may be unlawful. If you have received this email in error, please delete it from your system and notify us immediately. Any views expressed in this message are those of the individual sender, except where the message states otherwise. IDBS takes no responsibility for any computer virus which might be transferred by way of this email and recommends that you subject any incoming E-mail to your own virus checking procedures. We may monitor all E-mail communication through our networks. If you contact us by E-mail, we may store your name and address to facilitate communication.
|
|
From: Bill B. <bb...@re...> - 2013-10-17 21:10:23
|
Unfortunately, you are responsible for cleaning up the connection
yourself. You must do:
try {
... do something with client ...
} catch (WebApplicationException ex) {
ex.getResponse().close();
}
This is because the response may contain an entity that the user wants
to access. I'm pretty sure we're not allowed to automatically close the
underlying Response object.
On 10/17/2013 10:01 AM, Anthony Whitford wrote:
> I discovered a particularly nasty problem using the Resteasy Client
> Framework and have documented it in the issue tracker:
> https://issues.jboss.org/browse/RESTEASY-963
>
> In a nutshell, if a Client Proxy instance makes a call to the service
> and the service throws an exception, the Client is now rendered
> inoperable because the underlying connection is not adequately reset.
>
> A sample project is included with the issue that demonstrates the
> problem. Note that there is a scenario (when a connection pool no
> longer has a valid connection available) where the call becomes FROZEN!
>
> If I had to guess on the solution, I would say that the invoke method
> of ClientInvoker needs to catch the exception and release the underlying
> connection in the event of an exception.
>
> https://github.com/resteasy/Resteasy/blob/master/jaxrs/resteasy-client/src/main/java/org/jboss/resteasy/client/jaxrs/internal/proxy/ClientInvoker.java#L104
>
> I think this is similar to the issue raised by John D. Ament on the
> 15th. (Resteasy should automatically clean up
> the connection, but this can not be limited to a GC event because we
> have no control over GC events.)
>
> I look forward to seeing this fixed as this is a serious stability risk.
> Thank you,
>
> Anthony
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Anthony W. <an...@wh...> - 2013-10-17 14:01:19
|
I discovered a particularly nasty problem using the Resteasy Client Framework and have documented it in the issue tracker: https://issues.jboss.org/browse/RESTEASY-963 In a nutshell, if a Client Proxy instance makes a call to the service and the service throws an exception, the Client is now rendered inoperable because the underlying connection is not adequately reset. A sample project is included with the issue that demonstrates the problem. Note that there is a scenario (when a connection pool no longer has a valid connection available) where the call becomes FROZEN! If I had to guess on the solution, I would say that the invoke method of ClientInvoker needs to catch the exception and release the underlying connection in the event of an exception. https://github.com/resteasy/Resteasy/blob/master/jaxrs/resteasy-client/src/main/java/org/jboss/resteasy/client/jaxrs/internal/proxy/ClientInvoker.java#L104 I think this is similar to the issue raised by John D. Ament on the 15th. (Resteasy should automatically clean up the connection, but this can not be limited to a GC event because we have no control over GC events.) I look forward to seeing this fixed as this is a serious stability risk. Thank you, Anthony |
|
From: Bill B. <bb...@re...> - 2013-10-16 12:12:58
|
You should be calling ClientResponse.releaseConnection() after you are done with the ClientResponse. Resteasy should automatically clean up the connection, but this only happens on a GC. In JAX-RS 2.0 you are also required to call Response.close(). On 10/15/2013 5:15 PM, John D. Ament wrote: > I've seen this error lots of times: > > Caused by: java.lang.IllegalStateException: Invalid use of > BasicClientConnManager: connection still allocated. > Make sure to release the connection before allocating another one. > at org.apache.http.impl.conn.BasicClientConnectionManager.getConnection(BasicClientConnectionManager.java:161) > at org.apache.http.impl.conn.BasicClientConnectionManager$1.getConnection(BasicClientConnectionManager.java:138) > at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:455) > at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) > at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) > at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.execute(ApacheHttpClient4Executor.java:182) > [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] > at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39) > [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] > at org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40) > [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] > at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45) > [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] > at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:443) > [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] > at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:677) > [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] > at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:111) > [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1] > > When trying to use the resteasy client. However, how do I reset > connection as is indicated in here when I'm using a proxy object? > > John > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: John D. A. <joh...@gm...> - 2013-10-15 21:16:04
|
I've seen this error lots of times:
Caused by: java.lang.IllegalStateException: Invalid use of
BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
at org.apache.http.impl.conn.BasicClientConnectionManager.getConnection(BasicClientConnectionManager.java:161)
at org.apache.http.impl.conn.BasicClientConnectionManager$1.getConnection(BasicClientConnectionManager.java:138)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:455)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.execute(ApacheHttpClient4Executor.java:182)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:443)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:677)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:111)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
When trying to use the resteasy client. However, how do I reset
connection as is indicated in here when I'm using a proxy object?
John
|
|
From: Nuwan B. <mai...@gm...> - 2013-10-15 16:41:00
|
Thanks for all the responses. Much appreciated. I executed the same code I've posted in the question from my home network (no firewall) and I was able to reach the server. However when I use the same code from the office networks I still get the 401 issue. This indicates that office firewall/network has some sort of restriction that does not allow me to call the 3rd party web service URL. Assuming this is the reason for the issue I'm working with the office network guys to solve it. Hope this will fix the issue. On Mon, Oct 14, 2013 at 4:47 PM, William Antônio Siqueira < wil...@gm...> wrote: > You should configure the proxy on the underlying Http Client > > > http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientProxyAuthentication.java > > > > -- > *William Antônio Siqueira* > *Java Support Analyst* > * > * > *http://fxapps.blogspot.com* > *http://www.williamantonio.wordpress.com* > *http://williamprogrammer.com* > > > 2013/10/14 Nuwan Bandara <mai...@gm...> > >> API does not required a authentication. >> >> I'm keep on getting >> >> "533 [main] INFO >> org.apache.commons.httpclient.auth.AuthChallengeProcessor - basic >> authentication scheme selected >> 535 [main] INFO org.apache.commons.httpclient.HttpMethodDirector - No >> credentials available for BASIC 'Quest Diagnostics (QDC) Internet '@ >> www.google.com:80" >> >> Is it because I'm behind a firewall and I'm not allowed to call out side >> (3rd party) web services? >> >> >> >> On Mon, Oct 14, 2013 at 12:13 PM, Bill Burke <bb...@re...> wrote: >> >>> Maybe because your REST service requires authentication? >>> >>> On 10/14/2013 2:54 PM, Nuwan Bandara wrote: >>> > Can someone help me on this? >>> > >>> > Thanks. >>> > >>> > >>> > On Fri, Oct 11, 2013 at 1:15 PM, Nuwan Bandara <mai...@gm... >>> > <mailto:mai...@gm...>> wrote: >>> > >>> > Hi, >>> > >>> > I use the following code to call a web service using POST and >>> always >>> > get "POST method always returns "Error status 401 Unauthorized"" >>> > >>> > Can someone help me to figure out what I do wrong in the bellow >>> code? >>> > >>> > Thanks in advance, >>> > Nuwan >>> > >>> > >>> > *FYI: webServiceUrl: >>> > >>> http://apitest.collabrx.com/oncovar/V1-0-7?client_id=XXX&command=submit_sample* >>> > >>> > public Document post(String webServiceUrl, String data) throws >>> > ExternalResourceConnectorException { >>> > logger.debug("Posting data to URL: " + webServiceUrl); >>> > SAXReader saxReader = new SAXReader(); >>> > Document document = null; >>> > StringBuffer responseMsg = new StringBuffer(); >>> > try { >>> > ClientRequest request = new >>> ClientRequest(webServiceUrl); >>> > request.accept("application/xml"); >>> > request.body(MediaType.APPLICATION_XML, data); // data >>> > to be identified. >>> > ClientResponse<String> response = >>> > request.post(String.class); >>> > //Object response = request.post().getEntity(new >>> > GenericType<Object>(){}); >>> > if (response.getStatus() != 200) { >>> > throw new RuntimeException("Failed : HTTP error >>> > code : " + response.getStatus()); >>> > } >>> > BufferedReader br = new BufferedReader(new >>> > InputStreamReader(new ByteArrayInputStream(response.getEntity() >>> > .getBytes()))); >>> > String output; >>> > while ((output = br.readLine()) != null) { >>> > responseMsg.append(output); >>> > } >>> > logger.info <http://logger.info>("External web service response: >>> "+ >>> > responseMsg.toString()); >>> > document = saxReader.read(new >>> > StringReader(responseMsg.toString())); >>> > } >>> > catch (ClientProtocolException e) { >>> > throw new ExternalResourceConnectorException(e); >>> > } >>> > catch (IOException e) { >>> > throw new ExternalResourceConnectorException(e); >>> > } >>> > catch (Exception e) { >>> > throw new ExternalResourceConnectorException(e); >>> > } >>> > return document; >>> > } >>> > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------------ >>> > October Webinars: Code for Performance >>> > Free Intel webinars can help you accelerate application performance. >>> > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the >>> most from >>> > the latest Intel processors and coprocessors. See abstracts and >>> register > >>> > >>> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk >>> > >>> > >>> > >>> > _______________________________________________ >>> > Resteasy-users mailing list >>> > Res...@li... >>> > https://lists.sourceforge.net/lists/listinfo/resteasy-users >>> > >>> >>> -- >>> Bill Burke >>> JBoss, a division of Red Hat >>> http://bill.burkecentral.com >>> >>> >>> ------------------------------------------------------------------------------ >>> October Webinars: Code for Performance >>> Free Intel webinars can help you accelerate application performance. >>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >>> from >>> the latest Intel processors and coprocessors. See abstracts and register >>> > >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> Resteasy-users mailing list >>> Res...@li... >>> https://lists.sourceforge.net/lists/listinfo/resteasy-users >>> >> >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >> from >> the latest Intel processors and coprocessors. See abstracts and register > >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk >> >> _______________________________________________ >> Resteasy-users mailing list >> Res...@li... >> https://lists.sourceforge.net/lists/listinfo/resteasy-users >> >> > |
|
From: William A. S. <wil...@gm...> - 2013-10-14 23:47:53
|
You should configure the proxy on the underlying Http Client http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientProxyAuthentication.java -- *William Antônio Siqueira* *Java Support Analyst* * * *http://fxapps.blogspot.com* *http://www.williamantonio.wordpress.com* *http://williamprogrammer.com* 2013/10/14 Nuwan Bandara <mai...@gm...> > API does not required a authentication. > > I'm keep on getting > > "533 [main] INFO org.apache.commons.httpclient.auth.AuthChallengeProcessor > - basic authentication scheme selected > 535 [main] INFO org.apache.commons.httpclient.HttpMethodDirector - No > credentials available for BASIC 'Quest Diagnostics (QDC) Internet '@ > www.google.com:80" > > Is it because I'm behind a firewall and I'm not allowed to call out side > (3rd party) web services? > > > > On Mon, Oct 14, 2013 at 12:13 PM, Bill Burke <bb...@re...> wrote: > >> Maybe because your REST service requires authentication? >> >> On 10/14/2013 2:54 PM, Nuwan Bandara wrote: >> > Can someone help me on this? >> > >> > Thanks. >> > >> > >> > On Fri, Oct 11, 2013 at 1:15 PM, Nuwan Bandara <mai...@gm... >> > <mailto:mai...@gm...>> wrote: >> > >> > Hi, >> > >> > I use the following code to call a web service using POST and always >> > get "POST method always returns "Error status 401 Unauthorized"" >> > >> > Can someone help me to figure out what I do wrong in the bellow >> code? >> > >> > Thanks in advance, >> > Nuwan >> > >> > >> > *FYI: webServiceUrl: >> > >> http://apitest.collabrx.com/oncovar/V1-0-7?client_id=XXX&command=submit_sample* >> > >> > public Document post(String webServiceUrl, String data) throws >> > ExternalResourceConnectorException { >> > logger.debug("Posting data to URL: " + webServiceUrl); >> > SAXReader saxReader = new SAXReader(); >> > Document document = null; >> > StringBuffer responseMsg = new StringBuffer(); >> > try { >> > ClientRequest request = new >> ClientRequest(webServiceUrl); >> > request.accept("application/xml"); >> > request.body(MediaType.APPLICATION_XML, data); // data >> > to be identified. >> > ClientResponse<String> response = >> > request.post(String.class); >> > //Object response = request.post().getEntity(new >> > GenericType<Object>(){}); >> > if (response.getStatus() != 200) { >> > throw new RuntimeException("Failed : HTTP error >> > code : " + response.getStatus()); >> > } >> > BufferedReader br = new BufferedReader(new >> > InputStreamReader(new ByteArrayInputStream(response.getEntity() >> > .getBytes()))); >> > String output; >> > while ((output = br.readLine()) != null) { >> > responseMsg.append(output); >> > } >> > logger.info <http://logger.info>("External web service response: "+ >> > responseMsg.toString()); >> > document = saxReader.read(new >> > StringReader(responseMsg.toString())); >> > } >> > catch (ClientProtocolException e) { >> > throw new ExternalResourceConnectorException(e); >> > } >> > catch (IOException e) { >> > throw new ExternalResourceConnectorException(e); >> > } >> > catch (Exception e) { >> > throw new ExternalResourceConnectorException(e); >> > } >> > return document; >> > } >> > >> > >> > >> > >> > >> ------------------------------------------------------------------------------ >> > October Webinars: Code for Performance >> > Free Intel webinars can help you accelerate application performance. >> > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the >> most from >> > the latest Intel processors and coprocessors. See abstracts and >> register > >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk >> > >> > >> > >> > _______________________________________________ >> > Resteasy-users mailing list >> > Res...@li... >> > https://lists.sourceforge.net/lists/listinfo/resteasy-users >> > >> >> -- >> Bill Burke >> JBoss, a division of Red Hat >> http://bill.burkecentral.com >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >> from >> the latest Intel processors and coprocessors. See abstracts and register > >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk >> _______________________________________________ >> Resteasy-users mailing list >> Res...@li... >> https://lists.sourceforge.net/lists/listinfo/resteasy-users >> > > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > > |
|
From: Nuwan B. <mai...@gm...> - 2013-10-14 21:49:15
|
API does not required a authentication. I'm keep on getting "533 [main] INFO org.apache.commons.httpclient.auth.AuthChallengeProcessor - basic authentication scheme selected 535 [main] INFO org.apache.commons.httpclient.HttpMethodDirector - No credentials available for BASIC 'Quest Diagnostics (QDC) Internet '@ www.google.com:80" Is it because I'm behind a firewall and I'm not allowed to call out side (3rd party) web services? On Mon, Oct 14, 2013 at 12:13 PM, Bill Burke <bb...@re...> wrote: > Maybe because your REST service requires authentication? > > On 10/14/2013 2:54 PM, Nuwan Bandara wrote: > > Can someone help me on this? > > > > Thanks. > > > > > > On Fri, Oct 11, 2013 at 1:15 PM, Nuwan Bandara <mai...@gm... > > <mailto:mai...@gm...>> wrote: > > > > Hi, > > > > I use the following code to call a web service using POST and always > > get "POST method always returns "Error status 401 Unauthorized"" > > > > Can someone help me to figure out what I do wrong in the bellow code? > > > > Thanks in advance, > > Nuwan > > > > > > *FYI: webServiceUrl: > > > http://apitest.collabrx.com/oncovar/V1-0-7?client_id=XXX&command=submit_sample* > > > > public Document post(String webServiceUrl, String data) throws > > ExternalResourceConnectorException { > > logger.debug("Posting data to URL: " + webServiceUrl); > > SAXReader saxReader = new SAXReader(); > > Document document = null; > > StringBuffer responseMsg = new StringBuffer(); > > try { > > ClientRequest request = new > ClientRequest(webServiceUrl); > > request.accept("application/xml"); > > request.body(MediaType.APPLICATION_XML, data); // data > > to be identified. > > ClientResponse<String> response = > > request.post(String.class); > > //Object response = request.post().getEntity(new > > GenericType<Object>(){}); > > if (response.getStatus() != 200) { > > throw new RuntimeException("Failed : HTTP error > > code : " + response.getStatus()); > > } > > BufferedReader br = new BufferedReader(new > > InputStreamReader(new ByteArrayInputStream(response.getEntity() > > .getBytes()))); > > String output; > > while ((output = br.readLine()) != null) { > > responseMsg.append(output); > > } > > logger.info <http://logger.info>("External web service response: "+ > > responseMsg.toString()); > > document = saxReader.read(new > > StringReader(responseMsg.toString())); > > } > > catch (ClientProtocolException e) { > > throw new ExternalResourceConnectorException(e); > > } > > catch (IOException e) { > > throw new ExternalResourceConnectorException(e); > > } > > catch (Exception e) { > > throw new ExternalResourceConnectorException(e); > > } > > return document; > > } > > > > > > > > > > > ------------------------------------------------------------------------------ > > October Webinars: Code for Performance > > Free Intel webinars can help you accelerate application performance. > > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > > the latest Intel processors and coprocessors. See abstracts and register > > > > > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk > > > > > > > > _______________________________________________ > > Resteasy-users mailing list > > Res...@li... > > https://lists.sourceforge.net/lists/listinfo/resteasy-users > > > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > |
|
From: Bill B. <bb...@re...> - 2013-10-14 19:13:51
|
Maybe because your REST service requires authentication? On 10/14/2013 2:54 PM, Nuwan Bandara wrote: > Can someone help me on this? > > Thanks. > > > On Fri, Oct 11, 2013 at 1:15 PM, Nuwan Bandara <mai...@gm... > <mailto:mai...@gm...>> wrote: > > Hi, > > I use the following code to call a web service using POST and always > get "POST method always returns "Error status 401 Unauthorized"" > > Can someone help me to figure out what I do wrong in the bellow code? > > Thanks in advance, > Nuwan > > > *FYI: webServiceUrl: > http://apitest.collabrx.com/oncovar/V1-0-7?client_id=XXX&command=submit_sample* > > public Document post(String webServiceUrl, String data) throws > ExternalResourceConnectorException { > logger.debug("Posting data to URL: " + webServiceUrl); > SAXReader saxReader = new SAXReader(); > Document document = null; > StringBuffer responseMsg = new StringBuffer(); > try { > ClientRequest request = new ClientRequest(webServiceUrl); > request.accept("application/xml"); > request.body(MediaType.APPLICATION_XML, data); // data > to be identified. > ClientResponse<String> response = > request.post(String.class); > //Object response = request.post().getEntity(new > GenericType<Object>(){}); > if (response.getStatus() != 200) { > throw new RuntimeException("Failed : HTTP error > code : " + response.getStatus()); > } > BufferedReader br = new BufferedReader(new > InputStreamReader(new ByteArrayInputStream(response.getEntity() > .getBytes()))); > String output; > while ((output = br.readLine()) != null) { > responseMsg.append(output); > } > logger.info <http://logger.info>("External web service response: "+ > responseMsg.toString()); > document = saxReader.read(new > StringReader(responseMsg.toString())); > } > catch (ClientProtocolException e) { > throw new ExternalResourceConnectorException(e); > } > catch (IOException e) { > throw new ExternalResourceConnectorException(e); > } > catch (Exception e) { > throw new ExternalResourceConnectorException(e); > } > return document; > } > > > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk > > > > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Nuwan B. <mai...@gm...> - 2013-10-14 18:54:33
|
Can someone help me on this? Thanks. On Fri, Oct 11, 2013 at 1:15 PM, Nuwan Bandara <mai...@gm...> wrote: > Hi, > > I use the following code to call a web service using POST and always get > "POST method always returns "Error status 401 Unauthorized"" > > Can someone help me to figure out what I do wrong in the bellow code? > > Thanks in advance, > Nuwan > > > *FYI: webServiceUrl: > http://apitest.collabrx.com/oncovar/V1-0-7?client_id=XXX&command=submit_sample > * > > public Document post(String webServiceUrl, String data) throws > ExternalResourceConnectorException { > logger.debug("Posting data to URL: " + webServiceUrl); > SAXReader saxReader = new SAXReader(); > Document document = null; > StringBuffer responseMsg = new StringBuffer(); > try { > ClientRequest request = new ClientRequest(webServiceUrl); > request.accept("application/xml"); > request.body(MediaType.APPLICATION_XML, data); // data to be > identified. > ClientResponse<String> response = request.post(String.class); > //Object response = request.post().getEntity(new > GenericType<Object>(){}); > if (response.getStatus() != 200) { > throw new RuntimeException("Failed : HTTP error code : " + > response.getStatus()); > } > BufferedReader br = new BufferedReader(new > InputStreamReader(new ByteArrayInputStream(response.getEntity() > .getBytes()))); > String output; > while ((output = br.readLine()) != null) { > responseMsg.append(output); > } > logger.info("External web service response: "+ > responseMsg.toString()); > document = saxReader.read(new > StringReader(responseMsg.toString())); > } > catch (ClientProtocolException e) { > throw new ExternalResourceConnectorException(e); > } > catch (IOException e) { > throw new ExternalResourceConnectorException(e); > } > catch (Exception e) { > throw new ExternalResourceConnectorException(e); > } > return document; > } > |
|
From: Danilo R. <dan...@gm...> - 2013-10-14 01:05:32
|
I would like to hear from others how do you model your transactions when dealing to a simple one-to-many relationship transaction, as the classic Sale and SaleItems case. I've already seen one sending all data at once and others requesting first the parent, retriving the created resource and then sending the childs (but not in transaction). How do you deal with this use case? -- D. Reinert |
|
From: Nuwan B. <mai...@gm...> - 2013-10-11 20:16:04
|
Hi, I use the following code to call a web service using POST and always get "POST method always returns "Error status 401 Unauthorized"" Can someone help me to figure out what I do wrong in the bellow code? Thanks in advance, Nuwan *FYI: webServiceUrl: http://apitest.collabrx.com/oncovar/V1-0-7?client_id=XXX&command=submit_sample * public Document post(String webServiceUrl, String data) throws ExternalResourceConnectorException { logger.debug("Posting data to URL: " + webServiceUrl); SAXReader saxReader = new SAXReader(); Document document = null; StringBuffer responseMsg = new StringBuffer(); try { ClientRequest request = new ClientRequest(webServiceUrl); request.accept("application/xml"); request.body(MediaType.APPLICATION_XML, data); // data to be identified. ClientResponse<String> response = request.post(String.class); //Object response = request.post().getEntity(new GenericType<Object>(){}); if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(response.getEntity() .getBytes()))); String output; while ((output = br.readLine()) != null) { responseMsg.append(output); } logger.info("External web service response: "+ responseMsg.toString()); document = saxReader.read(new StringReader(responseMsg.toString())); } catch (ClientProtocolException e) { throw new ExternalResourceConnectorException(e); } catch (IOException e) { throw new ExternalResourceConnectorException(e); } catch (Exception e) { throw new ExternalResourceConnectorException(e); } return document; } |
|
From: Ian A. <ins...@gm...> - 2013-10-11 14:01:39
|
I ended up posting this on stackover flow for advice, and I got back a really complete answer: http://stackoverflow.com/questions/19229341/changing-default-json-time-format-with-resteasy-3-x . The only issue is that I think there is a bug in RESTEasy 3.x that prevents this from working, seeing that it works perfectly in RESTEasy 2.3.5. I filed a bug with JBoss to track this issue. On Mon, Oct 7, 2013 at 8:59 PM, 刘日新 <liu...@li...> wrote: > Why not add an extra field which hold value of timezone?**** > > ** ** > > *发件人:* Ian Anderson [mailto:ins...@gm...] > *发送时间:* 2013年10月8日 2:42 > *收件人:* res...@li... > *主题:* [Resteasy-users] Changing Default JSON Time Format with RESTEasy 3.x > **** > > ** ** > > I am using RESTEasy to implement a REST Service using JSON serialization. > Currently, Dates are getting serialized to milliseconds since 1970. To > improve compatibility, I would like to get my dates into one of two > formats; milliseconds + timezone offset or ISO 8061.**** > > It seems that RESTEasy used to use Jettison for JSON serialization, but > from what I've been reading they've switch to Jackson ... all of this has > made googling for help pretty hit or miss.**** > > From what I can tell, I need to implement a ContextResolver<ObjectMapper> > along the lines of:**** > > public class JacksonConfig impelments ContextResolver<ObjectMapper> > { > private final OBjectMapper objectMapper;**** > > public JacksonConfig() throws Exception > { > objectMapper = new ObjectMapper.configure( > > SerializationFeature.WRITE_DATE_AS_TIMESTAMPS, false); > }**** > > @Override > public ObjectMapper getContext(Class<?> arg0) > { > return objectMapper; > } > }**** > > The thing I haven't been able to find, is what do I do with this? Where > do I put it?**** > > So the larger questions are, am I heading in the right direction and are > my assumptions correct? > **** > > Thanks!**** > > > -- > Ian**** > -- Ian T. W. Anderson |
|
From: Bill B. <bb...@re...> - 2013-10-11 12:34:52
|
Might be an Apache issue. Maybe try the timeout without Resteasy and
just an Apache call?
On 10/11/2013 6:37 AM, Borut Bolčina wrote:
> Hello,
>
> what is wrong with the code below? When using RestEasy Proxy Framework
> it seems the client is not using the configuration for connection timeouts.
>
> At line 54 there is a test url which returns response after 7 seconds,
> but the call is not aborted as one might expect.
>
> package si.najdi.httpclient;
>
> import javax.ws.rs.ProcessingException;
> import javax.ws.rs.core.Response;
>
> import org.apache.http.client.config.RequestConfig;
> import org.apache.http.config.SocketConfig;
> import org.apache.http.impl.client.CloseableHttpClient;
> import org.apache.http.impl.client.HttpClients;
> import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
> import org.jboss.resteasy.client.jaxrs.ResteasyClient;
> import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
> import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
> import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> public class Main {
>
> static Logger logger = LoggerFactory.getLogger(Main.class);
> public static void main(String[] args) {
> logger.info <http://logger.info>("Starting HttpClient test.");
> SocketConfig socketConfig = SocketConfig.custom()
> .setTcpNoDelay(true)
> .setSoKeepAlive(true)
> .setSoReuseAddress(true)
> .build();
> PoolingHttpClientConnectionManager connManager = new
> PoolingHttpClientConnectionManager();
> connManager.setMaxTotal(100);
> connManager.setDefaultMaxPerRoute(100);
> connManager.setDefaultSocketConfig(socketConfig);
> RequestConfig defaultRequestConfig = RequestConfig.custom()
> .setSocketTimeout(2000)
> .setConnectTimeout(100)
> .setConnectionRequestTimeout(3000)
> .setStaleConnectionCheckEnabled(true)
> .build();
> CloseableHttpClient httpClient = HttpClients.custom()
> .setDefaultRequestConfig(defaultRequestConfig)
> .setConnectionManager(connManager)
> .build();
> ApacheHttpClient4Engine apacheHttpClient4Engine = new
> ApacheHttpClient4Engine(httpClient);
> ResteasyClient client = new
> ResteasyClientBuilder().httpEngine(apacheHttpClient4Engine).build();
> //String host = "http://httpstat.us/400";
> String host = "http://fake-response.appspot.com/?sleep=7";
> ResteasyWebTarget newsWebTarget = client.target(host);
> NewsClient newsClient = newsWebTarget.proxy(NewsClient.class);
> boolean ok = false;
>
> Response response = null;
> try {
> logger.info <http://logger.info>("Calling...");
> response = newsClient.clickIncrement("666");
> logger.info <http://logger.info>("...returning");
>
> if (response.getStatus() == Response.Status.OK.getStatusCode()) {
> String line = (String) response.readEntity(String.class);
> logger.info <http://logger.info>("Response line: " + line);
> } else {
> String failMessage = response.getStatusInfo().getStatusCode() + " " +
> response.getStatusInfo().getReasonPhrase();
> logger.warn("Failed call. Reason: " + failMessage);
> }
> } catch (ProcessingException e) {
> logger.warn("Exception incrementing click counter." + e);
> } finally {
> if (response != null) {
> response.close();
> }
> }
> }
> }
>
>
> Here is the client interface if it matters:
>
> import javax.ws.rs.DefaultValue;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.PathParam;
> import javax.ws.rs.core.Response;
>
> public interface NewsClient {
>
> @GET
> //@Path("clickcounter/news/{newsId}")
> Response clickIncrement(@PathParam("newsId") @DefaultValue("123")
> String newsId);
> }
>
>
> The log output:
> [12:05:46] INFO [si.najdi.httpclient.Main]: Starting HttpClient test.
> [12:05:47] DEBUG
> [org.jboss.resteasy.plugins.providers.DocumentProvider]: Unable to
> retrieve config: expandEntityReferences defaults to true
> [12:05:47] DEBUG
> [org.jboss.resteasy.plugins.providers.DocumentProvider]: Unable to
> retrieve config: expandEntityReferences defaults to true
> [12:05:47] INFO [si.najdi.httpclient.Main]: Calling...
> [12:05:54] INFO [si.najdi.httpclient.Main]: ...returning
> [12:05:54] INFO [si.najdi.httpclient.Main]: Response line:
> {"response":"This request has finsihed sleeping for 7 seconds"}
>
>
> Best regards,
> borut
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Borut B. <bor...@gm...> - 2013-10-11 10:38:20
|
Hello,
what is wrong with the code below? When using RestEasy Proxy Framework it
seems the client is not using the configuration for connection timeouts.
At line 54 there is a test url which returns response after 7 seconds, but
the call is not aborted as one might expect.
package si.najdi.httpclient;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.core.Response;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.config.SocketConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
static Logger logger = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) {
logger.info("Starting HttpClient test.");
SocketConfig socketConfig = SocketConfig.custom()
.setTcpNoDelay(true)
.setSoKeepAlive(true)
.setSoReuseAddress(true)
.build();
PoolingHttpClientConnectionManager connManager = new
PoolingHttpClientConnectionManager();
connManager.setMaxTotal(100);
connManager.setDefaultMaxPerRoute(100);
connManager.setDefaultSocketConfig(socketConfig);
RequestConfig defaultRequestConfig = RequestConfig.custom()
.setSocketTimeout(2000)
.setConnectTimeout(100)
.setConnectionRequestTimeout(3000)
.setStaleConnectionCheckEnabled(true)
.build();
CloseableHttpClient httpClient = HttpClients.custom()
.setDefaultRequestConfig(defaultRequestConfig)
.setConnectionManager(connManager)
.build();
ApacheHttpClient4Engine apacheHttpClient4Engine = new
ApacheHttpClient4Engine(httpClient);
ResteasyClient client = new
ResteasyClientBuilder().httpEngine(apacheHttpClient4Engine).build();
//String host = "http://httpstat.us/400";
String host = "http://fake-response.appspot.com/?sleep=7";
ResteasyWebTarget newsWebTarget = client.target(host);
NewsClient newsClient = newsWebTarget.proxy(NewsClient.class);
boolean ok = false;
Response response = null;
try {
logger.info("Calling...");
response = newsClient.clickIncrement("666");
logger.info("...returning");
if (response.getStatus() == Response.Status.OK.getStatusCode()) {
String line = (String) response.readEntity(String.class);
logger.info("Response line: " + line);
} else {
String failMessage = response.getStatusInfo().getStatusCode() + " " +
response.getStatusInfo().getReasonPhrase();
logger.warn("Failed call. Reason: " + failMessage);
}
} catch (ProcessingException e) {
logger.warn("Exception incrementing click counter." + e);
} finally {
if (response != null) {
response.close();
}
}
}
}
Here is the client interface if it matters:
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
public interface NewsClient {
@GET
//@Path("clickcounter/news/{newsId}")
Response clickIncrement(@PathParam("newsId") @DefaultValue("123")
String newsId);
}
The log output:
[12:05:46] INFO [si.najdi.httpclient.Main]: Starting HttpClient test.
[12:05:47] DEBUG [org.jboss.resteasy.plugins.providers.DocumentProvider]:
Unable to retrieve config: expandEntityReferences defaults to true
[12:05:47] DEBUG [org.jboss.resteasy.plugins.providers.DocumentProvider]:
Unable to retrieve config: expandEntityReferences defaults to true
[12:05:47] INFO [si.najdi.httpclient.Main]: Calling...
[12:05:54] INFO [si.najdi.httpclient.Main]: ...returning
[12:05:54] INFO [si.najdi.httpclient.Main]: Response line:
{"response":"This request has finsihed sleeping for 7 seconds"}
Best regards,
borut
|
|
From: Daniel K. <dan...@co...> - 2013-10-10 02:31:20
|
I just tried to throw an WebApplicationException using RESTEasy 3.0.3 and my ApplicationExceptionMapper was called, and I could see the it was wrapping my WebApplicationException. This was not what happened when one threw a WebApplicationException in RESTEasy 2.x as far as I can recall, so I'm wondering if this is the new way this works (which I hope it isn't), or whether there is something I need to do now that I didn't before so that the response is sent back without being intecepted by my ApplicationExceptionMapper. Thanks in advance, Dan --- Daniel Kirkdorffer <mailto:dan...@co...> dan...@co... |
|
From: 刘日新 <liu...@li...> - 2013-10-08 02:30:25
|
Why not add an extra field which hold value of timezone?
发件人: Ian Anderson [mailto:ins...@gm...]
发送时间: 2013年10月8日 2:42
收件人: res...@li...
主题: [Resteasy-users] Changing Default JSON Time Format with RESTEasy 3.x
I am using RESTEasy to implement a REST Service using JSON serialization.
Currently, Dates are getting serialized to milliseconds since 1970. To
improve compatibility, I would like to get my dates into one of two formats;
milliseconds + timezone offset or ISO 8061.
It seems that RESTEasy used to use Jettison for JSON serialization, but from
what I've been reading they've switch to Jackson ... all of this has made
googling for help pretty hit or miss.
>From what I can tell, I need to implement a ContextResolver<ObjectMapper>
along the lines of:
public class JacksonConfig impelments ContextResolver<ObjectMapper>
{
private final OBjectMapper objectMapper;
public JacksonConfig() throws Exception
{
objectMapper = new ObjectMapper.configure(
SerializationFeature.WRITE_DATE_AS_TIMESTAMPS, false);
}
@Override
public ObjectMapper getContext(Class<?> arg0)
{
return objectMapper;
}
}
The thing I haven't been able to find, is what do I do with this? Where do
I put it?
So the larger questions are, am I heading in the right direction and are my
assumptions correct?
Thanks!
--
Ian
|
|
From: Ian A. <ins...@gm...> - 2013-10-07 18:42:21
|
I am using RESTEasy to implement a REST Service using JSON serialization.
Currently, Dates are getting serialized to milliseconds since 1970. To
improve compatibility, I would like to get my dates into one of two
formats; milliseconds + timezone offset or ISO 8061.
It seems that RESTEasy used to use Jettison for JSON serialization, but
from what I've been reading they've switch to Jackson ... all of this has
made googling for help pretty hit or miss.
>From what I can tell, I need to implement a ContextResolver<ObjectMapper>
along the lines of:
public class JacksonConfig impelments ContextResolver<ObjectMapper>
{
private final OBjectMapper objectMapper;
public JacksonConfig() throws Exception
{
objectMapper = new ObjectMapper.configure(
SerializationFeature.WRITE_DATE_AS_TIMESTAMPS, false);
}
@Override
public ObjectMapper getContext(Class<?> arg0)
{
return objectMapper;
}
}
The thing I haven't been able to find, is what do I do with this? Where do
I put it?
So the larger questions are, am I heading in the right direction and are my
assumptions correct?
Thanks!
--
Ian
|
|
From: Mark J. <MJe...@id...> - 2013-10-02 20:28:16
|
OK so this seems to be my problem http://mail-archives.apache.org/mod_mbox/cxf-users/201001.mbox/%3C2...@ap...%3E the validation rules have been tightened in the JAXB version (2.2.7) supplied in the 3.0.4 release Any suggestions on the best way of 1) Loosening them using their suggested property "set-jaxb-validation-event-handler" 2) Sorting the original validation problem. Thanks Mark ________________________________ The information contained in this email may contain confidential or legally privileged information. If you are not the intended recipient any disclosure, copying, distribution or taking any action on the contents of this information may be unlawful. If you have received this email in error, please delete it from your system and notify us immediately. Any views expressed in this message are those of the individual sender, except where the message states otherwise. IDBS takes no responsibility for any computer virus which might be transferred by way of this email and recommends that you subject any incoming E-mail to your own virus checking procedures. We may monitor all E-mail communication through our networks. If you contact us by E-mail, we may store your name and address to facilitate communication. |
|
From: Bill B. <bb...@re...> - 2013-10-01 15:47:34
|
Its probably some setting in Jackson you'll have to set. Not sure.
You'll have to track it down in the Jackson documentation. Resteasy is
only a very very very very thin wrapper around Jackson.
On 10/1/2013 11:21 AM, Mark Jenkins wrote:
> Hi,
>
> We have a lazy loaded list in a JAXB (XJC created) DTO such that the
> list only gets created when the ‘get’ method is called.
>
> If nothing is added to the list then the member variable will be /null/.
>
> With the 2.3.2 jackson-provider, /null/ lists were returned as an empty
> array /[]/. With the 3.0.3 jackson-provider null lists are returned as
> /null/.
>
> As an example using the following as source
>
> <assignedUsers/>
>
> Converted in 2.3.2
>
> "assignedUsers": {
>
> "user": []
>
> },
>
> Converted in 3.0.3
>
> "assignedUsers": {
>
> "user": null
>
> },
>
> If possible we would like to maintain the old interface behaviour. Any
> ideas?
>
> Thanks Mark
>
>
> ------------------------------------------------------------------------
>
> The information contained in this email may contain confidential or
> legally privileged information. If you are not the intended recipient
> any disclosure, copying, distribution or taking any action on the
> contents of this information may be unlawful. If you have received this
> email in error, please delete it from your system and notify us
> immediately. Any views expressed in this message are those of the
> individual sender, except where the message states otherwise. IDBS takes
> no responsibility for any computer virus which might be transferred by
> way of this email and recommends that you subject any incoming E-mail to
> your own virus checking procedures. We may monitor all E-mail
> communication through our networks. If you contact us by E-mail, we may
> store your name and address to facilitate communication.
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Mark J. <MJe...@id...> - 2013-10-01 15:21:37
|
Hi,
We have a lazy loaded list in a JAXB (XJC created) DTO such that the list only gets created when the 'get' method is called.
If nothing is added to the list then the member variable will be null.
With the 2.3.2 jackson-provider, null lists were returned as an empty array []. With the 3.0.3 jackson-provider null lists are returned as null.
As an example using the following as source
<assignedUsers/>
Converted in 2.3.2
"assignedUsers": {
"user": []
},
Converted in 3.0.3
"assignedUsers": {
"user": null
},
If possible we would like to maintain the old interface behaviour. Any ideas?
Thanks Mark
________________________________
The information contained in this email may contain confidential or legally privileged information. If you are not the intended recipient any disclosure, copying, distribution or taking any action on the contents of this information may be unlawful. If you have received this email in error, please delete it from your system and notify us immediately. Any views expressed in this message are those of the individual sender, except where the message states otherwise. IDBS takes no responsibility for any computer virus which might be transferred by way of this email and recommends that you subject any incoming E-mail to your own virus checking procedures. We may monitor all E-mail communication through our networks. If you contact us by E-mail, we may store your name and address to facilitate communication.
|
|
From: Bill B. <bb...@re...> - 2013-09-26 12:45:23
|
AuthorizationRestService.webserviceTest() does not have a @POST
annotation on it. If you annotate a class with JAX-RS annotations, it
will not use the interface's annotations at all and you must redeclare
everything in the class.
On 9/26/2013 8:07 AM, yashar Bizhanzadeh wrote:
>
> I am trying to call a webservice method via a proxy but I have got an
> error message that says: "Subresource for target class has no jax-rs
> annotations.: org.jboss.resteasy.core.ServerResponse"
>
> Here is my server class
>
> |@Path("/authorizationCheck")
> public class AuthorizationRestService implements AuthorizationService {
>
> @Override
> @Path("/webserviceTest")
> public Response webserviceTest(){
> TestDTO x = new TestDTO();
> x.setFieldOne("ffff");
> x.setFieldTwo("gggg");
> Response res = Response.ok(x).build();
> return res;
>
>
> }
> }
> |
>
> with a an interface like this
>
> |@Path("/authorizationCheck")
> public interface AuthorizationService {
>
> @POST
> @Path("/webserviceTest")
> public Response webserviceTest();
> }
> |
>
> and my return object wrapped in response
>
> |@XmlRootElement
> @XmlAccessorType(XmlAccessType.FIELD)
> public class TestDTO {
>
> private String fieldOne;
>
> private String fieldTwo;
>
> public String getFieldOne() {
> return fieldOne;
> }
>
> public void setFieldOne(String fieldOne) {
> this.fieldOne = fieldOne;
> }
>
> public String getFieldTwo() {
> return fieldTwo;
> }
>
> public void setFieldTwo(String fieldTwo) {
> this.fieldTwo = fieldTwo;
> }
>
>
>
> }
> |
>
> and finally my client class
>
> |@Stateful
> @Scope(ScopeType.CONVERSATION)
> @Name("authorizationCheckService")
> public class AuthorizationCheckService {
>
> public void testWebservice(){
> RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
> AuthorizationService proxy =
> ProxyFactory.create(AuthorizationService.class,
> ApplicationConfig.WORKFLOWSERVER_URL + "services/authorizationCheck/webserviceTest");
> Response response = proxy.webserviceTest();
> return;
>
>
>
> }
> }
> |
>
> what I am doing wrong here , any help will be appreciated.
>
> Regards
> //Yashar
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: yashar B. <yas...@gm...> - 2013-09-26 12:08:21
|
I am trying to call a webservice method via a proxy but I have got an error
message that says: "Subresource for target class has no jax-rs
annotations.: org.jboss.resteasy.core.ServerResponse"
Here is my server class
@Path("/authorizationCheck")
public class AuthorizationRestService implements AuthorizationService {
@Override
@Path("/webserviceTest")
public Response webserviceTest(){
TestDTO x = new TestDTO();
x.setFieldOne("ffff");
x.setFieldTwo("gggg");
Response res = Response.ok(x).build();
return res;
}
}
with a an interface like this
@Path("/authorizationCheck")
public interface AuthorizationService {
@POST
@Path("/webserviceTest")
public Response webserviceTest();
}
and my return object wrapped in response
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class TestDTO {
private String fieldOne;
private String fieldTwo;
public String getFieldOne() {
return fieldOne;
}
public void setFieldOne(String fieldOne) {
this.fieldOne = fieldOne;
}
public String getFieldTwo() {
return fieldTwo;
}
public void setFieldTwo(String fieldTwo) {
this.fieldTwo = fieldTwo;
}
}
and finally my client class
@Stateful
@Scope(ScopeType.CONVERSATION)
@Name("authorizationCheckService")
public class AuthorizationCheckService {
public void testWebservice(){
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
AuthorizationService proxy =
ProxyFactory.create(AuthorizationService.class,
ApplicationConfig.WORKFLOWSERVER_URL +
"services/authorizationCheck/webserviceTest");
Response response = proxy.webserviceTest();
return;
}
}
what I am doing wrong here , any help will be appreciated.
Regards
//Yashar
|