public static ExecuteResponse internalServerError(String errorMessage) { return new ExecuteResponse(ResponseCode.INTERNAL_SERVER_ERROR, errorMessage); } }
public static ExecuteResponse unauthorized() { return new ExecuteResponse(ResponseCode.UNAUTHORIZED, null); }
public static ExecuteResponse success() { return new ExecuteResponse(ResponseCode.CHANGED, null); }
public static ExecuteResponse badRequest(String errorMessage) { return new ExecuteResponse(ResponseCode.BAD_REQUEST, errorMessage); }
public static ExecuteResponse notFound() { return new ExecuteResponse(ResponseCode.NOT_FOUND, null); }
public static ExecuteResponse methodNotAllowed() { return new ExecuteResponse(ResponseCode.METHOD_NOT_ALLOWED, null); }
@Override public void visit(ExecuteRequest request) { if (coapResponse.isError()) { // handle error response: lwM2mresponse = new ExecuteResponse(toLwM2mResponseCode(coapResponse.getCode()), coapResponse.getPayloadString(), coapResponse); } else if (coapResponse.getCode() == org.eclipse.californium.core.coap.CoAP.ResponseCode.CHANGED) { // handle success response: lwM2mresponse = new ExecuteResponse(ResponseCode.CHANGED, null, coapResponse); } else { // handle unexpected response: handleUnexpectedResponseCode(registration.getEndpoint(), request, coapResponse); } }
return new ExecuteResponse(code, errorMessage); case "writeAttributes": { return new WriteAttributesResponse(code, errorMessage);
return new ExecuteResponse(code, errorMessage); case "writeAttributes": { return new WriteAttributesResponse(code, errorMessage);