/** * Constructor. * @param cause The underlying cause of the exception. * @param status The HTTP status code that will be returned to the client. * @param message Message to return to the HTTP client. */ public PortalException(Throwable cause, int status, String message) { super(cause, response(Response.status(status), message)); }
/** * Performs actual writing. * @param os Output stream. * @throws IOException If an error occurs. */ protected final void doWrite(OutputStream os) throws IOException { try { final Source source = getSource(); if (source != null) { fopService.generatePDF(getSource(), getTransformer(), null, os); } } catch (FOPException e) { throw new PortalException(e, "FOP Exception"); } catch (TransformerException e) { throw new PortalException(e, "Transformer Exception"); } }
private Response mapNormal(UUID id, Exception exception, String when) { if (exception instanceof PortalException && exception.getCause() != null) { final PortalException pe = (PortalException) exception; final Response r = pe.getResponse(); Loggers.core().error(String.format("Port@l Exception [%s] during %s processing", id, when), exception); final ResponseBuilder b = Response.fromResponse(r); b.entity(String.format("Port@l Exception [%s]: %s", id, r.getEntity())); return b.build(); } if (exception instanceof WebApplicationException) { return ((WebApplicationException) exception).getResponse(); } Loggers.core().error(String.format("Exception [%s] during %s processing", id, when), exception); return Response.serverError().type(MediaType.TEXT_PLAIN_TYPE) .entity(String.format("Exception [%s]. See error log for details", id)).build(); } }
protected Engine getOnlineEngine() { if (!isOnline()) { throw WebExceptions.notFound("Online engine not found"); } try { final EngineModel model = loader.getOnline(EnvironmentManager.NAME); final Engine engine = new DefaultOnlineEngine(model, getPCB()); return engine; } catch (PMSException e) { throw new PortalException(e); } }
/** * Constructor. * @param status The HTTP status code that will be returned to the client. * @param message Message to return to the HTTP client. */ public PortalException(int status, String message) { super(response(Response.status(status), message)); }
/** * Constructor. * @param cause The underlying cause of the exception. * @param status The HTTP status code that will be returned to the client. * @param message Message to return to the HTTP client. */ public PortalException(Throwable cause, Status status, String message) { super(cause, response(Response.status(status), message)); }
/** * Constructor. * @param status The HTTP status code that will be returned to the client. * @param message Message to return to the HTTP client. */ public PortalException(Status status, String message) { super(response(Response.status(status), message)); }