jersey

JAXB Jersey annotated classes in a separate jar file on the classpath

I have domain model classes with jaxb annotations in a core jar package. Then I have another service web project that has a dependency on the other core jar, and uses jersey. When I move the domain model classes directly in the services project jaxb correctly finds the annotated classes. When I move them back in the jar, its unable t...

Deploying Jersey-enabled servlet to Tomcat: Exceptions.

Hey guys, Here is what I'm trying to do: we are switching over to using JAXB and Jersey for all our REST services and XML/JSON serialization needs. So far, I have been able to get a simple test working where some beans are annotated, some test objects created and these are perfectly serialized to either XML or JSON and return to the c...

Jersey JAXB problem

Hi, I'm trying to use the best practices of rest notes in the following article regarding the connectedness http://www.infoq.com/articles/rest-introduction <order self='customers/1234' > 23 but I can not implement it. if I use the @XmlElement on product object which is an inner object of order class, All of the product f...

Connection between jsp file and resource class

My example is using the ImplicitViewable configuration feature (see WEB-INF/web.xml) and implicit viewables approach, where the JSP pages are mapped via being placed at the right path corresponding to the appropriate resource package name. It doesn't work. What should I do as an extra? if ${it.name} is written into jsp file also resour...

Getting JSON from Jersey with circular dependencies

Hi I am writing a service that uses Jersey and JAXB. My classes are annotated with @XMLRootElement, @XMLElement, etc. I have a circular dependency between two classes, so I have annotated the circular dependent property with @XMLTransient. So when I call my service I get xml as the default, which works perfectly. However, when I try usi...

Using filters with Grizzly server running a Jersey REST service

I'm trying to use Grizzly to create a server to run a REST service that I've developed using Jersey. I'm creating the Grizzly server using: final String baseUri = "http://localhost:9998/"; final Map<String, String> initParams = new HashMap<String, String>(); initParams.put("com.sun.jersey.config.property.packages", "me.my.rest.package")...

What is the best way to "fake" DELETE and PUT methods using JAX-RS?

I've just started to use Jersey to create a RESTful API for my site. Its a wonderful change from having to roll my own support for RESTful services in Java. One thing I just can't seem to figure out is how to "fake" a DELETE and PUT method. Jersey supports the annotations @PUT and @DELETE, however many Load-Balancers will not allow th...

Easiest frameworks to implement Java REST web services

What are the best frameworks for implementing both client and server REST frameworks in Java? I've been struggling a little to find an easy to use solution. Update: Both Jersey and Restlet seem like good options. We'll probably use Restlet but we'll experiment with both. ...

How to Use Grizzly Embedded Server for Mule as Well as Jersey

I'm currently using JerseyTest w/ Grizzly embedded server to test some code. I do some very simple configuration to point it to the proper resources: Map<String, String> initParams = new HashMap<String, String>(); initParams.put("com.sun.jersey.config.property.packages", "com.sample.service"); ApplicationDescriptor appDescriptor = new A...

JAXB and multiple object relationships

We are using Jersey (Java REST library) for a project for the last few months and loving it. But this week have run into an issue with JAXB. What I have is an element that has 2 children, each of them have children where some of their children reference each other. Let me show some code. Root root = new Root(); Parent parent1 = ne...

JAXB Collections (List<T>) Use Pascal Case instead of Camel Case for Element Names

Hi All, I have a number of JAXB beans that are directly marshalled and unmarshalled using Jersey. E.g. @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Artifact", propOrder = { "artifactId", "artifactType", "contentHash" }) @XmlSeeAlso({ EmailArtifact.class, ManagedDocArtifact.class }) @XmlRootElement(name ="...

Send file with REST?

Do Java REST frameworks like Restlet and Jersey allow one to send a file as input to a web service? This would encompass the client sending the file and the server then receiving and processing the file. ...

Consuming JSON object in Jersey service

I've been Googling my butt off trying to find out how to do this: I have a Jersey REST service. The request that invokes the REST service contains a JSON object. My question is, from the Jersey POST method implementation, how can I get access to the JSON that is in the body of the HTTP request? Any tips, tricks, pointers to sample code ...

Using JaaS with Jersey on Grizzly

I'm trying to find a simple, flexible way to add JaaS authentication to REST. I found a post that I think leads me in the right direction (See StevenC's answer). It sounds like the servlet container is responsible for security, not the Jersey code itself. I like this idea, but need a little guidance on implementation. Grizzly is my s...

Which is the best Java REST API - Restlet or Jersey?

Which REST API do you prefer - Jersey or Restlet? This would encompass both the client and server API-s. We really need to just pick one and kick the tires around but I was curious what the community thinks. Restlet seems simpler and better documented to me. I've had a hard time even finding decent documentation about the Jersey clie...

Howto automate documentation of a REST API (Jersey Implementation)

Hey guys, I have written a pretty extensive REST API using Java Jersey (and JAXB). I have also written the documentation using a Wiki, but its been a totally manual process, which is very error-prone, especially when we need to make modifications, people tend to forget to update the wiki. From looking around, most other REST API's are ...

HTTP 303 redirect is not working for my browsers

My jersey resource is sending this to the client browsers namely (safari & chrome) but the browsers are not redirecting. Is there anything wrong with my HTTP response below ? HTTP/1.1 303 See Other Date: Thu, 12 Nov 2009 10:17:23 GMT Location: http://twitter.com/oauth/authenticate?oauth_token=KNHo4mcLMJG Content-Length: 0 Server: Jetty(...

How to get full REST request body using Jersey?

How can one get the full HTTP REST request body for a POST request using Jersey? In our case the data will be XML. Size would vary from 1K to 1MB. The docs seem to indicate you should use MessageBodyReader but I can't see any examples. ...

jersey Viewable and c:import tag lib

Giver a resource class that has a method witch returns a Viewable (or generaly any jsp page). Is there a way to use the c:import or jsp:include taglib to include a Viewable response from a jaxrs anotatted class? For example given the class @Path("/some/path") public class SomeJaxrsResource { @GET public Viewable get() { return n...

Getting Jersey and Hibernate to work together?

I've got a project which requires both Jersey and Hibernate. Problem is they both use incompatible versions of a Jar file (asm.jar) under the covers. I've looked around Google and it appears that it's possible to get Hibernate to use another facility called Javassist, but when I try to follow the instructions it falls flat. I still get ...