/** * Constructor. * * @param throwableClass * The class or interface that hosts the annotated Java method. * @param annotationValue * The annotation value containing the HTTP error code. * @param serializable * Indicates if the {@link Throwable} should be serialized. */ public ThrowableAnnotationInfo(Class<?> throwableClass, int annotationValue, boolean serializable) { super(throwableClass, Integer.toString(annotationValue)); // Parse the main components of the annotation value this.status = Status.valueOf(annotationValue); this.serializable = serializable; }
@Override public void setStatus(Status status) { getTarget().setStatus(org.restlet.data.Status.valueOf(status.code)); }
response.setStatus(Status.valueOf(Integer.valueOf(responseCode)));
response.setName(Status.valueOf(code).getReasonPhrase()); if (!StringUtils.isNullOrEmpty(apiResponse.message())) { response.setDescription(apiResponse.message());
response.setName(Status.valueOf(code).getReasonPhrase()); if (!StringUtils.isNullOrEmpty(apiResponse.message())) { response.setDescription(apiResponse.message());
/** * Converts the given JAX-RS {@link javax.ws.rs.core.Response} to a Restlet * {@link Response}. * * @param jaxRsResponse * The response returned by the resource method, perhaps as * attribute of a {@link WebApplicationException}. * @param resourceMethod * The resource method creating the response. Could be null, if * an exception is handled, e.g. a * {@link WebApplicationException}. */ private void jaxRsRespToRestletResp( javax.ws.rs.core.Response jaxRsResponse, ResourceMethod resourceMethod) { Response restletResponse = tlContext.get().getResponse(); restletResponse.setStatus(Status.valueOf(jaxRsResponse.getStatus())); MultivaluedMap<String, Object> httpHeaders = jaxRsResponse .getMetadata(); MediaType respMediaType = getMediaType(httpHeaders); Object jaxRsEntity = jaxRsResponse.getEntity(); SortedMetadata<MediaType> accMediaType; if (respMediaType != null) accMediaType = SortedMetadata.get(respMediaType); else accMediaType = tlContext.get().getAccMediaTypes(); restletResponse.setEntity(convertToRepresentation(jaxRsEntity, resourceMethod, respMediaType, httpHeaders, accMediaType)); copyResponseHeaders(httpHeaders, restletResponse); }
response.setName(Status.valueOf(code).getReasonPhrase()); if (!StringUtils.isNullOrEmpty(apiResponse.message())) { response.setDescription(apiResponse.message());
response.setName(Status.valueOf(code).getReasonPhrase()); if (!StringUtils.isNullOrEmpty(apiResponse.message())) { response.setDescription(apiResponse.message());
response.setName(Status.valueOf(code).getReasonPhrase()); if (!StringUtils.isNullOrEmpty(apiResponse.message())) { response.setDescription(apiResponse.message());
@Override public Warning readValue() throws IOException { Warning result = new Warning(); String code = readToken(); skipSpaces(); String agent = readRawText(); skipSpaces(); String text = readQuotedString(); // The date is not mandatory skipSpaces(); String date = null; if (peek() != -1) { date = readQuotedString(); } if ((code == null) || (agent == null) || (text == null)) { throw new IOException("Warning header malformed."); } result.setStatus(Status.valueOf(Integer.parseInt(code))); result.setAgent(agent); result.setText(text); if (date != null) { result.setDate(DateUtils.parse(date)); } return result; }
for (final String string : statuses) { this.currentResponse.getStatuses().add( Status.valueOf(Integer.parseInt(string)));
} catch (HttpErrorCodeException httpException) { int errorCode = httpException.getErrorCode(); Status status = Status.valueOf(errorCode); response.setStatus(status); response.setEntity(httpException.getMessage(), MediaType.TEXT_PLAIN);
Response response = new Response(); response.setCode(statusCode); response.setName(Status.valueOf(statusCode) .getReasonPhrase()); response.setMessage("Status " + statusCode);
Response response = new Response(); response.setCode(statusCode); response.setName(Status.valueOf(statusCode) .getReasonPhrase()); response.setMessage("Status " + statusCode);
Response response = new Response(); response.setCode(statusCode); response.setName(Status.valueOf(statusCode) .getReasonPhrase()); response.setMessage("Status " + statusCode);
Response response = new Response(); response.setCode(statusCode); response.setName(Status.valueOf(statusCode) .getReasonPhrase()); response.setMessage("Status " + statusCode);
Response response = new Response(); response.setCode(statusCode); response.setName(Status.valueOf(statusCode) .getReasonPhrase()); response.setMessage("Status " + statusCode);