mime « jersey « Java Enterprise Q&A





1. Beyond the @Produces annotation, how does Jersey (JAX-RS) know to treat a POJO as a specific mime type?    stackoverflow.com

I see a lot of examples for Jersey that look something like this:

public class ItemResource {

    @GET
    @Path("/items")
    @Produces({"text/xml", "application/json"})
   ...

2. Protocol Buffers MIME problem    stackoverflow.com

Help! Trying to implement Protocol Buffers via Rest (Jersey), but get this exception.

class com.util.ProtobufMessageBodyReader
class com.util.ProtobufMessageBodyWriter
Jul 6, 2010 3:43:37 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-9102
Jul 6, 2010 3:43:37 PM org.apache.catalina.startup.Catalina start
INFO: ...

3. JAX-RS (Jersey) custom exception with XML or JSON    stackoverflow.com

I have a REST service built using Jersey. I want to be able to set the MIME of my custom exception writers depending on the MIME that was sent to the server. ...

4. How to get mime type of uploaded file in Jersey    stackoverflow.com

Hey guys, I have a standard upload endpoint in Jersey:

@POST
@Secure
@Consumes("multipart/form-data")
public Response upload( @Context final HttpHeaders hh,
            @FormDataParam("fileaaa") final FormDataContentDisposition disposition,
  ...

5. Jersey client API WebResource accept() not setting MIME header correctly?    stackoverflow.com

public static WebResource createWebResource()
{
    final ClientConfig  cc = new DefaultClientConfig();
    final Client        c = Client.create(cc);
   ...

6. How to get a Map parameter in a REST service for different mime types?    stackoverflow.com

How can I specify a map as one of the parameters of a REST service e.g

@Path("/servicepath")
@Consumes(MediaType.APPLICATION_XML)
public class MyResource {
    @POST
    public Response getMap(Map<String, List<Object>>) {
 ...

7. A message body writer for Java type, class myPackage.B, and MIME media type, application/octet-stream, was not found    stackoverflow.com

I am new at RESTful webservices and was trying to update my @OneToMany relationship from a standalone client application but I am not able to do that. I am using Jersey ...

8. Can a client request a specific response MIME type from a Jersey service in the URL?    stackoverflow.com

I have a Jersey REST service which has endpoints that can return either application/xml or application/json depending on the Accept header. Client applications can certainly set this header and everything works ...