Re: [Resteasy-users] Performance issue resteasy+s-ramp

2014-06-13 Thread Eric Wittmann
Sure thing:

https://issues.jboss.org/browse/RESTEASY-1074

I'm not sure about timeframe.  I have a workaround (see the jira for 
details) that should be sufficient unless running with a security 
manager.  The impact on our app is relatively low, as "any other jaxb 
object" is not used in the context of a Feed in too many use cases.

Also, you might have us confused with someone else - we're definitely 
not using Jersey.  :)

-Eric

On 6/13/2014 10:26 AM, Bill Burke wrote:
> So, it should use the jaxb context cache.
>
> Log a jira?  Timeframe for fix?  I promised Mark I'd meet any of your
> requirements so you could get off of Jersey.
>
> On 6/13/2014 10:12 AM, Eric Wittmann wrote:
>> We're using RE to provide the Atom API in our jboss overlord s-ramp
>> implementation.  Something we've run into is a performance problem
>> iterating over certain Atom Feeds.  In some circumstances each Entry in
>> the atom Feed can wrap an additional jaxb object.  We get access to this
>> via Entry's getAnyOtherJAXBObject.
>>
>> This all works great except that there is no JAXBContextFinder set on
>> the Entry, so a new JAXBContext is created for each Entry.
>>
>> I think the root of this problem is here:
>>
>> https://github.com/resteasy/Resteasy/blob/master/jaxrs/providers/resteasy-atom/src/main/java/org/jboss/resteasy/plugins/providers/atom/AtomFeedProvider.java#L65-L68
>>
>> Perhaps the finder should be set on the Entry either in all cases or
>> maybe only when Entry:getAnyOtherElement() returns a non-null?
>>
>> -Eric
>>
>> --
>> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
>> Find What Matters Most in Your Big Data with HPCC Systems
>> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
>> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
>> http://p.sf.net/sfu/hpccsystems
>> ___
>> Resteasy-users mailing list
>> Resteasy-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>>
>

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users


[Resteasy-users] Performance issue resteasy+s-ramp

2014-06-13 Thread Eric Wittmann
We're using RE to provide the Atom API in our jboss overlord s-ramp 
implementation.  Something we've run into is a performance problem 
iterating over certain Atom Feeds.  In some circumstances each Entry in 
the atom Feed can wrap an additional jaxb object.  We get access to this 
via Entry's getAnyOtherJAXBObject.

This all works great except that there is no JAXBContextFinder set on 
the Entry, so a new JAXBContext is created for each Entry.

I think the root of this problem is here:

https://github.com/resteasy/Resteasy/blob/master/jaxrs/providers/resteasy-atom/src/main/java/org/jboss/resteasy/plugins/providers/atom/AtomFeedProvider.java#L65-L68

Perhaps the finder should be set on the Entry either in all cases or 
maybe only when Entry:getAnyOtherElement() returns a non-null?

-Eric

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users


Re: [Resteasy-users] RESTEasy Client in OSGi Environment

2014-05-27 Thread Eric Wittmann
I think I can confirm that this is the problem.  We ran into this same 
issue when using the RE client in Fuse (also an OSGi environment).  It 
is not possible to export META-INF/* resources in an OSGi bundle.  This 
makes java ServiceLoader useless as a dynamic service discovery 
mechanism.  As a workaround we had to add the RE client's Providers spec 
file to our own WAR:

https://github.com/Governance/s-ramp/tree/master/s-ramp-ui/s-ramp-ui-war-fuse61/src/main/resources/META-INF/services

It's not ideal, but it's the only way we could get it working without 
modifying RE to support OSGi.

For the record, the latter wouldn't be too hard - but would likely 
require that RE look for providers in both 
META-INF/services/javax.ws.rs.ext.Providers as well as the OSGi Service 
Registry.

-Eric

On 5/23/2014 10:57 AM, Bill Burke wrote:
> I know nothing about OSGi.
>
> My guess is that Resteasy automatic provider lookup is not working.  The
> way it works is that it does a
> Classloader.getResources("META-INF/javax.ws.rs.ext.Providers") and
> iterates througha nd loads all those files.  Those files contain Java
> class names which represent the providers.
>
> On 5/23/2014 9:26 AM, Rohrberg, Timo wrote:
>> Hello everybody,
>>
>> I am currently trying to use the RESTEasy client framework within an
>> OSGi environment (Eclipse Equinox). To provide the required
>> dependencies, I created a separate Eclipse Plug-In containing the
>> required JAR libraries and exporting the contained packages to
>> downstream bundles. Then, I am using the RESTEasy client framework as
>> follows within my main bundle which includes the before mentioned bundle
>> as required bundle:
>>
>> ResteasyClient client = *new*ResteasyClientBuilder().build();
>>
>> ResteasyWebTarget target = client
>>
>> .target(
>> _"http://192.168.100.181:5952/RXT_RESTWebService-2.1/jobtemplates/Vitaphone
>> 300 BT/386340"_);
>>
>> RxtDevice device = target.request().get( RxtDevice.*class*);
>>
>> System./out/.println( device.getId() );
>>
>> Unfortunately, I always get the following error:
>>
>> _javax.ws.rs.client.ResponseProcessingException_:
>> _javax.ws.rs.ProcessingException_: Unable to find a MessageBodyReader of
>> content-type application/xml and type class
>> com.vitasystems.remosxt.rest.client.model.RxtDevice
>>
>> at
>> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(_ClientInvocation.java:140_)
>>
>> at
>> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(_ClientInvocation.java:444_)
>>
>> at
>> org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.get(_ClientInvocationBuilder.java:165_)
>>
>> at
>> de.vitasystems.example.resteasy.client.Activator.start(_Activator.java:25_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(_BundleContextImpl.java:711_)
>>
>> at java.security.AccessController.doPrivileged(_Native Method_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(_BundleContextImpl.java:702_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(_BundleContextImpl.java:683_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(_BundleHost.java:381_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(_AbstractBundle.java:390_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(_Framework.java:1176_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(_StartLevelManager.java:559_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(_StartLevelManager.java:544_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(_StartLevelManager.java:457_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(_StartLevelManager.java:243_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(_StartLevelManager.java:438_)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(_StartLevelManager.java:1_)
>>
>> at
>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(_EventManager.java:230_)
>>
>> at
>> org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(_EventManager.java:340_)
>>
>> Caused by: _javax.ws.rs.ProcessingException_: Unable to find a
>> MessageBodyReader of content-type application/xml and type class
>> com.vitasystems.remosxt.rest.client.model.RxtDevice
>>
>> at
>> org.jboss.resteasy.core.interception.ClientReaderInterceptorContext.throwReaderNotFound(_ClientReaderInterceptorContext.java:39_)
>>
>> at
>> org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getReader(_AbstractReaderInterceptorContext.java:73_)
>>
>> at
>> org.jboss.resteasy.core.in

Re: [Resteasy-users] Multipart Form Data + multi-value part

2013-01-11 Thread Eric Wittmann
Thanks!  On the server-side that's great.  I'll use:

input.getFormDataMap().get("propertyName");

Is there an analog on the client side?  Looking at the 
MultipartFormDataOutput version of getFormData(), it's a map of name to 
OutputPart (rather than List).

As to what I'm trying to do - I'm implementing the OASIS S-RAMP 
specification, which has an Atom based API binding.  The specification 
stipulates the 'propertyNames' input as a list of values, passed via 
multipart/form-data.

-Eric


On 01/10/2013 05:21 PM, Bill Burke wrote:
>
>
> On 1/10/2013 9:41 AM, Eric Wittmann wrote:
>> Greetings.
>>
>> I am trying to get a multi-value input part working in my resteasy
>> service.  On the inbound side, I'm expecting a multipart/formdata post,
>> where an input part named "propertyName" may appear multiple times.  I
>> need to read that in as a Collection of some sort.  Some sample code
>> that may or may not be right:
>>
>> @POST
>> @Consumes(MediaType.MULTIPART_FORM_DATA)
>> @Produces(MediaType.APPLICATION_ATOM_XML_FEED)
>> public Feed queryFromPost(MultipartFormDataInput input) {
>>  String query = input.getFormDataPart("query",
>>new GenericType() { });
>>  Set propNames = input.getFormDataPart("propertyName",
>>new GenericType>() { });
>>  return doQuery(query, propNames);
>> }
>>
>
> qyer is right, propNames is wrong.
>
> You'll have to do
>
> List propNames = input.getFormDataMap().get("propertyName");
>
>> I'm also using resteasy on the client-side.  Not sure how to submit the
>> POST with multiple values.  Currently I have:
>>
>>  String url = ...
>>  String query = ...
>>  Set propertyNames = ...
>>  ClientRequest request = new ClientRequest(url);
>>  MultipartFormDataOutput formData = new MultipartFormDataOutput();
>>  formData.addFormData("query", query, MediaType.TEXT_PLAIN_TYPE);
>>  formData.addFormData("propertyName", propertyNames,
>>MediaType.TEXT_PLAIN_TYPE);
>
> The above will try to marshal a Set into TEXT_PLAIN, which will
> call Set.toString().
>
>>  request.body(MediaType.MULTIPART_FORM_DATA_TYPE, formData);
>>  ClientResponse response = request.post(Feed.class);
>>
>> Clearly this isn't right.  Any thoughts on how this should be done?
>>
>
> I'm not exactly sure what you're trying to do?  Why not just create your
> own json or XML media type and send that?  What are you using multipart?
>

--
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users


[Resteasy-users] Multipart Form Data + multi-value part

2013-01-10 Thread Eric Wittmann
Greetings.

I am trying to get a multi-value input part working in my resteasy 
service.  On the inbound side, I'm expecting a multipart/formdata post, 
where an input part named "propertyName" may appear multiple times.  I 
need to read that in as a Collection of some sort.  Some sample code 
that may or may not be right:

@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_ATOM_XML_FEED)
public Feed queryFromPost(MultipartFormDataInput input) {
   String query = input.getFormDataPart("query",
 new GenericType() { });
   Set propNames = input.getFormDataPart("propertyName",
 new GenericType>() { });
   return doQuery(query, propNames);
}

I'm also using resteasy on the client-side.  Not sure how to submit the 
POST with multiple values.  Currently I have:

   String url = ...
   String query = ...
   Set propertyNames = ...
   ClientRequest request = new ClientRequest(url);
   MultipartFormDataOutput formData = new MultipartFormDataOutput();
   formData.addFormData("query", query, MediaType.TEXT_PLAIN_TYPE);
   formData.addFormData("propertyName", propertyNames,
 MediaType.TEXT_PLAIN_TYPE);
   request.body(MediaType.MULTIPART_FORM_DATA_TYPE, formData);
   ClientResponse response = request.post(Feed.class);

Clearly this isn't right.  Any thoughts on how this should be done?

Thanks!

-Eric

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users