private ODataResponse handleWebApplicationException(final Exception exception) throws ClassNotFoundException, InstantiationException, IllegalAccessException, EntityProviderException { ODataErrorContext errorContext = createErrorContext((WebApplicationException) exception); ODataErrorCallback callback = getErrorHandlerCallback(); return callback == null ? new ProviderFacadeImpl().writeErrorDocument(errorContext) : executeErrorCallback(errorContext, callback); }
private ContentType getContentType() { ContentType contentType = getContentTypeByUriInfo(); if (contentType == null) { contentType = getContentTypeByAcceptHeader(); } return contentType; }
private ODataResponse executeErrorCallback(final ODataErrorContext errorContext, final ODataErrorCallback callback) { ODataResponse oDataResponse; try { oDataResponse = callback.handleError(errorContext); } catch (ODataApplicationException e) { oDataResponse = handleException(e); } return oDataResponse; }
@Override public Response toResponse(final Exception exception) { ODataResponse response; try { if (exception instanceof WebApplicationException) { response = handleWebApplicationException(exception); } else { response = handleException(exception); } } catch (Exception e) { response = ODataResponse.entity("Exception during error handling occured!") .contentHeader(ContentType.TEXT_PLAIN.toContentTypeString()) .status(HttpStatusCodes.INTERNAL_SERVER_ERROR).build(); } // Convert OData response to JAX-RS response. return RestUtil.convertResponse(response); }
private ODataResponse handleException(final Exception exception) { ODataExceptionWrapper exceptionWrapper = new ODataExceptionWrapper(uriInfo, httpHeaders, getErrorHandlerCallback()); return exceptionWrapper.wrapInExceptionResponse(exception); }
context.setContentType(getContentType().toContentTypeString()); context.setException(exception); context.setErrorCode(null);
@Override public Response toResponse(final Exception exception) { ODataResponse response; try { if (exception instanceof WebApplicationException) { response = handleWebApplicationException(exception); } else { response = handleException(exception); } } catch (Exception e) { response = ODataResponse.entity("Exception during error handling occured!") .contentHeader(ContentType.TEXT_PLAIN.toContentTypeString()) .status(HttpStatusCodes.INTERNAL_SERVER_ERROR).build(); } // Convert OData response to JAX-RS response. return RestUtil.convertResponse(response); }
private ODataResponse handleException(final Exception exception) { ODataExceptionWrapper exceptionWrapper = new ODataExceptionWrapper(uriInfo, httpHeaders, getErrorHandlerCallback()); ODataResponse oDataResponse = exceptionWrapper.wrapInExceptionResponse(exception); return oDataResponse; }
context.setContentType(getContentType().toContentTypeString()); context.setException(exception); context.setErrorCode(null);
private ODataResponse handleWebApplicationException(final Exception exception) throws ClassNotFoundException, InstantiationException, IllegalAccessException, EntityProviderException { ODataErrorContext errorContext = createErrorContext((WebApplicationException) exception); ODataErrorCallback callback = getErrorHandlerCallback(); return callback == null ? new ProviderFacadeImpl().writeErrorDocument(errorContext) : executeErrorCallback(errorContext, callback); }
private ContentType getContentType() { ContentType contentType = getContentTypeByUriInfo(); if (contentType == null) { contentType = getContentTypeByAcceptHeader(); } return contentType; }
@Override public Response toResponse(final Exception exception) { ODataResponse response; try { if (exception instanceof WebApplicationException) { response = handleWebApplicationException(exception); } else { response = handleException(exception); } } catch (Exception e) { response = ODataResponse.entity("Exception during error handling occured!") .contentHeader(ContentType.TEXT_PLAIN.toContentTypeString()) .status(HttpStatusCodes.INTERNAL_SERVER_ERROR).build(); } // Convert OData response to JAX-RS response. return RestUtil.convertResponse(response); }
private ODataResponse executeErrorCallback(final ODataErrorContext errorContext, final ODataErrorCallback callback) { ODataResponse oDataResponse; try { oDataResponse = callback.handleError(errorContext); } catch (ODataApplicationException e) { oDataResponse = handleException(e); } return oDataResponse; }
private ODataResponse handleException(final Exception exception) { ODataExceptionWrapper exceptionWrapper = new ODataExceptionWrapper(uriInfo, httpHeaders, getErrorHandlerCallback()); return exceptionWrapper.wrapInExceptionResponse(exception); }
context.setContentType(getContentType().toContentTypeString()); context.setException(exception); context.setErrorCode(null);
private ODataResponse handleWebApplicationException(final Exception exception) throws ClassNotFoundException, InstantiationException, IllegalAccessException, EntityProviderException { ODataErrorContext errorContext = createErrorContext((WebApplicationException) exception); ODataErrorCallback callback = getErrorHandlerCallback(); return callback == null ? new ProviderFacadeImpl().writeErrorDocument(errorContext) : executeErrorCallback(errorContext, callback); }
private ContentType getContentType() { ContentType contentType = getContentTypeByUriInfo(); if (contentType == null) { contentType = getContentTypeByAcceptHeader(); } return contentType; }
private ODataResponse executeErrorCallback(final ODataErrorContext errorContext, final ODataErrorCallback callback) { ODataResponse oDataResponse; try { oDataResponse = callback.handleError(errorContext); } catch (ODataApplicationException e) { oDataResponse = handleException(e); } return oDataResponse; }