Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo



  • Hi RESTeasy team,

    first I would like to thank you for such a great library. It is a lot of fun to work with it. I have two small issues which I'll post in separate questions. Here is the first one.

    I have a legacy service which needs to emit JSON objects without a type wrapper, e.g.

        {"username":"foo", "password":"bar"}

    instead of

        {"User":{"username":"foo", "password":"bar"}}

    For this I created a **MessageBodyWriter** which does the conversion using the **org.json** library. The content type is **text/plain** (**application/json** has the same issues)

    In order for the RESTEasy library to use my MessageBodyWriter I have to annotate all service methods with **@DoNotUseJAXBProvider** like this which is a bit ugly.

        public User getUser(@PathParam("userId") long userId);

    Otherwise I get the following error

        Could not find JAXBContextFinder for media type: text/plain

    Adding the @DoNotUseJAXBProvider to the class is possible but doesn't have any effect.

    Is there a simpler way of telling RESTeasy to use my text/plain MessageBodyWriter all the time?


  • I am using **RESTeasy 1.1.GA** btw.


  • I have found a solution for this. This is the communication path

          <- plain JSON (text/plain) ->  <- Jettison JSON (application/json) ->

    As I want to use the same POJO on both the frontend and the backend service annotating the entity classes with **@IgnoreMediaTypes("text/plain")** does the trick.

        @XmlRootElement(name = "User")
        public class User {
            private String username;
            private String password;
            public String getUsername() {
                return username;
            public void setUsername(String username) {
                this.username = username;
            public String getPassword() {
                return password;
            public void setPassword(String password) {
                this.password = password;