response « restful « Java Enterprise Q&A

1. How to customize response structure when working with Axis2 REST web services?

I'm using Axis2 1.4.1 to expose RESTful web services. I need to return xml structure (or any other for example ATOM xml or RSS xml or JSON structure) of my choosing. ...

2. What are HTTP Response Entity Tags?

Specifically in JAX-RS (I'm not sure that is relevant) there are methods that allow you to add EntityTags to the response. What exactly are entity tags and what practical ways ...

3. Exposing a subset of bean properties as XML response of REST service

I'm not sure how to best explain this, so this may be a bit long, please bear with me. Let's say I have a java bean with a bunch of properties:

public interface ...

4. how to send JSON data with server error response code 500

I wanted to know if theres a way to send a JSON data along with HTTP response code 500. Basically I want my rest client to know that there is some ...

5. Multiple response types with same REST GET?

I want to create a REST service that can return either JSON or XML. What request parameter do I set in the request to request a certain mime type? ...

6. Remove xml:ns tags from webservice(axis2) response

I have a webserivce deployed using axis2. The method on the service class returns a string.

public String getXML(){ ...

7. Adding links to REST Responses

I have REST services that respond with unmarshalled domain entities. For example:


    <name>Some Guy</name>
I would like to add ...

8. how to remove or hide the Http response error using java

I have a REST web service class which i call HttpRequest using curl.I wrote the web service using jersey framework and java in Netbean IDE.If the HttpRequest syntax is correct, the ...

9. REST response code for invalid data

What response code should be passed to client in case of following scenarios?

  1. Invalid data passed while user registration like wrong email format
  2. User name/ Email is already exists
I chose 403. I also ...

10. Sending & Receiving XML in REST request & response using java

Is there any way to send xml into REST request? If yes, how to do it. In my case i have to send XML to a URL and in response will get ...

11. Is it possible to configure to not return “null” object in json response?

For a sample json response like this:

Is it possible to configure the response builder to strip out/ommitt any null values, so that the response looks like:

12. Axis ReST vs SOAP xml response formatting

I have developed a set of web services using Java and Axis2 in Eclipse. The web service is deployed to Tomcat 6.0.23. I am experiencing an odd problem in ...

13. Which HTTP Response Status to Return

I have a REST operation. User wants to delete an object.

  • If a database error occurs
  • When writing to response with response.getWriter() if IOException occurs.
Which status code(500, 503 etc.) should I return ...

14. Call and Display REST or SOAP response from a HTML page

I am trying to call the webservice to get a simple list of tasks, from a windows 7 gadget. Now, basically its a html page, with Javascript if need be. Ive looked ...

15. RESTful web service's response

Let's say I have the following model

The URI:
should return the following information about a particular course:
and: /courses should return a list of above mentioned information. I'm not sure about the ...

16. What are the best practices to add metadata to a RESTful JSON response?

Background We are building a Restful API that should return data objects as JSON. In most of the cases it fine just to return the data object, but in some cases, f.ex. ...

17. Resteasy : I want to delete a file after a File response

I want to delete a file after a Resteasy put request. My code:

public File audioConverter(@Context HttpServletRequest request, File file,
        @QueryParam("codec") String codec,....


18. Rest Response adding extra characters

Hi all, I have written a very basic Restful web service using Jersey and Mule 2.2.1. The service returns the string 'hello' when a GET is sent to the service. @GET @Produces("application/json") public String getHello() { return "hello"; } When I use a poster application like Google Poster to send a GET request, I get the string 'hello' back but when ...