This is the piece of code that I am using.
The ok(Object items) method is internally calling Jersey’s Response.ok() method when items is null.
MembershipRequestModel membershipRequest = null;
membershipRequest = communityService.addUserToCommunity(communityId, userId);
if(membershipRequest != null) {
// Add code 303 if returning membershiprequest
return seeOther( membershipRequest,
String.valueOf(membershipRequest.getId()),
MembershipRequestRestHandlerImpl.class);
} else {
return ok(null);
}
public Response ok() {
return Response.ok().build();
}
public Response ok(Object items) {
if ( items == null )
return ok();
return Response.ok().entity(items).build();
}
But, I am getting the response as 204 No Content which should have actually been 200 OK. I have tried it using RESTClient firefox plugin and cURL command on CentOS.
Please help.
Thanks.
If there is no body,
204will be returned.all
2XXare success.204means success with no content (no entity body).http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html