public static WebApplicationException toNotSupportedException(Throwable cause, Response response) { try { return SpecExceptions.toNotSupportedException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toBadRequestException(Throwable cause, Response response) { try { return SpecExceptions.toBadRequestException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toHttpException(Throwable cause, Response response) { try { return SpecExceptions.toHttpException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } } }
public static WebApplicationException toNotAcceptableException(Throwable cause, Response response) { try { return SpecExceptions.toNotAcceptableException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toInternalServerErrorException(Throwable cause, Response response) { try { return SpecExceptions.toInternalServerErrorException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toBadRequestException(Throwable cause, Response response) { try { return SpecExceptions.toBadRequestException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toNotAcceptableException(Throwable cause, Response response) { try { return SpecExceptions.toNotAcceptableException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toNotSupportedException(Throwable cause, Response response) { try { return SpecExceptions.toNotSupportedException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toHttpException(Throwable cause, Response response) { try { return SpecExceptions.toHttpException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } } }
public static WebApplicationException toInternalServerErrorException(Throwable cause, Response response) { try { return SpecExceptions.toInternalServerErrorException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toNotFoundException(Throwable cause, Response response) { try { return SpecExceptions.toNotFoundException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toNotAuthorizedException(Throwable cause, Response response) { try { return SpecExceptions.toNotAuthorizedException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toForbiddenException(Throwable cause, Response response) { try { return SpecExceptions.toForbiddenException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toNotFoundException(Throwable cause, Response response) { try { return SpecExceptions.toNotFoundException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public static WebApplicationException toNotAuthorizedException(Throwable cause, Response response) { try { return SpecExceptions.toNotAuthorizedException(cause, response); } catch (NoClassDefFoundError ex) { return toWebApplicationException(ex, response); } }
public T readFrom(Class<T> cls, Type genericType, Annotation[] annotations, MediaType type, MultivaluedMap<String, String> headers, InputStream is) throws IOException { DataSource ds = null; if (cls == FileDataSource.class) { File file = new BinaryDataProvider<File>().readFrom(File.class, File.class, annotations, type, headers, is); ds = new FileDataSource(file); } else if (cls == DataSource.class || cls == DataHandler.class) { ds = new InputStreamDataSource(is, type.toString()); } else { LOG.warning("Unsupported DataSource class: " + cls.getName()); throw ExceptionUtils.toWebApplicationException(null, null); } return cls.cast(DataSource.class.isAssignableFrom(cls) ? ds : new DataHandler(ds)); }
public T readFrom(Class<T> cls, Type genericType, Annotation[] annotations, MediaType type, MultivaluedMap<String, String> headers, InputStream is) throws IOException { DataSource ds = null; if (cls == FileDataSource.class) { File file = new BinaryDataProvider<File>().readFrom(File.class, File.class, annotations, type, headers, is); ds = new FileDataSource(file); } else if (cls == DataSource.class || cls == DataHandler.class) { ds = new InputStreamDataSource(is, type.toString()); } else { LOG.warning("Unsupported DataSource class: " + cls.getName()); throw ExceptionUtils.toWebApplicationException(null, null); } return cls.cast(DataSource.class.isAssignableFrom(cls) ? ds : new DataHandler(ds)); }
protected void handleJAXBException(JAXBException e, boolean read) { StringBuilder sb = handleExceptionStart(e); Throwable linked = e.getLinkedException(); if (linked != null && linked.getMessage() != null) { if (read && linked instanceof XMLStreamException && linked.getMessage().startsWith("Maximum Number")) { throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413)); } sb.append(linked.getMessage()).append(". "); } Throwable t = linked != null ? linked : e.getCause() != null ? e.getCause() : e; String message = new org.apache.cxf.common.i18n.Message("JAXB_EXCEPTION", BUNDLE, sb.toString()).toString(); handleExceptionEnd(t, message, read); }
protected void handleJAXBException(JAXBException e, boolean read) { StringBuilder sb = handleExceptionStart(e); Throwable linked = e.getLinkedException(); if (linked != null && linked.getMessage() != null) { Throwable cause = linked; while (read && cause != null) { if (cause instanceof XMLStreamException && cause.getMessage().startsWith("Maximum Number")) { throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413)); } if (cause instanceof DepthExceededStaxException) { throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413)); } cause = cause.getCause(); } String msg = linked.getMessage(); if (sb.lastIndexOf(msg) == -1) { sb.append(msg).append(". "); } } Throwable t = linked != null ? linked : e.getCause() != null ? e.getCause() : e; String message = new org.apache.cxf.common.i18n.Message("JAXB_EXCEPTION", BUNDLE, sb.toString()).toString(); handleExceptionEnd(t, message, read); }
handleJAXBException(e, true); } catch (DepthExceededStaxException e) { throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413)); } catch (WebApplicationException e) { throw e;