users@jersey.java.net

returning basic java data types

From: Suchitha Koneru (sukoneru) <"Suchitha>
Date: Tue, 4 Aug 2009 18:36:18 -0700

Hello Jersey Users,

           If we have to return basic Java data types like boolean,
integer, float etc. other than String , do we need to implement message
body writer interface ?

 

For example , when I test the following code I get the exception as

SEVERE: A message body writer for Java type, class java.lang.Boolean,
and MIME media type, application/octet-stream, was

 not found

 

 

@Context SecurityContext sc;

@GET @Path ("role")

public boolean checkUserRole(){

            

            if(sc.isUserInRole("cco")){

                  return true;

            }else{

                  return false;

            }

      }

 

If MIME type is not specified , is the default mime type assumed as
"application/octet-stream" ? Does Jersey have a messagebodywriter

For basic java data types ?

 

Could you please let me know ,

Thanks

Suchitha.