request « jersey « Java Enterprise Q&A





1. How to get full REST request body using Jersey?    stackoverflow.com

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 ...

2. Multiple return type in Jersey Client request    stackoverflow.com

I'm using Jersey Client API in the following way :-

User user = webRsrc.accept(MediaType.APPLICATION_XML).post(User.class, usr);
So I'm expecting the response in object of User class which is a JAXB annotated class. However, at times ...

3. Can a Jersey GET request return a polymorphic entity?    stackoverflow.com

I've got a Resource class that attempts to return an interface type, say "Shape":

public interface Shape {...}

@XmlRootElement
public class Circle implements Shape {...}

@Path("/api/shapes")
public class ShapeResource {
    @GET
   ...

4. How should I mock Jersey HTTP-client requests?    stackoverflow.com

This is the class I'm trying to test (it calculates the size of HTTP page):

import javax.ws.rs.core.MediaType;
import com.sun.jersey.api.client.*;
public class Loader {
  private Client client;
  public Loader(Client c) {
   ...

5. Can I wrap all JAX-RS requests with custom pre-dispatch, post-dispatch and error-handler code?    stackoverflow.com

I have a number of classes exposed as JAX-RS request "handlers", using javax.ws.rs.Path annotations. I want to add certain actions before every request and after each request. Also, I need to ...

6. Get an OuputStream to a request body using Jersey Client?    stackoverflow.com

I wan't to post a CSV file to a web service using the Jersey Client without having to buffer the csv content in memory. So I started of with some code similar ...

7. How to route JAX-RS request conditionally, depending on the suffix?    stackoverflow.com

This is what I'm trying to do:

@Path("/finder")
public class Finder {
  @Path("/{name}")
  public Proxy find(@PathParam("name") String name) {
    Object found = /* some object found by name ...

8. How does one intercept a request during the Jersey lifecycle?    stackoverflow.com

I've used Jersey for the better part of a year now and have just stumbled upon a problem to which I can't find the answer: how do you intercept (or hook ...

9. Get the Domain that an Ajax Request is coming from    stackoverflow.com

I have a set of JSONP Web Service created on my J2EE application, which will be used by a website under a different domain. The web services have been created using ...





10. How do I access the HTTP request?    stackoverflow.com

Say normally I have a rest method in java

@POST 
    @Path("/test")
    @Produces(MediaType.APPLICATION_JSON)
    public String showTime(@FormParam("username") String userName) {

:
:
:
}
which is fine, however I'm ...

11. How can I programatically reigster request methods (GET/POST/PUT) in Jersey, without using annotations?    stackoverflow.com

The question is in the title. Thanks for responding.

12. Content-Length-Header not set in Jersey Client request    stackoverflow.com

I'm using Jersey Client to access a webservice, like this:
response = r.accept(MediaType.TEXT_PLAIN_TYPE).header("content-length", 0).post(String.class);
where r is a WebResource However, the Webservice returns 411 - Content-Length is missing. using tcpdump, i found out that ...

13. Jersey REST WS - request body UTF-8    stackoverflow.com

I have simple Jersey REST webServices:

@POST
@Path("/label")
@Consumes(MediaType.TEXT_HTML)      
public Response setLabels(String requestBody) { 
    System.out.println(requestBody);
......
}
Request passes some text with "special" non-English characters
 [{"?? ??????"}]
I can ...

14. Mule/Jersey returning 400 on requests for file upload    stackoverflow.com

I'm writing a mule application that implements some web services using Jersey. I'd like to upload a file. I've written the following skeleton

@POST
@Path("/getHtml")
@Consumes("multipart/form-data")
@Produces("text/plain")
public String getSummaryHtml(
     ...

15. Jersey REST Client: How to add XML file to the body of POST request?    stackoverflow.com

My code so far:

FileReader fileReader = new FileReader("filename.xml");
Client c = Client.create();
WebResource webResource = c.resource("http://localhost:8080/api/resource");
webResource.type("application/xml");
I want to send contents of filename.xml with POST method but I have no idea how to add ...

16. Jersey Client: Adding Cookies to Request    stackoverflow.com

I am trying to write a library that accesses a RESTful web service using the Jersey Client API. The service requires a login request that sets a cookie, then subsequent ...





17. Jersey: Print the actual request    stackoverflow.com

How can I view the actual request that Jersey generates and sends to the server? I am having issues with a particular request and the fellow running the webserver asked ...

18. How to enable resumable GET requests with Jersey?    stackoverflow.com

I am creating a RESTful web service using Jersey. Some of the resources are binary files that I get from somewhere else on demand; such files are potentially big (hundreds of ...

19. API Development: When to return a BAD REQUEST HTTP Status Code (REST)    stackoverflow.com

We're authoring REST services, and there's a debate on what to do when someone requests a resource with a parent ID that does not exist. Example: You are asking for a ...

20. How to access multiple resources in a single request : Jersey Rest    stackoverflow.com

I am trying to a find a good design for the following scenario. I have a POST rest service which will be given an array of services as data. And which should ...