rest - Type boolean, and MIME media type application/octet-stream was not found Java (Jersey) -


i using jersey version 1.12 , facing error is

a message body writer java class java.lang.boolean, , java type boolean, , mime media type application/octet-stream not found      @ com.sun.jersey.spi.container.containerresponse.write(containerresponse.java:285)     @ com.sun.jersey.server.impl.application.webapplicationimpl._handlerequest(webapplicationimpl.java:1451)     @ com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1363)     @ com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1353)     @ com.sun.jersey.spi.container.servlet.webcomponent.service(webcomponent.java:414)     @ com.sun.jersey.spi.container.servlet.servletcontainer.service(servletcontainer.java:537)     @ com.sun.jersey.spi.container.servlet.servletcontainer.service(servletcontainer.java:708)     @ javax.servlet.http.httpservlet.service(httpservlet.java:728)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:305)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:222)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:123)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:502)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:99)     @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:953)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408)     @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1023)     @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:589)     @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:312)     @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ java.lang.thread.run(unknown source) 

my code

        @post         @path("/save/{name}/{data}")         @consumes("application/x-www-form-urlencoded")         public string savedatamap(@queryparam("number") string number,         @pathparam("data") string data,         @pathparam("name") string appname         multivaluedmap<string, string> formparam) throws exception{         boolean response =false'         try{         // business logic         response =true         }          return response;         } 

after googling error found due not specifying content type of data sending - jersey not able locate right messagebodywritter serialize

after added produces anotation method mediatype.text_plain doesn't work ,but when changed return type of method string started working.

i wants know whats problem boolean ,why not working boolean ? , how solve problem without changing boolean string ?

any appreciated.

i code these methods this:

    @post     @path("/save/{name}/{data}")     @consumes("application/x-www-form-urlencoded")     @produces(mediatype.text_plain)     public response savedatamap(@queryparam("number") string number,     @pathparam("data") string data,     @pathparam("name") string appname     multivaluedmap<string, string> formparam) throws exception{     boolean response =false     try{     // business logic     response =true     }      return response.ok().entity(string.valueof(response)).build();     } 

the changes returns jersey http response building string boolean.

i hope helps.

regards, cris.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -