private static Object[] getParamsWithAdditionalInfo(Object[] params) { String requestId = (String) DataStorage.get(DataStorage.REQUEST_ID); if (params != null) { Object[] paramsWithRequestId = new Object[params.length + 1]; paramsWithRequestId[0] = requestId; System.arraycopy(params, 0, paramsWithRequestId, 1, params.length); return paramsWithRequestId; } return new Object[] { requestId }; }
private static Object[] getParamsWithAdditionalInfo(Object[] params) { String requestId = (String) DataStorage.get(DataStorage.REQUEST_ID); if (params != null) { Object[] paramsWithRequestId = new Object[params.length + 1]; paramsWithRequestId[0] = requestId; System.arraycopy(params, 0, paramsWithRequestId, 1, params.length); return paramsWithRequestId; } return new Object[] { requestId }; }
protected Response buildResponse(JPARSException exception) { String path = null; exception.setHttpStatusCode(getHttpStatusCode(exception.getCause())); if (uriInfo != null) { URI requestURI = uriInfo.getRequestUri(); if (requestURI != null) { path = requestURI.getPath(); } } if ((path != null) && (path.contains(ServiceVersion.VERSION_2_0.getCode()) || path.contains(ServiceVersion.LATEST.getCode()))) { ErrorResponse errorResponse = new ErrorResponse(PROBLEM_TYPE, exception.getMessage(), String.valueOf(exception.getErrorCode())); errorResponse.setRequestId((String) DataStorage.get(DataStorage.REQUEST_ID)); errorResponse.setHttpStatus(exception.getHttpStatusCode().getStatusCode()); String error = marshallErrorResponse(errorResponse, StreamingOutputMarshaller.getResponseMediaType(headers).toString()); if (error != null) { return Response.status(exception.getHttpStatusCode()).entity(error).type(StreamingOutputMarshaller.getResponseMediaType(headers)).build(); } } return Response.status(exception.getHttpStatusCode()).type(StreamingOutputMarshaller.getResponseMediaType(headers)).build(); }
protected Response buildResponse(JPARSException exception) { String path = null; exception.setHttpStatusCode(getHttpStatusCode(exception.getCause())); if (uriInfo != null) { URI requestURI = uriInfo.getRequestUri(); if (requestURI != null) { path = requestURI.getPath(); } } if ((path != null) && (path.contains(ServiceVersion.VERSION_2_0.getCode()) || path.contains(ServiceVersion.LATEST.getCode()))) { ErrorResponse errorResponse = new ErrorResponse(PROBLEM_TYPE, exception.getMessage(), String.valueOf(exception.getErrorCode())); errorResponse.setRequestId((String) DataStorage.get(DataStorage.REQUEST_ID)); errorResponse.setHttpStatus(exception.getHttpStatusCode().getStatusCode()); String error = marshallErrorResponse(errorResponse, StreamingOutputMarshaller.getResponseMediaType(headers).toString()); if (error != null) { return Response.status(exception.getHttpStatusCode()).entity(error).type(StreamingOutputMarshaller.getResponseMediaType(headers)).build(); } } return Response.status(exception.getHttpStatusCode()).type(StreamingOutputMarshaller.getResponseMediaType(headers)).build(); }