Is there a way to know the preflight request headers in Java Jersey or is there a way to send different response to a preflight request?
Suppose I have the following code:
@Path("/releaseClient")
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public JSONObject releaseClient(JSONObject clientAndUser, @Context HttpServletRequest request) throws JSONException{
int clientId = clientAndUser.getInt("id");
String userId = clientAndUser.getString("user");
JSONObject res = new JSONObject();
// Check if profile is locked by current user and if so release profile
if(clientLockService.unlockClient(clientId, userId)){
res.put("success", clientService.returnClientInfo(clientId));
} else {
// If not then set error message
res.put("error", "Profile is not locked by current user");
}
return res;
}
Now first the browser will send a preflight request. Is there a way where I can manipulate the response headers for a preflight request?