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: Jean-François H. <jfh...@gm...> - 2013-09-24 14:44:33
|
Using Resteasy 3.0.4 Final, I can not get the Entity on "void" methods.
I have a @DELETE method returning "void" normally (status 200) but an
serialized Error on status 400.
Using the following catch is working if method is normally returning an
Entity :
} catch (BadRequestException e) {
Response resp = e.getResponse();
err = resp.readEntity(Error.class);
}
On delete I have a "Response is closed" error.
Debugging a little, I found that the DefaultEntityExtractorFactory reads
the Entity :
if (status >= 400)
{
response.bufferEntity();
response.close();
ClientInvocation.handleErrorStatus(response);
}
So the response is closed but available in the bufferedEntity field.
But the ClientResponse.readEntity is checking :
public <T> T readEntity(Class<T> type, Type genericType, Annotation[]
anns)
{
abortIfClosed();
...
The response is closed but the entity has been buffered, so error entity
can not be got.
Is it the expected behavior ? Is there a way to get the buffered entity ?
By extending the DefaultEntityExtractorFactory ?
Thanks.
2013/8/20 Bill Burke <bb...@re...>
> Use REsteasy 3 and the new JAX-RS 2.0 client api. Then you just return
> a Response, check the status, and extract whatever you want.
>
> On 8/20/2013 11:42 AM, Jason Novotny wrote:
> > Hi,
> >
> > Typically I have resteasy calls like:
> >
> > @POST
> > @Path("/blah/restcall")
> > ClientResponse<MyObject> restCall();
> >
> > Where I expect to get MyObject back-- however, the third-party API I'm
> > using will flag the response code as 500 if it turns out to be an error,
> > in which case MyObject should really be ErrorObject. Is there a way to
> > handle this case easily?
> >
> > Thanks, Jason
> >
> >
> ------------------------------------------------------------------------------
> > Introducing Performance Central, a new site from SourceForge and
> > AppDynamics. Performance Central is your source for news, insights,
> > analysis and resources for efficient Application Performance Management.
> > Visit us today!
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&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
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
|
|
From: Mark J. <MJe...@id...> - 2013-09-23 16:25:02
|
Hi, I was previously using RestEasy 3.0.3 (and other releases back a fair way) deployed in an ear on JBoss 4.2.3. I would like to upgrade to 3.0.4 (XXE fixes) but on trying this I have run into problems with the unmarshalling of the XML by JAXB (full stack trace below) As there is no change to the code itself (only the RestEasy version) and this is easily repeatable I am wondering what is going wrong. All other aspects of the REST interface (authentication GETS , not JAXB POSTS, PUTS, DELETES) are working fine. I noticed the JAXB version has been updated and now the interface jar is included. Could this be clashing with the interface jar in the endorsed libraries folder of JBoss? Thanks for any help. Mark Example XML request URL (POST Method) https://localhost:8443/EWorkbookWebApp/services/1.0/cache/entities/bd9ab8c01fa711e3a7c3b8ac6fa2299f/commit PAYLOAD 1. 2. <?xml version="1.0" encoding="utf-8"?><commit xmlns="http://entity.services.ewb.idbs.com" entityId="bd9ab8c01fa711e3a7c3b8ac6fa2299f" entityVersionType="DRAFT"><author reason=""/></commit> EXECEPTION [java] 10:32:44,326 WARN [ExceptionHandler] Failed executing POST /services/1.0/cache/entities/bd9ab8c01fa711e3a7c3b8ac6fa2299f/commit [java] org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"commit"). Expected elements are <{http://entity.services.ewb.idbs.com}commit>,<{http://entity.services.ewb.idbs.com}data>,<{http://entity.services.ewb.idbs.com}entities>,<{http://entity.services.ewb.idbs.com}entityAttribute>,<{http://entity.services.ewb.idbs.com}entityAttributeSequence>,<{http://entity.services.ewb.idbs.com}entityComment>,<{http://entity.services.ewb.idbs.com}entityCommentSequence>,<{http://entity.services.ewb.idbs.com}entityCreated>,<{http://entity.services.ewb.idbs.com}entityDefinition>,<{http://entity.services.ewb.idbs.com}entityDto>,<{http://entity.services.ewb.idbs.com}entityPathSequences>,<{http://entity.services.ewb.idbs.com}entityRetrieveOptions>,<{http://entity.services.ewb.idbs.com}entitySequence>,<{http://entity.services.ewb.idbs.com}entityTag>,<{http://entity.services.ewb.idbs.com}entityTagSequence>,<{http://entity.services.ewb.idbs.com}entityTypeNames>,<{http://entity.services.ewb.idbs.com}entityUpdate>,<{http://entity.services.ewb.idbs.com}entityValidation>,<{http://entity.services.ewb.idbs.com}entityVersionSequence>,<{http://entity.services.ewb.idbs.com}entityVersions>,<{http://entity.services.ewb.idbs.com}paths>,<{http://entity.services.ewb.idbs.com}placeholderUpdate>,<{http://entity.services.ewb.idbs.com}recordOutline>,<{http://entity.services.ewb.idbs.com}replaceEntityInfo>,<{http://entity.services.ewb.idbs.com}responseStatus>,<{http://entity.services.ewb.idbs.com}signOff>,<{http://entity.services.ewb.idbs.com}templateValidationResponse>,<{http://entity.services.ewb.idbs.com}userActionInfo> [java] at org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider.readFrom(JAXBXmlTypeProvider.java:109) [java] at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:59) [java] at org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:62) [java] at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:51) [java] at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59) [java] at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53) [java] at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:150) [java] at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:88) [java] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:111) [java] at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:280) [java] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:234) [java] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:221) [java] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [java] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [java] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [java] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [java] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) <Snip> [java] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) [java] at java.lang.Thread.run(Thread.java:722) [java] Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"commit"). Expected elements are <{http://entity.services.ewb.idbs.com}commit>,<{http://entity.services.ewb.idbs.com}data>,<{http://entity.services.ewb.idbs.com}entities>,<{http://entity.services.ewb.idbs.com}entityAttribute>,<{http://entity.services.ewb.idbs.com}entityAttributeSequence>,<{http://entity.services.ewb.idbs.com}entityComment>,<{http://entity.services.ewb.idbs.com}entityCommentSequence>,<{http://entity.services.ewb.idbs.com}entityCreated>,<{http://entity.services.ewb.idbs.com}entityDefinition>,<{http://entity.services.ewb.idbs.com}entityDto>,<{http://entity.services.ewb.idbs.com}entityPathSequences>,<{http://entity.services.ewb.idbs.com}entityRetrieveOptions>,<{http://entity.services.ewb.idbs.com}entitySequence>,<{http://entity.services.ewb.idbs.com}entityTag>,<{http://entity.services.ewb.idbs.com}entityTagSequence>,<{http://entity.services.ewb.idbs.com}entityTypeNames>,<{http://entity.services.ewb.idbs.com}entityUpdate>,<{http://entity.services.ewb.idbs.com}entityValidation>,<{http://entity.services.ewb.idbs.com}entityVersionSequence>,<{http://entity.services.ewb.idbs.com}entityVersions>,<{http://entity.services.ewb.idbs.com}paths>,<{http://entity.services.ewb.idbs.com}placeholderUpdate>,<{http://entity.services.ewb.idbs.com}recordOutline>,<{http://entity.services.ewb.idbs.com}replaceEntityInfo>,<{http://entity.services.ewb.idbs.com}responseStatus>,<{http://entity.services.ewb.idbs.com}signOff>,<{http://entity.services.ewb.idbs.com}templateValidationResponse>,<{http://entity.services.ewb.idbs.com}userActionInfo> [java] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:647) [java] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:258) [java] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:253) [java] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:120) [java] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1052) [java] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:483) [java] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:464) [java] at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:152) [java] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) [java] at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) <Snip> [java] at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:119) [java] at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:102) [java] at org.jboss.resteasy.plugins.providers.jaxb.ExternalEntityUnmarshaller.unmarshal(ExternalEntityUnmarshaller.java:158) [java] at org.jboss.resteasy.plugins.providers.jaxb.ExternalEntityUnmarshaller.unmarshal(ExternalEntityUnmarshaller.java:134) [java] at org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider.readFrom(JAXBXmlTypeProvider.java:95) [java] ... 33 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-09-16 12:48:47
|
Thanks, i'll add a JIRA for this. Apologies... But: https://github.com/resteasy/Resteasy/blob/3.0.4.Final/jaxrs/resteasy-jaxrs-testsuite/src/test/java/org/jboss/resteasy/test/nextgen/client/cache/ClientCacheTest.java Gives an example. It has been redesigned a little bit to use the new client API. The new package is org.jboss.resteasy.client.jaxrs.cache.* You register a BrowserCacheFeature client.register(BrowserCacheFeature.class) Or you can instantiate teh feature and initialize it with a BrowserCache of your choosing. Also, ProxyFactory is now a part of ResteasyWebTarget. This, I *DID* document: http://docs.jboss.org/resteasy/docs/3.0.4.Final/userguide/html/RESTEasy_Client_Framework.html#d4e2101 On 9/16/2013 6:42 AM, Borut Bolčina wrote: > Hello, > > The Javadoc says the whole package org.jboss.resteasy.client.cache is > deprecated but it does not provide any information what to use instead. > Very bad practice IMHO. The same lack of info is for > org.jboss.resteasy.client.ProxyFactory. > > So what should we use instead of LightweightBrowserCache in the latest > (3.0.4) incarnation of resteasy? > > Regards, > Borut > > > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&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-09-16 10:43:22
|
Hello, The Javadoc says the whole package org.jboss.resteasy.client.cache is deprecated but it does not provide any information what to use instead. Very bad practice IMHO. The same lack of info is for org.jboss.resteasy.client.ProxyFactory. So what should we use instead of LightweightBrowserCache in the latest (3.0.4) incarnation of resteasy? Regards, Borut |
|
From: Bill B. <bb...@re...> - 2013-09-05 15:42:32
|
Resteasy 3.0.4.Final has been released today. Besides some bug fixes, this ended up being a major feature release specifically: * Netty 4 integration thanks to Kristoffer Sjoegren * Undertow integration * JOSE JSON Web Encryption (JWE) Support * A new Servlet 3.0 ServerContainerInitializer for Resteasy. This allows you to take advantage of JAX-RS integration within a standalone Servlet 3.0 environment. This means you can work solely with Application classes, use automatic scanning, and not have to write anything in your web.xml files for Tomcat and Jetty deployments!. * I also published the new revised examples for my up-and-coming Restful Java With JAX-RS 2.0 book. As usual, check out http://jboss.org/resteasy for how to download the distro and view documentation. -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Rajshekhar A. <ran...@re...> - 2013-09-05 10:31:16
|
Hi Bill Thanks for clarifying the details of scope with respect to the client API. Regards A.P. Rajshekar -------- Original Message -------- Subject: Re: [Resteasy-users] Restricting json custom provider to a particular client Date: Wed, 04 Sep 2013 09:42:41 -0400 From: Bill Burke <bb...@re...> To: res...@li... Its up to you what the scope is. But ugh...there's no nice way to do this in the ClientRequest API right now. What you could use is a ClientRequestFactory: ResteasyProviderFactory factory = new ResteasyProviderFactory(); factory.register(JsonProvider.class); ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(); ClientRequestFactory requestFactory = new ClientRequestFactory(executor, factory); ClientRequest request = requestFactory.createRequest(uri); On 9/4/2013 8:55 AM, Rajshekhar AndalaPisharam wrote: > Hi Bill > > If we create/initialize your own ResteasyProviderFactory, what will be the scope of provider? Will it be request or application scope? > > As per our observation, it is application scope and which is causing problems to other clients. > > Thanks > > A.P. Rajshekhar > > ----- Original Message ----- > From: "Rajshekhar AndalaPisharam"<ran...@re...> > To: res...@li... > Sent: Wednesday, September 4, 2013 1:02:19 PM > Subject: Re: [Resteasy-users] Restricting json custom provider to a particular client > > Hi Bill > > Thanks for your suggestion. We are using Resteasy 2.3.x. We will get back to you once we check this out. > > Regards > > A.P. Rajshekhar > > -------- Original Message -------- > Subject: Re: [Resteasy-users] Restricting json custom provider to a > particular client > Date: Thu, 29 Aug 2013 09:42:27 -0400 > From: Bill Burke<bb...@re...> > To: res...@li... > > > > Not sure what you mean. Which client api are you using? Resteasy 2.3.x > or JAX-RS 2.0 in Resteasy 3.0? > > In the former, you can create/initialize your own > ResteasyProviderFactory. In the latter, this automatically happens per > Client you create. > > On 8/29/2013 9:16 AM, Rajshekhar AndalaPisharam wrote: >> Hi Bill, >> >> We are using jacksonJsonProvider to consume and produce json data in >> underscore format. >> >> However when we are trying to integrate with 3rd party systems our >> custom provider is getting called and >> causing exceptions as 3rd party does not need underscore format. >> >> Is there a way to restrict the custom provider to particular client ? >> >> Thanks >> >> A.P. Rajshekhar >> >> ------------------------------------------------------------------------------ >> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >> Discover the easy way to master current and previous Microsoft technologies >> and advance your career. Get an incredible 1,500+ hours of step-by-step >> tutorial videos with LearnDevNow. Subscribe today and save! >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&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 ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Resteasy-users mailing list Res...@li... https://lists.sourceforge.net/lists/listinfo/resteasy-users |
|
From: John D. A. <joh...@gm...> - 2013-09-04 21:09:08
|
Yeah, I've run into this too (my situation is worse, I have RESTeasy
w/ Jackson, Apache CXF w/ Jettison and a third system using Spring MVC
w/ Jackson).
Jettison's JSON structure is more like XML with its use of root
elements in a parent wrapper tag. This is acceptable by JSON
standards, but not normal by JSON standards.
On Wed, Sep 4, 2013 at 4:57 PM, Bill Burke <bb...@re...> wrote:
> JSON is not a *Java* format. It is a JavaScript Object Notation.
>
> On 9/4/2013 4:54 PM, Mike Miller wrote:
>> Thanks - will try that. Just included the Jackson jar but that didn't make it.
>>
>> One last question - don't mean to eat up all your time - but your statement, "But you are right, Jettison produces different JSON." How that be? Isn't JSON a spec such that there should be consistent output for a set of data?
>>
>> -----Original Message-----
>> From: Bill Burke [mailto:bb...@re...]
>> Sent: Wednesday, September 04, 2013 3:50 PM
>> To: Mike Miller
>> Cc: res...@li...
>> Subject: Re: [Resteasy-users] Confused on handling response containing collections in json
>>
>> Just don't include the jettison module and include all the jackson stuff. Should work.
>>
>> On 9/4/2013 4:19 PM, Mike Miller wrote:
>>> Sorry - we are JBoss 4.2.3.GA (still) with RestEasy 2.3.5.
>>>
>>> -----Original Message-----
>>> From: Bill Burke [mailto:bb...@re...]
>>> Sent: Wednesday, September 04, 2013 3:06 PM
>>> To: Mike Miller
>>> Cc: res...@li...
>>> Subject: Re: [Resteasy-users] Confused on handling response containing
>>> collections in json
>>>
>>> What is your server? Tomcat? Jetty? JBoss version?
>>>
>>> On 9/4/2013 4:02 PM, Mike Miller wrote:
>>>> Okay, thanks - so how do I do that? I see Chapter 21 (2.3.5) talks about Maven but we aren't using maven. Do I just need to include the jar or is there something in the web.xml that I need to add to include this 'provider?
>>>>
>>>> Also could someone please address my last question:
>>>>
>>>> "Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?"
>>>>
>>>> -----Original Message-----
>>>> From: Bill Burke [mailto:bb...@re...]
>>>> Sent: Wednesday, September 04, 2013 2:54 PM
>>>> To: res...@li...
>>>> Subject: Re: [Resteasy-users] Confused on handling response
>>>> containing collections in json
>>>>
>>>> Switch to Jackson on the server side. We will be deprecating Jettison in the near future as it is buggy and not being well maintained.
>>>> Jackson has all of what Jettison has and more...
>>>>
>>>> But you are right, Jettison produces different JSON.
>>>>
>>>> On 9/4/2013 3:27 PM, Mike Miller wrote:
>>>>> We are building a restful api, using 2.3.5 (although I don't think
>>>>> the release level matters) and I am a bit confused on response
>>>>> handling within RestEasy:
>>>>>
>>>>> Right or wrong, we made most of our resource methods return
>>>>> Response, using the GenericEntity when we wanted to return a collection of
>>>>> objects. Testing up to now was in Chrome Advanced Rest Client. We
>>>>> have our beans JAXB annotated and the resource 'produces' both
>>>>> application/xml and application/json. For example:
>>>>>
>>>>> @GET
>>>>>
>>>>> @Produces({"application/json", "application/xml"})
>>>>>
>>>>> *public*Response find(@ContextUriInfo uriInfo)
>>>>>
>>>>> {
>>>>>
>>>>> setupQueryParms(uriInfo.getQueryParameters());
>>>>>
>>>>> List<Customer> custList = *null*;
>>>>>
>>>>> *try*{
>>>>>
>>>>> custList = listAllPaginated();
>>>>>
>>>>> } *catch*(FinderException e) {
>>>>>
>>>>> Log./getInstance/().error("FinderException
>>>>> caught :", e );
>>>>>
>>>>> throwException(Response.Status./NOT_FOUND/,
>>>>> "Error searching customers");
>>>>>
>>>>> }
>>>>>
>>>>> GenericEntity<List<Customer>> entity =
>>>>> *new*GenericEntity<List<Customer>>(custList) {};
>>>>>
>>>>> *return*Response./ok/(entity).build();
>>>>>
>>>>> }
>>>>>
>>>>> Now, as part of writing JUnit test cases, I wanted to take the
>>>>> response I get back and put it back to object form so that I can then do a set of
>>>>> asserts against the object or list of objects returned. I downloaded
>>>>> Jackson version 1.9.11 and tried to serialize/marshal the json back
>>>>> to object form but keep getting the following error:
>>>>>
>>>>> Exception in thread "main"
>>>>> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
>>>>> Unrecognized field "Customer" (Class
>>>>> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>>>>>
>>>>> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
>>>>> line: 1, column: 15] (through reference chain:
>>>>> com.jda.portfolio.api.rest.base.Customer["Customer"])
>>>>>
>>>>> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>>>>>
>>>>>
>>>>>
>>>>> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
>>>>>
>>>>>
>>>>>
>>>>> It seems like from Jackson, I would get something like:
>>>>>
>>>>> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>>>>>
>>>>>
>>>>>
>>>>> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>>>>>
>>>>>
>>>>>
>>>>> What am I doing wrong?
>>>>>
>>>>>
>>>>>
>>>>> Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>>>>>
>>>>>
>>>>>
>>>>> I hope this is clear, but I can provide more details if needed.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> -
>>>>> -
>>>>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>>>>> 2012, more!
>>>>> Discover the easy way to master current and previous Microsoft
>>>>> technologies and advance your career. Get an incredible 1,500+ hours
>>>>> of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>>>>> c
>>>>> lktrk
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>> ---------------------------------------------------------------------
>>>> -
>>>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>>>> 2012, more!
>>>> Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>>>> c lktrk _______________________________________________
>>>> 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
>>>
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
|
|
From: Bill B. <bb...@re...> - 2013-09-04 20:57:50
|
JSON is not a *Java* format. It is a JavaScript Object Notation.
On 9/4/2013 4:54 PM, Mike Miller wrote:
> Thanks - will try that. Just included the Jackson jar but that didn't make it.
>
> One last question - don't mean to eat up all your time - but your statement, "But you are right, Jettison produces different JSON." How that be? Isn't JSON a spec such that there should be consistent output for a set of data?
>
> -----Original Message-----
> From: Bill Burke [mailto:bb...@re...]
> Sent: Wednesday, September 04, 2013 3:50 PM
> To: Mike Miller
> Cc: res...@li...
> Subject: Re: [Resteasy-users] Confused on handling response containing collections in json
>
> Just don't include the jettison module and include all the jackson stuff. Should work.
>
> On 9/4/2013 4:19 PM, Mike Miller wrote:
>> Sorry - we are JBoss 4.2.3.GA (still) with RestEasy 2.3.5.
>>
>> -----Original Message-----
>> From: Bill Burke [mailto:bb...@re...]
>> Sent: Wednesday, September 04, 2013 3:06 PM
>> To: Mike Miller
>> Cc: res...@li...
>> Subject: Re: [Resteasy-users] Confused on handling response containing
>> collections in json
>>
>> What is your server? Tomcat? Jetty? JBoss version?
>>
>> On 9/4/2013 4:02 PM, Mike Miller wrote:
>>> Okay, thanks - so how do I do that? I see Chapter 21 (2.3.5) talks about Maven but we aren't using maven. Do I just need to include the jar or is there something in the web.xml that I need to add to include this 'provider?
>>>
>>> Also could someone please address my last question:
>>>
>>> "Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?"
>>>
>>> -----Original Message-----
>>> From: Bill Burke [mailto:bb...@re...]
>>> Sent: Wednesday, September 04, 2013 2:54 PM
>>> To: res...@li...
>>> Subject: Re: [Resteasy-users] Confused on handling response
>>> containing collections in json
>>>
>>> Switch to Jackson on the server side. We will be deprecating Jettison in the near future as it is buggy and not being well maintained.
>>> Jackson has all of what Jettison has and more...
>>>
>>> But you are right, Jettison produces different JSON.
>>>
>>> On 9/4/2013 3:27 PM, Mike Miller wrote:
>>>> We are building a restful api, using 2.3.5 (although I don't think
>>>> the release level matters) and I am a bit confused on response
>>>> handling within RestEasy:
>>>>
>>>> Right or wrong, we made most of our resource methods return
>>>> Response, using the GenericEntity when we wanted to return a collection of
>>>> objects. Testing up to now was in Chrome Advanced Rest Client. We
>>>> have our beans JAXB annotated and the resource 'produces' both
>>>> application/xml and application/json. For example:
>>>>
>>>> @GET
>>>>
>>>> @Produces({"application/json", "application/xml"})
>>>>
>>>> *public*Response find(@ContextUriInfo uriInfo)
>>>>
>>>> {
>>>>
>>>> setupQueryParms(uriInfo.getQueryParameters());
>>>>
>>>> List<Customer> custList = *null*;
>>>>
>>>> *try*{
>>>>
>>>> custList = listAllPaginated();
>>>>
>>>> } *catch*(FinderException e) {
>>>>
>>>> Log./getInstance/().error("FinderException
>>>> caught :", e );
>>>>
>>>> throwException(Response.Status./NOT_FOUND/,
>>>> "Error searching customers");
>>>>
>>>> }
>>>>
>>>> GenericEntity<List<Customer>> entity =
>>>> *new*GenericEntity<List<Customer>>(custList) {};
>>>>
>>>> *return*Response./ok/(entity).build();
>>>>
>>>> }
>>>>
>>>> Now, as part of writing JUnit test cases, I wanted to take the
>>>> response I get back and put it back to object form so that I can then do a set of
>>>> asserts against the object or list of objects returned. I downloaded
>>>> Jackson version 1.9.11 and tried to serialize/marshal the json back
>>>> to object form but keep getting the following error:
>>>>
>>>> Exception in thread "main"
>>>> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
>>>> Unrecognized field "Customer" (Class
>>>> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>>>>
>>>> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
>>>> line: 1, column: 15] (through reference chain:
>>>> com.jda.portfolio.api.rest.base.Customer["Customer"])
>>>>
>>>> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>>>>
>>>>
>>>>
>>>> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
>>>>
>>>>
>>>>
>>>> It seems like from Jackson, I would get something like:
>>>>
>>>> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>>>>
>>>>
>>>>
>>>> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>>>>
>>>>
>>>>
>>>> What am I doing wrong?
>>>>
>>>>
>>>>
>>>> Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>>>>
>>>>
>>>>
>>>> I hope this is clear, but I can provide more details if needed.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> -
>>>> -
>>>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>>>> 2012, more!
>>>> Discover the easy way to master current and previous Microsoft
>>>> technologies and advance your career. Get an incredible 1,500+ hours
>>>> of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>>>> c
>>>> lktrk
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>>> 2012, more!
>>> Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>>> c lktrk _______________________________________________
>>> 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
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Mike M. <Mik...@jd...> - 2013-09-04 20:54:23
|
Thanks - will try that. Just included the Jackson jar but that didn't make it.
One last question - don't mean to eat up all your time - but your statement, "But you are right, Jettison produces different JSON." How that be? Isn't JSON a spec such that there should be consistent output for a set of data?
-----Original Message-----
From: Bill Burke [mailto:bb...@re...]
Sent: Wednesday, September 04, 2013 3:50 PM
To: Mike Miller
Cc: res...@li...
Subject: Re: [Resteasy-users] Confused on handling response containing collections in json
Just don't include the jettison module and include all the jackson stuff. Should work.
On 9/4/2013 4:19 PM, Mike Miller wrote:
> Sorry - we are JBoss 4.2.3.GA (still) with RestEasy 2.3.5.
>
> -----Original Message-----
> From: Bill Burke [mailto:bb...@re...]
> Sent: Wednesday, September 04, 2013 3:06 PM
> To: Mike Miller
> Cc: res...@li...
> Subject: Re: [Resteasy-users] Confused on handling response containing
> collections in json
>
> What is your server? Tomcat? Jetty? JBoss version?
>
> On 9/4/2013 4:02 PM, Mike Miller wrote:
>> Okay, thanks - so how do I do that? I see Chapter 21 (2.3.5) talks about Maven but we aren't using maven. Do I just need to include the jar or is there something in the web.xml that I need to add to include this 'provider?
>>
>> Also could someone please address my last question:
>>
>> "Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?"
>>
>> -----Original Message-----
>> From: Bill Burke [mailto:bb...@re...]
>> Sent: Wednesday, September 04, 2013 2:54 PM
>> To: res...@li...
>> Subject: Re: [Resteasy-users] Confused on handling response
>> containing collections in json
>>
>> Switch to Jackson on the server side. We will be deprecating Jettison in the near future as it is buggy and not being well maintained.
>> Jackson has all of what Jettison has and more...
>>
>> But you are right, Jettison produces different JSON.
>>
>> On 9/4/2013 3:27 PM, Mike Miller wrote:
>>> We are building a restful api, using 2.3.5 (although I don't think
>>> the release level matters) and I am a bit confused on response
>>> handling within RestEasy:
>>>
>>> Right or wrong, we made most of our resource methods return
>>> Response, using the GenericEntity when we wanted to return a collection of
>>> objects. Testing up to now was in Chrome Advanced Rest Client. We
>>> have our beans JAXB annotated and the resource 'produces' both
>>> application/xml and application/json. For example:
>>>
>>> @GET
>>>
>>> @Produces({"application/json", "application/xml"})
>>>
>>> *public*Response find(@ContextUriInfo uriInfo)
>>>
>>> {
>>>
>>> setupQueryParms(uriInfo.getQueryParameters());
>>>
>>> List<Customer> custList = *null*;
>>>
>>> *try*{
>>>
>>> custList = listAllPaginated();
>>>
>>> } *catch*(FinderException e) {
>>>
>>> Log./getInstance/().error("FinderException
>>> caught :", e );
>>>
>>> throwException(Response.Status./NOT_FOUND/,
>>> "Error searching customers");
>>>
>>> }
>>>
>>> GenericEntity<List<Customer>> entity =
>>> *new*GenericEntity<List<Customer>>(custList) {};
>>>
>>> *return*Response./ok/(entity).build();
>>>
>>> }
>>>
>>> Now, as part of writing JUnit test cases, I wanted to take the
>>> response I get back and put it back to object form so that I can then do a set of
>>> asserts against the object or list of objects returned. I downloaded
>>> Jackson version 1.9.11 and tried to serialize/marshal the json back
>>> to object form but keep getting the following error:
>>>
>>> Exception in thread "main"
>>> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
>>> Unrecognized field "Customer" (Class
>>> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>>>
>>> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
>>> line: 1, column: 15] (through reference chain:
>>> com.jda.portfolio.api.rest.base.Customer["Customer"])
>>>
>>> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>>>
>>>
>>>
>>> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
>>>
>>>
>>>
>>> It seems like from Jackson, I would get something like:
>>>
>>> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>>>
>>>
>>>
>>> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>>>
>>>
>>>
>>> What am I doing wrong?
>>>
>>>
>>>
>>> Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>>>
>>>
>>>
>>> I hope this is clear, but I can provide more details if needed.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> -
>>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>>> 2012, more!
>>> Discover the easy way to master current and previous Microsoft
>>> technologies and advance your career. Get an incredible 1,500+ hours
>>> of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>>> c
>>> lktrk
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>> ---------------------------------------------------------------------
>> -
>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>> 2012, more!
>> Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>> c lktrk _______________________________________________
>> 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
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Bill B. <bb...@re...> - 2013-09-04 20:49:48
|
Just don't include the jettison module and include all the jackson
stuff. Should work.
On 9/4/2013 4:19 PM, Mike Miller wrote:
> Sorry - we are JBoss 4.2.3.GA (still) with RestEasy 2.3.5.
>
> -----Original Message-----
> From: Bill Burke [mailto:bb...@re...]
> Sent: Wednesday, September 04, 2013 3:06 PM
> To: Mike Miller
> Cc: res...@li...
> Subject: Re: [Resteasy-users] Confused on handling response containing collections in json
>
> What is your server? Tomcat? Jetty? JBoss version?
>
> On 9/4/2013 4:02 PM, Mike Miller wrote:
>> Okay, thanks - so how do I do that? I see Chapter 21 (2.3.5) talks about Maven but we aren't using maven. Do I just need to include the jar or is there something in the web.xml that I need to add to include this 'provider?
>>
>> Also could someone please address my last question:
>>
>> "Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?"
>>
>> -----Original Message-----
>> From: Bill Burke [mailto:bb...@re...]
>> Sent: Wednesday, September 04, 2013 2:54 PM
>> To: res...@li...
>> Subject: Re: [Resteasy-users] Confused on handling response containing
>> collections in json
>>
>> Switch to Jackson on the server side. We will be deprecating Jettison in the near future as it is buggy and not being well maintained.
>> Jackson has all of what Jettison has and more...
>>
>> But you are right, Jettison produces different JSON.
>>
>> On 9/4/2013 3:27 PM, Mike Miller wrote:
>>> We are building a restful api, using 2.3.5 (although I don't think
>>> the release level matters) and I am a bit confused on response
>>> handling within RestEasy:
>>>
>>> Right or wrong, we made most of our resource methods return Response,
>>> using the GenericEntity when we wanted to return a collection of
>>> objects. Testing up to now was in Chrome Advanced Rest Client. We
>>> have our beans JAXB annotated and the resource 'produces' both
>>> application/xml and application/json. For example:
>>>
>>> @GET
>>>
>>> @Produces({"application/json", "application/xml"})
>>>
>>> *public*Response find(@ContextUriInfo uriInfo)
>>>
>>> {
>>>
>>> setupQueryParms(uriInfo.getQueryParameters());
>>>
>>> List<Customer> custList = *null*;
>>>
>>> *try*{
>>>
>>> custList = listAllPaginated();
>>>
>>> } *catch*(FinderException e) {
>>>
>>> Log./getInstance/().error("FinderException
>>> caught :", e );
>>>
>>> throwException(Response.Status./NOT_FOUND/,
>>> "Error searching customers");
>>>
>>> }
>>>
>>> GenericEntity<List<Customer>> entity =
>>> *new*GenericEntity<List<Customer>>(custList) {};
>>>
>>> *return*Response./ok/(entity).build();
>>>
>>> }
>>>
>>> Now, as part of writing JUnit test cases, I wanted to take the
>>> response I get back and put it back to object form so that I can then do a set of
>>> asserts against the object or list of objects returned. I downloaded
>>> Jackson version 1.9.11 and tried to serialize/marshal the json back
>>> to object form but keep getting the following error:
>>>
>>> Exception in thread "main"
>>> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
>>> Unrecognized field "Customer" (Class
>>> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>>>
>>> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
>>> line: 1, column: 15] (through reference chain:
>>> com.jda.portfolio.api.rest.base.Customer["Customer"])
>>>
>>> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>>>
>>>
>>>
>>> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
>>>
>>>
>>>
>>> It seems like from Jackson, I would get something like:
>>>
>>> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>>>
>>>
>>>
>>> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>>>
>>>
>>>
>>> What am I doing wrong?
>>>
>>>
>>>
>>> Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>>>
>>>
>>>
>>> I hope this is clear, but I can provide more details if needed.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>>> 2012, more!
>>> Discover the easy way to master current and previous Microsoft
>>> technologies and advance your career. Get an incredible 1,500+ hours
>>> of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>>> c
>>> lktrk
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>> ----------------------------------------------------------------------
>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>> 2012, more!
>> Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.c
>> lktrk _______________________________________________
>> 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
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Mike M. <Mik...@jd...> - 2013-09-04 20:19:45
|
Sorry - we are JBoss 4.2.3.GA (still) with RestEasy 2.3.5.
-----Original Message-----
From: Bill Burke [mailto:bb...@re...]
Sent: Wednesday, September 04, 2013 3:06 PM
To: Mike Miller
Cc: res...@li...
Subject: Re: [Resteasy-users] Confused on handling response containing collections in json
What is your server? Tomcat? Jetty? JBoss version?
On 9/4/2013 4:02 PM, Mike Miller wrote:
> Okay, thanks - so how do I do that? I see Chapter 21 (2.3.5) talks about Maven but we aren't using maven. Do I just need to include the jar or is there something in the web.xml that I need to add to include this 'provider?
>
> Also could someone please address my last question:
>
> "Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?"
>
> -----Original Message-----
> From: Bill Burke [mailto:bb...@re...]
> Sent: Wednesday, September 04, 2013 2:54 PM
> To: res...@li...
> Subject: Re: [Resteasy-users] Confused on handling response containing
> collections in json
>
> Switch to Jackson on the server side. We will be deprecating Jettison in the near future as it is buggy and not being well maintained.
> Jackson has all of what Jettison has and more...
>
> But you are right, Jettison produces different JSON.
>
> On 9/4/2013 3:27 PM, Mike Miller wrote:
>> We are building a restful api, using 2.3.5 (although I don't think
>> the release level matters) and I am a bit confused on response
>> handling within RestEasy:
>>
>> Right or wrong, we made most of our resource methods return Response,
>> using the GenericEntity when we wanted to return a collection of
>> objects. Testing up to now was in Chrome Advanced Rest Client. We
>> have our beans JAXB annotated and the resource 'produces' both
>> application/xml and application/json. For example:
>>
>> @GET
>>
>> @Produces({"application/json", "application/xml"})
>>
>> *public*Response find(@ContextUriInfo uriInfo)
>>
>> {
>>
>> setupQueryParms(uriInfo.getQueryParameters());
>>
>> List<Customer> custList = *null*;
>>
>> *try*{
>>
>> custList = listAllPaginated();
>>
>> } *catch*(FinderException e) {
>>
>> Log./getInstance/().error("FinderException
>> caught :", e );
>>
>> throwException(Response.Status./NOT_FOUND/,
>> "Error searching customers");
>>
>> }
>>
>> GenericEntity<List<Customer>> entity =
>> *new*GenericEntity<List<Customer>>(custList) {};
>>
>> *return*Response./ok/(entity).build();
>>
>> }
>>
>> Now, as part of writing JUnit test cases, I wanted to take the
>> response I get back and put it back to object form so that I can then do a set of
>> asserts against the object or list of objects returned. I downloaded
>> Jackson version 1.9.11 and tried to serialize/marshal the json back
>> to object form but keep getting the following error:
>>
>> Exception in thread "main"
>> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
>> Unrecognized field "Customer" (Class
>> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>>
>> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
>> line: 1, column: 15] (through reference chain:
>> com.jda.portfolio.api.rest.base.Customer["Customer"])
>>
>> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>>
>>
>>
>> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
>>
>>
>>
>> It seems like from Jackson, I would get something like:
>>
>> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>>
>>
>>
>> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>>
>>
>>
>> What am I doing wrong?
>>
>>
>>
>> Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>>
>>
>>
>> I hope this is clear, but I can provide more details if needed.
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>> 2012, more!
>> Discover the easy way to master current and previous Microsoft
>> technologies and advance your career. Get an incredible 1,500+ hours
>> of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.
>> c
>> lktrk
>>
>>
>>
>> _______________________________________________
>> 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
>
> ----------------------------------------------------------------------
> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
> 2012, more!
> Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.c
> lktrk _______________________________________________
> 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: Bill B. <bb...@re...> - 2013-09-04 20:06:33
|
What is your server? Tomcat? Jetty? JBoss version?
On 9/4/2013 4:02 PM, Mike Miller wrote:
> Okay, thanks - so how do I do that? I see Chapter 21 (2.3.5) talks about Maven but we aren't using maven. Do I just need to include the jar or is there something in the web.xml that I need to add to include this 'provider?
>
> Also could someone please address my last question:
>
> "Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?"
>
> -----Original Message-----
> From: Bill Burke [mailto:bb...@re...]
> Sent: Wednesday, September 04, 2013 2:54 PM
> To: res...@li...
> Subject: Re: [Resteasy-users] Confused on handling response containing collections in json
>
> Switch to Jackson on the server side. We will be deprecating Jettison in the near future as it is buggy and not being well maintained.
> Jackson has all of what Jettison has and more...
>
> But you are right, Jettison produces different JSON.
>
> On 9/4/2013 3:27 PM, Mike Miller wrote:
>> We are building a restful api, using 2.3.5 (although I don't think the
>> release level matters) and I am a bit confused on response handling
>> within RestEasy:
>>
>> Right or wrong, we made most of our resource methods return Response,
>> using the GenericEntity when we wanted to return a collection of
>> objects. Testing up to now was in Chrome Advanced Rest Client. We
>> have our beans JAXB annotated and the resource 'produces' both
>> application/xml and application/json. For example:
>>
>> @GET
>>
>> @Produces({"application/json", "application/xml"})
>>
>> *public*Response find(@ContextUriInfo uriInfo)
>>
>> {
>>
>> setupQueryParms(uriInfo.getQueryParameters());
>>
>> List<Customer> custList = *null*;
>>
>> *try*{
>>
>> custList = listAllPaginated();
>>
>> } *catch*(FinderException e) {
>>
>> Log./getInstance/().error("FinderException
>> caught :", e );
>>
>> throwException(Response.Status./NOT_FOUND/,
>> "Error searching customers");
>>
>> }
>>
>> GenericEntity<List<Customer>> entity =
>> *new*GenericEntity<List<Customer>>(custList) {};
>>
>> *return*Response./ok/(entity).build();
>>
>> }
>>
>> Now, as part of writing JUnit test cases, I wanted to take the
>> response I get back and put it back to object form so that I can then do a set of
>> asserts against the object or list of objects returned. I downloaded
>> Jackson version 1.9.11 and tried to serialize/marshal the json back to
>> object form but keep getting the following error:
>>
>> Exception in thread "main"
>> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
>> Unrecognized field "Customer" (Class
>> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>>
>> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
>> line: 1, column: 15] (through reference chain:
>> com.jda.portfolio.api.rest.base.Customer["Customer"])
>>
>> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>>
>>
>>
>> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
>>
>>
>>
>> It seems like from Jackson, I would get something like:
>>
>> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>>
>>
>>
>> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>>
>>
>>
>> What am I doing wrong?
>>
>>
>>
>> Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>>
>>
>>
>> I hope this is clear, but I can provide more details if needed.
>>
>>
>>
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
>> 2012, more!
>> Discover the easy way to master current and previous Microsoft
>> technologies and advance your career. Get an incredible 1,500+ hours
>> of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
>> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.c
>> lktrk
>>
>>
>>
>> _______________________________________________
>> 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
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&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: Mike M. <Mik...@jd...> - 2013-09-04 20:02:49
|
Okay, thanks - so how do I do that? I see Chapter 21 (2.3.5) talks about Maven but we aren't using maven. Do I just need to include the jar or is there something in the web.xml that I need to add to include this 'provider?
Also could someone please address my last question:
"Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?"
-----Original Message-----
From: Bill Burke [mailto:bb...@re...]
Sent: Wednesday, September 04, 2013 2:54 PM
To: res...@li...
Subject: Re: [Resteasy-users] Confused on handling response containing collections in json
Switch to Jackson on the server side. We will be deprecating Jettison in the near future as it is buggy and not being well maintained.
Jackson has all of what Jettison has and more...
But you are right, Jettison produces different JSON.
On 9/4/2013 3:27 PM, Mike Miller wrote:
> We are building a restful api, using 2.3.5 (although I don't think the
> release level matters) and I am a bit confused on response handling
> within RestEasy:
>
> Right or wrong, we made most of our resource methods return Response,
> using the GenericEntity when we wanted to return a collection of
> objects. Testing up to now was in Chrome Advanced Rest Client. We
> have our beans JAXB annotated and the resource 'produces' both
> application/xml and application/json. For example:
>
> @GET
>
> @Produces({"application/json", "application/xml"})
>
> *public*Response find(@ContextUriInfo uriInfo)
>
> {
>
> setupQueryParms(uriInfo.getQueryParameters());
>
> List<Customer> custList = *null*;
>
> *try*{
>
> custList = listAllPaginated();
>
> } *catch*(FinderException e) {
>
> Log./getInstance/().error("FinderException
> caught :", e );
>
> throwException(Response.Status./NOT_FOUND/,
> "Error searching customers");
>
> }
>
> GenericEntity<List<Customer>> entity =
> *new*GenericEntity<List<Customer>>(custList) {};
>
> *return*Response./ok/(entity).build();
>
> }
>
> Now, as part of writing JUnit test cases, I wanted to take the
> response I get back and put it back to object form so that I can then do a set of
> asserts against the object or list of objects returned. I downloaded
> Jackson version 1.9.11 and tried to serialize/marshal the json back to
> object form but keep getting the following error:
>
> Exception in thread "main"
> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
> Unrecognized field "Customer" (Class
> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>
> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
> line: 1, column: 15] (through reference chain:
> com.jda.portfolio.api.rest.base.Customer["Customer"])
>
> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>
>
>
> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
>
>
>
> It seems like from Jackson, I would get something like:
>
> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>
>
>
> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>
>
>
> What am I doing wrong?
>
>
>
> Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>
>
>
> I hope this is clear, but I can provide more details if needed.
>
>
>
>
>
>
>
> ----------------------------------------------------------------------
> -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL
> 2012, more!
> Discover the easy way to master current and previous Microsoft
> technologies and advance your career. Get an incredible 1,500+ hours
> of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.c
> lktrk
>
>
>
> _______________________________________________
> 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
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Res...@li...
https://lists.sourceforge.net/lists/listinfo/resteasy-users
|
|
From: Bill B. <bb...@re...> - 2013-09-04 19:54:14
|
Switch to Jackson on the server side. We will be deprecating Jettison
in the near future as it is buggy and not being well maintained.
Jackson has all of what Jettison has and more...
But you are right, Jettison produces different JSON.
On 9/4/2013 3:27 PM, Mike Miller wrote:
> We are building a restful api, using 2.3.5 (although I don’t think the
> release level matters) and I am a bit confused on response handling
> within RestEasy:
>
> Right or wrong, we made most of our resource methods return Response,
> using the GenericEntity when we wanted to return a collection of
> objects. Testing up to now was in Chrome Advanced Rest Client. We
> have our beans JAXB annotated and the resource ‘produces’ both
> application/xml and application/json. For example:
>
> @GET
>
> @Produces({"application/json", "application/xml"})
>
> *public*Response find(@ContextUriInfo uriInfo)
>
> {
>
> setupQueryParms(uriInfo.getQueryParameters());
>
> List<Customer> custList = *null*;
>
> *try*{
>
> custList = listAllPaginated();
>
> } *catch*(FinderException e) {
>
> Log./getInstance/().error("FinderException caught
> :", e );
>
> throwException(Response.Status./NOT_FOUND/, "Error
> searching customers");
>
> }
>
> GenericEntity<List<Customer>> entity =
> *new*GenericEntity<List<Customer>>(custList) {};
>
> *return*Response./ok/(entity).build();
>
> }
>
> Now, as part of writing JUnit test cases, I wanted to take the response
> I get back and put it back to object form so that I can then do a set of
> asserts against the object or list of objects returned. I downloaded
> Jackson version 1.9.11 and tried to serialize/marshal the json back to
> object form but keep getting the following error:
>
> Exception in thread "main"
> _org.codehaus.jackson.map.exc.UnrecognizedPropertyException_:
> Unrecognized field "Customer" (Class
> com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
>
> at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json;
> line: 1, column: 15] (through reference chain:
> com.jda.portfolio.api.rest.base.Customer["Customer"])
>
> Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
>
>
>
> [{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form – getting the same error.
>
>
>
> It seems like from Jackson, I would get something like:
>
> [{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
>
>
>
> I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
>
>
>
> What am I doing wrong?
>
>
>
> Are we using the Response object incorrectly? What’s really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
>
>
>
> I hope this is clear, but I can provide more details if needed.
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&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: Mike M. <Mik...@jd...> - 2013-09-04 19:39:38
|
We are building a restful api, using 2.3.5 (although I don't think the release level matters) and I am a bit confused on response handling within RestEasy:
Right or wrong, we made most of our resource methods return Response, using the GenericEntity when we wanted to return a collection of objects. Testing up to now was in Chrome Advanced Rest Client. We have our beans JAXB annotated and the resource 'produces' both application/xml and application/json. For example:
@GET
@Produces({"application/json", "application/xml"})
public Response find(@Context UriInfo uriInfo)
{
setupQueryParms(uriInfo.getQueryParameters());
List<Customer> custList = null;
try {
custList = listAllPaginated();
} catch (FinderException e) {
Log.getInstance().error("FinderException caught :", e );
throwException(Response.Status.NOT_FOUND, "Error searching customers");
}
GenericEntity<List<Customer>> entity = new GenericEntity<List<Customer>>(custList) {};
return Response.ok(entity).build();
}
Now, as part of writing JUnit test cases, I wanted to take the response I get back and put it back to object form so that I can then do a set of asserts against the object or list of objects returned. I downloaded Jackson version 1.9.11 and tried to serialize/marshal the json back to object form but keep getting the following error:
Exception in thread "main" org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "Customer" (Class com.jda.portfolio.api.rest.base.Customer), not marked as ignorable
at [Source: C:\PPOSDevelopment\Trunk\API\REST\Server\response.json; line: 1, column: 15] (through reference chain: com.jda.portfolio.api.rest.base.Customer["Customer"])
Is there a difference between Jackson json and what RestEasy produces, from I think Jettison? I also took the example from User doc section 19.6.1 JSON and JAXB collections/arrays
[{"foo":{"@test":"bill"}},{"foo":{"@test":"monica}"}}] and tried to marshal that back to object form - getting the same error.
It seems like from Jackson, I would get something like:
[{"@test":"bill"},{"@test":"monica}"}] for a List<Foo> - the difference being the {foo: } which looks like a wrapper for the object.
I changed the code to return List<Customer> instead of the Response with GenericEntity including the List<Customer> but the json looks the same.
What am I doing wrong?
Are we using the Response object incorrectly? What's really the difference between returning List<Customer> vs Response with the List<Customer> in the generic entity?
I hope this is clear, but I can provide more details if needed.
|
|
From: Bill B. <bb...@re...> - 2013-09-04 13:42:50
|
Its up to you what the scope is. But ugh...there's no nice way to do this in the ClientRequest API right now. What you could use is a ClientRequestFactory: ResteasyProviderFactory factory = new ResteasyProviderFactory(); factory.register(JsonProvider.class); ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(); ClientRequestFactory requestFactory = new ClientRequestFactory(executor, factory); ClientRequest request = requestFactory.createRequest(uri); On 9/4/2013 8:55 AM, Rajshekhar AndalaPisharam wrote: > Hi Bill > > If we create/initialize your own ResteasyProviderFactory, what will be the scope of provider? Will it be request or application scope? > > As per our observation, it is application scope and which is causing problems to other clients. > > Thanks > > A.P. Rajshekhar > > ----- Original Message ----- > From: "Rajshekhar AndalaPisharam" <ran...@re...> > To: res...@li... > Sent: Wednesday, September 4, 2013 1:02:19 PM > Subject: Re: [Resteasy-users] Restricting json custom provider to a particular client > > Hi Bill > > Thanks for your suggestion. We are using Resteasy 2.3.x. We will get back to you once we check this out. > > Regards > > A.P. Rajshekhar > > -------- Original Message -------- > Subject: Re: [Resteasy-users] Restricting json custom provider to a > particular client > Date: Thu, 29 Aug 2013 09:42:27 -0400 > From: Bill Burke <bb...@re...> > To: res...@li... > > > > Not sure what you mean. Which client api are you using? Resteasy 2.3.x > or JAX-RS 2.0 in Resteasy 3.0? > > In the former, you can create/initialize your own > ResteasyProviderFactory. In the latter, this automatically happens per > Client you create. > > On 8/29/2013 9:16 AM, Rajshekhar AndalaPisharam wrote: >> Hi Bill, >> >> We are using jacksonJsonProvider to consume and produce json data in >> underscore format. >> >> However when we are trying to integrate with 3rd party systems our >> custom provider is getting called and >> causing exceptions as 3rd party does not need underscore format. >> >> Is there a way to restrict the custom provider to particular client ? >> >> Thanks >> >> A.P. Rajshekhar >> >> ------------------------------------------------------------------------------ >> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >> Discover the easy way to master current and previous Microsoft technologies >> and advance your career. Get an incredible 1,500+ hours of step-by-step >> tutorial videos with LearnDevNow. Subscribe today and save! >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&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: Rajshekhar A. <ran...@re...> - 2013-09-04 12:55:08
|
Hi Bill If we create/initialize your own ResteasyProviderFactory, what will be the scope of provider? Will it be request or application scope? As per our observation, it is application scope and which is causing problems to other clients. Thanks A.P. Rajshekhar ----- Original Message ----- From: "Rajshekhar AndalaPisharam" <ran...@re...> To: res...@li... Sent: Wednesday, September 4, 2013 1:02:19 PM Subject: Re: [Resteasy-users] Restricting json custom provider to a particular client Hi Bill Thanks for your suggestion. We are using Resteasy 2.3.x. We will get back to you once we check this out. Regards A.P. Rajshekhar -------- Original Message -------- Subject: Re: [Resteasy-users] Restricting json custom provider to a particular client Date: Thu, 29 Aug 2013 09:42:27 -0400 From: Bill Burke <bb...@re...> To: res...@li... Not sure what you mean. Which client api are you using? Resteasy 2.3.x or JAX-RS 2.0 in Resteasy 3.0? In the former, you can create/initialize your own ResteasyProviderFactory. In the latter, this automatically happens per Client you create. On 8/29/2013 9:16 AM, Rajshekhar AndalaPisharam wrote: > Hi Bill, > > We are using jacksonJsonProvider to consume and produce json data in > underscore format. > > However when we are trying to integrate with 3rd party systems our > custom provider is getting called and > causing exceptions as 3rd party does not need underscore format. > > Is there a way to restrict the custom provider to particular client ? > > Thanks > > A.P. Rajshekhar > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&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 ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Resteasy-users mailing list Res...@li... https://lists.sourceforge.net/lists/listinfo/resteasy-users |
|
From: Bill B. <bb...@re...> - 2013-09-04 12:09:51
|
Resteasy has an injection API internally, but we never exposed it. Nobody ever really asked us to. If you have a glaring need, I could add it for the next release. Bill On 9/3/2013 4:58 PM, Jakub Narloch wrote: > Hi, > > I was actually curiouse if there is a similar functionality in RESTeasy > to the Jersey InjectableProvider? The interface basically allows to > define provider for custom object injection. > > Thanks in advance, > Jakub Narloch > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&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: Rajshekhar A. <ran...@re...> - 2013-09-04 07:32:28
|
Hi Bill Thanks for your suggestion. We are using Resteasy 2.3.x. We will get back to you once we check this out. Regards A.P. Rajshekhar -------- Original Message -------- Subject: Re: [Resteasy-users] Restricting json custom provider to a particular client Date: Thu, 29 Aug 2013 09:42:27 -0400 From: Bill Burke <bb...@re...> To: res...@li... Not sure what you mean. Which client api are you using? Resteasy 2.3.x or JAX-RS 2.0 in Resteasy 3.0? In the former, you can create/initialize your own ResteasyProviderFactory. In the latter, this automatically happens per Client you create. On 8/29/2013 9:16 AM, Rajshekhar AndalaPisharam wrote: > Hi Bill, > > We are using jacksonJsonProvider to consume and produce json data in > underscore format. > > However when we are trying to integrate with 3rd party systems our > custom provider is getting called and > causing exceptions as 3rd party does not need underscore format. > > Is there a way to restrict the custom provider to particular client ? > > Thanks > > A.P. Rajshekhar > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&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 ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Resteasy-users mailing list Res...@li... https://lists.sourceforge.net/lists/listinfo/resteasy-users |
|
From: Weinan Li <l.w...@gm...> - 2013-09-04 05:48:24
|
--
Weinan Li
On Wednesday, September 4, 2013 at 4:58 AM, Jakub Narloch wrote:
> Hi,
>
> I was actually curiouse if there is a similar functionality in RESTeasy
> to the Jersey InjectableProvider?
If I didn't make any mistake, seems RESTEasy doesn't have similar functions.
RESTEasy's @Context let you inject:
javax.ws.rs.core.HttpHeaders, javax.ws.rs.core.UriInfo, javax.ws.rs.core.Request, javax.servlet.HttpServletRequest, javax.servlet.HttpServletResponse, javax.servlet.ServletConfig, javax.servlet.ServletContext, and javax.ws.rs.core.SecurityContext objects.
If you want to use something like:
public String uppercase(@Context Locale locale) { return "this is lowercase".toUppercase(locale); }
and:
@Provider
public class LocaleProvider
extends AbstractHttpContextInjectable<Locale>
implements InjectableProvider<Context, Type> {
@Override
public Injectable<E> getInjectable(ComponentContext ic, Context a, Type c) {
if (c.equals(Locale.class)) {
return this;
}
return null;
}
@Override
public ComponentScope getScope() {
return ComponentScope.PerRequest;
}
@Override
public Locale getValue(HttpContext c) {
final Locales locales = c.getRequest().getAcceptableLanguages();
if (locales.isEmpty()) {
return Locale.US;
}
return locales.get(0);
}
}
in Jersey.
I don't know how to do this in RESTEasy(I wonder if there is a way). Please blame me if there *is* a way to do this in RESTEasy and I don't know how because of my lack of knowledge :-)
> The interface basically allows to
> define provider for custom object injection.
>
> Thanks in advance,
> Jakub Narloch
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Res...@li... (mailto:Res...@li...)
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
|
|
From: Weinan Li <l.w...@gm...> - 2013-09-04 01:44:50
|
--
Weinan Li
On Wednesday, September 4, 2013 at 3:16 AM, Mukul Panwar wrote:
> Hi Wenian
>
> I also tried now the similar approach by using a Http apache client library whic is handling some internally and reusing the handshake.
>
> But I want to user resteasy client library only and some how i want to reuse that Ssl handshake.
>
> Plz suggest something about resteasy api to handle it .
Hi Mukul, I haven't looked into details of the JAX-RS 2.0 Client API . I'll do some research and give you my findings soon.
>
> Thanks
> Mukul
>
>
>
> On Sep 3, 2013, at 6:44 PM, "Weinan Li" <l.w...@gm... (mailto:l.w...@gm...)> wrote:
>
> >
> >
> > --
> > Weinan Li
> >
> >
> > On Tuesday, September 3, 2013 at 2:42 PM, Mukul Panwar wrote:
> >
> > >
> > > Hi
> > >
> > > Sorry for late reply, I am using JBoss AS provided SSL connector and my configuration as:
> > >
> > > <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
> > > <ssl name="ssl" key-alias="jbosskey" password="changeit" certificate-key-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore" verify-client="want" ca-certificate-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore"/>
> >
> >
> >
> >
> > Server side config looks fine.
> > > </connector> and when I am calling from client code look like as:
> > >
> > > void initializedCredential(){
> > >
> > > System.setProperty("javax.net.ssl.trustStore", "D:/temp/client.jks");
> > > System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
> > > // keystore has the certificates presented to the server when a server
> > > // requests one to authenticate this application to the server
> > > System.setProperty("javax.net.ssl.keyStore", "D:/temp/client.jks");
> > > System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
> > > }
> >
> >
> >
> >
> > I believe the problem is that you haven't stored the SSLContext in client so that it creates a new one(with SSL handshake) each time.
> >
> > Here are some codes that I have used before that holding the context in client side:
> >
> > private Socket clientWithCert() throws Exception {
> > SSLContext context = SSLContext.getInstance("TLS");
> > KeyStore ks = KeyStore.getInstance("jceks");
> >
> > ks.load(new FileInputStream(CLIENT_KEY_STORE), null);
> > KeyManagerFactory kf = KeyManagerFactory.getInstance("SunX509");
> > kf.init(ks, CLIENT_KEY_STORE_PASSWORD.toCharArray());
> > context.init(kf.getKeyManagers(), null, null);
> >
> > SocketFactory factory = context.getSocketFactory();
> > Socket s = factory.createSocket("localhost", 8443);
> > return s;
> > }
> >
> > With above method you have to use Socket intend of RESTEasy client api. If you reuse the context then you don't have to do a new SSL handshake with Server each time.
> >
> > I haven't looked into JAX-RS 2.0 Client API throughly so I'm not sure how it could be setup to use SSL. I'll do more research on it and give you feedback soon.
> >
> > > public <T> Object post (String url, Map obj, Class<T> class1) {initializedCredential();
> > > url = webServiceUrlUtil.getSearchClaimantURL() + url;
> > > clientRequest = new ClientRequest(url);
> > > ClientResponse<T> res = null;
> > > try {
> > > res = clientRequest.post(class1);
> > > if (res == null) {
> > > return null;
> > > }
> > > if (res != null && res.getStatus() != 200) {
> > > logger.debug("GET Response not getting correct , Status Code: "
> > > + res.getStatus());
> > > throw new RuntimeException("Failed : HTTP Webservice error : "
> > > + res.serverError());
> > > }
> > >
> > > } catch (Exception e) {
> > > // TODO Auto-generated catch block
> > > e.printStackTrace();
> > > }
> > > return res.getEntity();
> > > }
> > >
> > > Thanks
> > > Mukul
> > >
> > > -----Original Message-----
> > > From: Weinan Li [mailto:l.w...@gm...]
> > > Sent: Friday, August 30, 2013 8:12 AM
> > > To: Mukul Panwar
> > > Cc: Bill Burke; res...@li... (mailto:res...@li...)
> > > Subject: Re: [Resteasy-users] Fwd: Regarding Ssl handshake during certificate authentication on jboss
> > >
> > >
> > >
> > > --
> > > Weinan Li
> > >
> > >
> > > On Friday, August 30, 2013 at 12:20 AM, Mukul Panwar wrote:
> > >
> > > > Hi Bill
> > > >
> > > > I also tried successfully to implement certificate authentication but SsL handshake doing every time of request. Which should reuse the first handshake session. Please suggest about it.
> > >
> > > Hi Mukul, are you using the RESTEasy provided security solution (like skeleton and resteasy-crypto) or JBoss AS provided SSL connector?
> > >
> > > If you are using the SSL connection provided by JBoss AS, it could be a configuration problem. Could you please provide the configs you've used so that I could check it for you?
> > > >
> > > > Thanks
> > > > Mukul
> > > >
> > > > On Aug 29, 2013, at 7:11 PM, "Bill Burke" <bb...@re... (mailto:bb...@re...)> wrote:
> > > >
> > > > > I have used certs successfully before.
> > > > >
> > > > > On 8/29/2013 9:31 AM, Mukul Panwar wrote:
> > > > > >
> > > > > >
> > > > > > Sent from my iPhone
> > > > > >
> > > > > > Begin forwarded message:
> > > > > >
> > > > > > > *From:* <mu...@hc... <mailto:mu...@hc...>>
> > > > > > > *Date:* August 29, 2013, 7:00:06 AM GMT+05:30
> > > > > > > *To:* Bill Burke <bb...@re... <mailto:bb...@re...>>
> > > > > > > *Cc:* <res...@li... (mailto:res...@li...)
> > > > > > > <mailto:res...@li...>>
> > > > > > > *Subject:* *Regarding Ssl handshake during certificate authentication
> > > > > > > on jboss*
> > > > > > >
> > > > > > > Hi Bill
> > > > > > >
> > > > > > > I have a resteasy client and doing post request . I also set the
> > > > > > > keystore as trusted and cert key entries before sending the request.
> > > > > > >
> > > > > > > The server also having import the client key in their keystore
> > > > > > > certificate.
> > > > > > >
> > > > > > > Means we are doing Two way mutual certificate authentication .
> > > > > > >
> > > > > > > The client and server doing handshake successfully . But for each
> > > > > > > request there is a new handshake where as they should use the session
> > > > > > > of first Ssl handshake. Please suggest about or give any reference for
> > > > > > > this.
> > > > > > >
> > > > > > > Thanks
> > > > > > > Mukul
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ::DISCLAIMER::
> > > > > > ----------------------------------------------------------------------------------------------------------------------------------------------------
> > > > > >
> > > > > > The contents of this e-mail and any attachment(s) are confidential and
> > > > > > intended for the named recipient(s) only.
> > > > > > E-mail transmission is not guaranteed to be secure or error-free as
> > > > > > information could be intercepted, corrupted,
> > > > > > lost, destroyed, arrive late or incomplete, or may contain viruses in
> > > > > > transmission. The e mail and its contents
> > > > > > (with or without referred errors) shall therefore not attach any
> > > > > > liability on the originator or HCL or its affiliates.
> > > > > > Views or opinions, if any, presented in this email are solely those of
> > > > > > the author and may not necessarily reflect the
> > > > > > views or opinions of HCL or its affiliates. Any form of reproduction,
> > > > > > dissemination, copying, disclosure, modification,
> > > > > > distribution and / or publication of this message without the prior
> > > > > > written consent of authorized representative of
> > > > > > HCL is strictly prohibited. If you have received this email in error
> > > > > > please delete it and notify the sender immediately.
> > > > > > Before opening any email and/or attachments, please check them for
> > > > > > viruses and other defects.
> > > > > >
> > > > > > ----------------------------------------------------------------------------------------------------------------------------------------------------
> > > > > >
> > > > > >
> > > > > >
> > > > > > ------------------------------------------------------------------------------
> > > > > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > > > > > Discover the easy way to master current and previous Microsoft technologies
> > > > > > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > > > > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > > > > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > > > > >
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > Resteasy-users mailing list
> > > > > > Res...@li... (mailto:Res...@li...)
> > > > > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Bill Burke
> > > > > JBoss, a division of Red Hat
> > > > > http://bill.burkecentral.com
> > > > >
> > > > > ------------------------------------------------------------------------------
> > > > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > > > > Discover the easy way to master current and previous Microsoft technologies
> > > > > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > > > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > > > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > > > > _______________________________________________
> > > > > Resteasy-users mailing list
> > > > > Res...@li... (mailto:Res...@li...)
> > > > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------------------------
> > > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > > > Discover the easy way to master current and previous Microsoft technologies
> > > > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > > > _______________________________________________
> > > > Resteasy-users mailing list
> > > > Res...@li... (mailto:Res...@li...)
> > > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> > >
> >
>
|
|
From: Jakub N. <jmn...@gm...> - 2013-09-03 20:58:37
|
Hi, I was actually curiouse if there is a similar functionality in RESTeasy to the Jersey InjectableProvider? The interface basically allows to define provider for custom object injection. Thanks in advance, Jakub Narloch |
|
From: Mukul P. <mu...@hc...> - 2013-09-03 19:17:00
|
Hi Wenian
I also tried now the similar approach by using a Http apache client library whic is handling some internally and reusing the handshake.
But I want to user resteasy client library only and some how i want to reuse that Ssl handshake.
Plz suggest something about resteasy api to handle it .
Thanks
Mukul
On Sep 3, 2013, at 6:44 PM, "Weinan Li" <l.w...@gm...> wrote:
>
>
> --
> Weinan Li
>
>
> On Tuesday, September 3, 2013 at 2:42 PM, Mukul Panwar wrote:
>
>>
>> Hi
>>
>> Sorry for late reply, I am using JBoss AS provided SSL connector and my configuration as:
>>
>> <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
>> <ssl name="ssl" key-alias="jbosskey" password="changeit" certificate-key-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore" verify-client="want" ca-certificate-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore"/>
>
>
> Server side config looks fine.
>> </connector> and when I am calling from client code look like as:
>>
>> void initializedCredential(){
>>
>> System.setProperty("javax.net.ssl.trustStore", "D:/temp/client.jks");
>> System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
>> // keystore has the certificates presented to the server when a server
>> // requests one to authenticate this application to the server
>> System.setProperty("javax.net.ssl.keyStore", "D:/temp/client.jks");
>> System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
>> }
>
>
> I believe the problem is that you haven't stored the SSLContext in client so that it creates a new one(with SSL handshake) each time.
>
> Here are some codes that I have used before that holding the context in client side:
>
> private Socket clientWithCert() throws Exception {
> SSLContext context = SSLContext.getInstance("TLS");
> KeyStore ks = KeyStore.getInstance("jceks");
>
> ks.load(new FileInputStream(CLIENT_KEY_STORE), null);
> KeyManagerFactory kf = KeyManagerFactory.getInstance("SunX509");
> kf.init(ks, CLIENT_KEY_STORE_PASSWORD.toCharArray());
> context.init(kf.getKeyManagers(), null, null);
>
> SocketFactory factory = context.getSocketFactory();
> Socket s = factory.createSocket("localhost", 8443);
> return s;
> }
>
> With above method you have to use Socket intend of RESTEasy client api. If you reuse the context then you don't have to do a new SSL handshake with Server each time.
>
> I haven't looked into JAX-RS 2.0 Client API throughly so I'm not sure how it could be setup to use SSL. I'll do more research on it and give you feedback soon.
>
>> public <T> Object post (String url, Map obj, Class<T> class1) {initializedCredential();
>> url = webServiceUrlUtil.getSearchClaimantURL() + url;
>> clientRequest = new ClientRequest(url);
>> ClientResponse<T> res = null;
>> try {
>> res = clientRequest.post(class1);
>> if (res == null) {
>> return null;
>> }
>> if (res != null && res.getStatus() != 200) {
>> logger.debug("GET Response not getting correct , Status Code: "
>> + res.getStatus());
>> throw new RuntimeException("Failed : HTTP Webservice error : "
>> + res.serverError());
>> }
>>
>> } catch (Exception e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> return res.getEntity();
>> }
>>
>> Thanks
>> Mukul
>>
>> -----Original Message-----
>> From: Weinan Li [mailto:l.w...@gm...]
>> Sent: Friday, August 30, 2013 8:12 AM
>> To: Mukul Panwar
>> Cc: Bill Burke; res...@li... (mailto:res...@li...)
>> Subject: Re: [Resteasy-users] Fwd: Regarding Ssl handshake during certificate authentication on jboss
>>
>>
>>
>> --
>> Weinan Li
>>
>>
>> On Friday, August 30, 2013 at 12:20 AM, Mukul Panwar wrote:
>>
>>> Hi Bill
>>>
>>> I also tried successfully to implement certificate authentication but SsL handshake doing every time of request. Which should reuse the first handshake session. Please suggest about it.
>>
>> Hi Mukul, are you using the RESTEasy provided security solution (like skeleton and resteasy-crypto) or JBoss AS provided SSL connector?
>>
>> If you are using the SSL connection provided by JBoss AS, it could be a configuration problem. Could you please provide the configs you've used so that I could check it for you?
>>>
>>> Thanks
>>> Mukul
>>>
>>> On Aug 29, 2013, at 7:11 PM, "Bill Burke" <bb...@re... (mailto:bb...@re...)> wrote:
>>>
>>>> I have used certs successfully before.
>>>>
>>>> On 8/29/2013 9:31 AM, Mukul Panwar wrote:
>>>>>
>>>>>
>>>>> Sent from my iPhone
>>>>>
>>>>> Begin forwarded message:
>>>>>
>>>>>> *From:* <mu...@hc... <mailto:mu...@hc...>>
>>>>>> *Date:* August 29, 2013, 7:00:06 AM GMT+05:30
>>>>>> *To:* Bill Burke <bb...@re... <mailto:bb...@re...>>
>>>>>> *Cc:* <res...@li... (mailto:res...@li...)
>>>>>> <mailto:res...@li...>>
>>>>>> *Subject:* *Regarding Ssl handshake during certificate authentication
>>>>>> on jboss*
>>>>>>
>>>>>> Hi Bill
>>>>>>
>>>>>> I have a resteasy client and doing post request . I also set the
>>>>>> keystore as trusted and cert key entries before sending the request.
>>>>>>
>>>>>> The server also having import the client key in their keystore
>>>>>> certificate.
>>>>>>
>>>>>> Means we are doing Two way mutual certificate authentication .
>>>>>>
>>>>>> The client and server doing handshake successfully . But for each
>>>>>> request there is a new handshake where as they should use the session
>>>>>> of first Ssl handshake. Please suggest about or give any reference for
>>>>>> this.
>>>>>>
>>>>>> Thanks
>>>>>> Mukul
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ::DISCLAIMER::
>>>>> ----------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>
>>>>> The contents of this e-mail and any attachment(s) are confidential and
>>>>> intended for the named recipient(s) only.
>>>>> E-mail transmission is not guaranteed to be secure or error-free as
>>>>> information could be intercepted, corrupted,
>>>>> lost, destroyed, arrive late or incomplete, or may contain viruses in
>>>>> transmission. The e mail and its contents
>>>>> (with or without referred errors) shall therefore not attach any
>>>>> liability on the originator or HCL or its affiliates.
>>>>> Views or opinions, if any, presented in this email are solely those of
>>>>> the author and may not necessarily reflect the
>>>>> views or opinions of HCL or its affiliates. Any form of reproduction,
>>>>> dissemination, copying, disclosure, modification,
>>>>> distribution and / or publication of this message without the prior
>>>>> written consent of authorized representative of
>>>>> HCL is strictly prohibited. If you have received this email in error
>>>>> please delete it and notify the sender immediately.
>>>>> Before opening any email and/or attachments, please check them for
>>>>> viruses and other defects.
>>>>>
>>>>> ----------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>>>>> Discover the easy way to master current and previous Microsoft technologies
>>>>> and advance your career. Get an incredible 1,500+ hours of step-by-step
>>>>> tutorial videos with LearnDevNow. Subscribe today and save!
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Resteasy-users mailing list
>>>>> Res...@li... (mailto:Res...@li...)
>>>>> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Bill Burke
>>>> JBoss, a division of Red Hat
>>>> http://bill.burkecentral.com
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>>>> Discover the easy way to master current and previous Microsoft technologies
>>>> and advance your career. Get an incredible 1,500+ hours of step-by-step
>>>> tutorial videos with LearnDevNow. Subscribe today and save!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
>>>> _______________________________________________
>>>> Resteasy-users mailing list
>>>> Res...@li... (mailto:Res...@li...)
>>>> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>>> Discover the easy way to master current and previous Microsoft technologies
>>> and advance your career. Get an incredible 1,500+ hours of step-by-step
>>> tutorial videos with LearnDevNow. Subscribe today and save!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Resteasy-users mailing list
>>> Res...@li... (mailto:Res...@li...)
>>> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
>
>
|
|
From: Weinan Li <l.w...@gm...> - 2013-09-03 13:14:52
|
--
Weinan Li
On Tuesday, September 3, 2013 at 2:42 PM, Mukul Panwar wrote:
>
> Hi
>
> Sorry for late reply, I am using JBoss AS provided SSL connector and my configuration as:
>
> <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
> <ssl name="ssl" key-alias="jbosskey" password="changeit" certificate-key-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore" verify-client="want" ca-certificate-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore"/>
Server side config looks fine.
> </connector> and when I am calling from client code look like as:
>
> void initializedCredential(){
>
> System.setProperty("javax.net.ssl.trustStore", "D:/temp/client.jks");
> System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
> // keystore has the certificates presented to the server when a server
> // requests one to authenticate this application to the server
> System.setProperty("javax.net.ssl.keyStore", "D:/temp/client.jks");
> System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
> }
>
I believe the problem is that you haven't stored the SSLContext in client so that it creates a new one(with SSL handshake) each time.
Here are some codes that I have used before that holding the context in client side:
private Socket clientWithCert() throws Exception {
SSLContext context = SSLContext.getInstance("TLS");
KeyStore ks = KeyStore.getInstance("jceks");
ks.load(new FileInputStream(CLIENT_KEY_STORE), null);
KeyManagerFactory kf = KeyManagerFactory.getInstance("SunX509");
kf.init(ks, CLIENT_KEY_STORE_PASSWORD.toCharArray());
context.init(kf.getKeyManagers(), null, null);
SocketFactory factory = context.getSocketFactory();
Socket s = factory.createSocket("localhost", 8443);
return s;
}
With above method you have to use Socket intend of RESTEasy client api. If you reuse the context then you don't have to do a new SSL handshake with Server each time.
I haven't looked into JAX-RS 2.0 Client API throughly so I'm not sure how it could be setup to use SSL. I'll do more research on it and give you feedback soon.
> public <T> Object post (String url, Map obj, Class<T> class1) {initializedCredential();
> url = webServiceUrlUtil.getSearchClaimantURL() + url;
> clientRequest = new ClientRequest(url);
> ClientResponse<T> res = null;
> try {
> res = clientRequest.post(class1);
> if (res == null) {
> return null;
> }
> if (res != null && res.getStatus() != 200) {
> logger.debug("GET Response not getting correct , Status Code: "
> + res.getStatus());
> throw new RuntimeException("Failed : HTTP Webservice error : "
> + res.serverError());
> }
>
> } catch (Exception e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> return res.getEntity();
> }
>
> Thanks
> Mukul
>
> -----Original Message-----
> From: Weinan Li [mailto:l.w...@gm...]
> Sent: Friday, August 30, 2013 8:12 AM
> To: Mukul Panwar
> Cc: Bill Burke; res...@li... (mailto:res...@li...)
> Subject: Re: [Resteasy-users] Fwd: Regarding Ssl handshake during certificate authentication on jboss
>
>
>
> --
> Weinan Li
>
>
> On Friday, August 30, 2013 at 12:20 AM, Mukul Panwar wrote:
>
> > Hi Bill
> >
> > I also tried successfully to implement certificate authentication but SsL handshake doing every time of request. Which should reuse the first handshake session. Please suggest about it.
>
> Hi Mukul, are you using the RESTEasy provided security solution (like skeleton and resteasy-crypto) or JBoss AS provided SSL connector?
>
> If you are using the SSL connection provided by JBoss AS, it could be a configuration problem. Could you please provide the configs you've used so that I could check it for you?
> >
> > Thanks
> > Mukul
> >
> > On Aug 29, 2013, at 7:11 PM, "Bill Burke" <bb...@re... (mailto:bb...@re...)> wrote:
> >
> > > I have used certs successfully before.
> > >
> > > On 8/29/2013 9:31 AM, Mukul Panwar wrote:
> > > >
> > > >
> > > > Sent from my iPhone
> > > >
> > > > Begin forwarded message:
> > > >
> > > > > *From:* <mu...@hc... <mailto:mu...@hc...>>
> > > > > *Date:* August 29, 2013, 7:00:06 AM GMT+05:30
> > > > > *To:* Bill Burke <bb...@re... <mailto:bb...@re...>>
> > > > > *Cc:* <res...@li... (mailto:res...@li...)
> > > > > <mailto:res...@li...>>
> > > > > *Subject:* *Regarding Ssl handshake during certificate authentication
> > > > > on jboss*
> > > > >
> > > > > Hi Bill
> > > > >
> > > > > I have a resteasy client and doing post request . I also set the
> > > > > keystore as trusted and cert key entries before sending the request.
> > > > >
> > > > > The server also having import the client key in their keystore
> > > > > certificate.
> > > > >
> > > > > Means we are doing Two way mutual certificate authentication .
> > > > >
> > > > > The client and server doing handshake successfully . But for each
> > > > > request there is a new handshake where as they should use the session
> > > > > of first Ssl handshake. Please suggest about or give any reference for
> > > > > this.
> > > > >
> > > > > Thanks
> > > > > Mukul
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ::DISCLAIMER::
> > > > ----------------------------------------------------------------------------------------------------------------------------------------------------
> > > >
> > > > The contents of this e-mail and any attachment(s) are confidential and
> > > > intended for the named recipient(s) only.
> > > > E-mail transmission is not guaranteed to be secure or error-free as
> > > > information could be intercepted, corrupted,
> > > > lost, destroyed, arrive late or incomplete, or may contain viruses in
> > > > transmission. The e mail and its contents
> > > > (with or without referred errors) shall therefore not attach any
> > > > liability on the originator or HCL or its affiliates.
> > > > Views or opinions, if any, presented in this email are solely those of
> > > > the author and may not necessarily reflect the
> > > > views or opinions of HCL or its affiliates. Any form of reproduction,
> > > > dissemination, copying, disclosure, modification,
> > > > distribution and / or publication of this message without the prior
> > > > written consent of authorized representative of
> > > > HCL is strictly prohibited. If you have received this email in error
> > > > please delete it and notify the sender immediately.
> > > > Before opening any email and/or attachments, please check them for
> > > > viruses and other defects.
> > > >
> > > > ----------------------------------------------------------------------------------------------------------------------------------------------------
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------------------------
> > > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > > > Discover the easy way to master current and previous Microsoft technologies
> > > > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Resteasy-users mailing list
> > > > Res...@li... (mailto:Res...@li...)
> > > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Bill Burke
> > > JBoss, a division of Red Hat
> > > http://bill.burkecentral.com
> > >
> > > ------------------------------------------------------------------------------
> > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > > Discover the easy way to master current and previous Microsoft technologies
> > > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > > _______________________________________________
> > > Resteasy-users mailing list
> > > Res...@li... (mailto:Res...@li...)
> > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > Discover the easy way to master current and previous Microsoft technologies
> > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > tutorial videos with LearnDevNow. Subscribe today and save!
> > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Resteasy-users mailing list
> > Res...@li... (mailto:Res...@li...)
> > https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
|
|
From: Mukul P. <mu...@hc...> - 2013-09-03 06:42:58
|
Hi
Sorry for late reply, I am using JBoss AS provided SSL connector and my configuration as:
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl name="ssl" key-alias="jbosskey" password="changeit" certificate-key-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore" verify-client="want" ca-certificate-file="D:/Software/server/jboss-as-7.1.1.Final/standalone/configuration/server.keystore"/>
</connector> and when I am calling from client code look like as:
void initializedCredential(){
System.setProperty("javax.net.ssl.trustStore", "D:/temp/client.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
// keystore has the certificates presented to the server when a server
// requests one to authenticate this application to the server
System.setProperty("javax.net.ssl.keyStore", "D:/temp/client.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
}
public <T> Object post (String url, Map obj, Class<T> class1) {
initializedCredential();
url = webServiceUrlUtil.getSearchClaimantURL() + url;
clientRequest = new ClientRequest(url);
ClientResponse<T> res = null;
try {
res = clientRequest.post(class1);
if (res == null) {
return null;
}
if (res != null && res.getStatus() != 200) {
logger.debug("GET Response not getting correct , Status Code: "
+ res.getStatus());
throw new RuntimeException("Failed : HTTP Webservice error : "
+ res.serverError());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return res.getEntity();
}
Thanks
Mukul
-----Original Message-----
From: Weinan Li [mailto:l.w...@gm...]
Sent: Friday, August 30, 2013 8:12 AM
To: Mukul Panwar
Cc: Bill Burke; res...@li...
Subject: Re: [Resteasy-users] Fwd: Regarding Ssl handshake during certificate authentication on jboss
--
Weinan Li
On Friday, August 30, 2013 at 12:20 AM, Mukul Panwar wrote:
> Hi Bill
>
> I also tried successfully to implement certificate authentication but SsL handshake doing every time of request. Which should reuse the first handshake session. Please suggest about it.
Hi Mukul, are you using the RESTEasy provided security solution (like skeleton and resteasy-crypto) or JBoss AS provided SSL connector?
If you are using the SSL connection provided by JBoss AS, it could be a configuration problem. Could you please provide the configs you've used so that I could check it for you?
>
> Thanks
> Mukul
>
> On Aug 29, 2013, at 7:11 PM, "Bill Burke" <bb...@re... (mailto:bb...@re...)> wrote:
>
> > I have used certs successfully before.
> >
> > On 8/29/2013 9:31 AM, Mukul Panwar wrote:
> > >
> > >
> > > Sent from my iPhone
> > >
> > > Begin forwarded message:
> > >
> > > > *From:* <mu...@hc... <mailto:mu...@hc...>>
> > > > *Date:* August 29, 2013, 7:00:06 AM GMT+05:30
> > > > *To:* Bill Burke <bb...@re... <mailto:bb...@re...>>
> > > > *Cc:* <res...@li... (mailto:res...@li...)
> > > > <mailto:res...@li...>>
> > > > *Subject:* *Regarding Ssl handshake during certificate authentication
> > > > on jboss*
> > > >
> > > > Hi Bill
> > > >
> > > > I have a resteasy client and doing post request . I also set the
> > > > keystore as trusted and cert key entries before sending the request.
> > > >
> > > > The server also having import the client key in their keystore
> > > > certificate.
> > > >
> > > > Means we are doing Two way mutual certificate authentication .
> > > >
> > > > The client and server doing handshake successfully . But for each
> > > > request there is a new handshake where as they should use the session
> > > > of first Ssl handshake. Please suggest about or give any reference for
> > > > this.
> > > >
> > > > Thanks
> > > > Mukul
> > >
> > >
> > >
> > >
> > >
> > > ::DISCLAIMER::
> > > ----------------------------------------------------------------------------------------------------------------------------------------------------
> > >
> > > The contents of this e-mail and any attachment(s) are confidential and
> > > intended for the named recipient(s) only.
> > > E-mail transmission is not guaranteed to be secure or error-free as
> > > information could be intercepted, corrupted,
> > > lost, destroyed, arrive late or incomplete, or may contain viruses in
> > > transmission. The e mail and its contents
> > > (with or without referred errors) shall therefore not attach any
> > > liability on the originator or HCL or its affiliates.
> > > Views or opinions, if any, presented in this email are solely those of
> > > the author and may not necessarily reflect the
> > > views or opinions of HCL or its affiliates. Any form of reproduction,
> > > dissemination, copying, disclosure, modification,
> > > distribution and / or publication of this message without the prior
> > > written consent of authorized representative of
> > > HCL is strictly prohibited. If you have received this email in error
> > > please delete it and notify the sender immediately.
> > > Before opening any email and/or attachments, please check them for
> > > viruses and other defects.
> > >
> > > ----------------------------------------------------------------------------------------------------------------------------------------------------
> > >
> > >
> > >
> > > ------------------------------------------------------------------------------
> > > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > > Discover the easy way to master current and previous Microsoft technologies
> > > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > > tutorial videos with LearnDevNow. Subscribe today and save!
> > > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > >
> > >
> > >
> > > _______________________________________________
> > > Resteasy-users mailing list
> > > Res...@li... (mailto:Res...@li...)
> > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> >
> >
> >
> > --
> > Bill Burke
> > JBoss, a division of Red Hat
> > http://bill.burkecentral.com
> >
> > ------------------------------------------------------------------------------
> > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> > Discover the easy way to master current and previous Microsoft technologies
> > and advance your career. Get an incredible 1,500+ hours of step-by-step
> > tutorial videos with LearnDevNow. Subscribe today and save!
> > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Resteasy-users mailing list
> > Res...@li... (mailto:Res...@li...)
> > https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
>
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Res...@li... (mailto:Res...@li...)
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
|