public static InputStream noContentCheck( MultivaluedMap httpHeaders, InputStream is) throws NoContentException { contentLengthCheck(httpHeaders); NoContentInputStreamDelegate delegate = new NoContentInputStreamDelegate(is); return delegate; }
public String readFrom(Class<String> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { if (NoContent.isContentLengthZero(httpHeaders)) return ""; return ProviderHelper.readString(entityStream, mediaType); }
public Object readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { InputStream delegate = NoContent.noContentCheck(httpHeaders, entityStream); String value = ProviderHelper.readString(delegate, mediaType); return TypeConverter.getType(type, value); }
public Source readFrom(Class<Source> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (NoContent.isContentLengthZero(httpHeaders)) return new StreamSource(new ByteArrayInputStream(new byte[0])); return new StreamSource(entityStream); }
NoContent.contentLengthCheck(httpHeaders); JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, true); Unmarshaller unmarshaller = jaxb.createUnmarshaller();
public Object readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { InputStream delegate = NoContent.noContentCheck(httpHeaders, entityStream); String value = ProviderHelper.readString(delegate, mediaType); return TypeConverter.getType(type, value); }
public byte[] readFrom(Class<byte[]> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (NoContent.isContentLengthZero(httpHeaders)) return new byte[0]; return ReadFromStream.readFromStream(1024, entityStream); }
NoContent.contentLengthCheck(httpHeaders); Class<?> typeArg = Object.class; if (genericType != null) typeArg = Types.getTypeArgument(genericType);
public Object readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { InputStream delegate = NoContent.noContentCheck(httpHeaders, entityStream); String value = ProviderHelper.readString(delegate, mediaType); return TypeConverter.getType(type, value); }
public static void contentLengthCheck(MultivaluedMap httpHeaders) throws NoContentException { if (isContentLengthZero(httpHeaders)) throw new NoContentException(Messages.MESSAGES.noContentContentLength0()); } }
public static InputStream noContentCheck( MultivaluedMap httpHeaders, InputStream is) throws NoContentException { contentLengthCheck(httpHeaders); NoContentInputStreamDelegate delegate = new NoContentInputStreamDelegate(is); return delegate; }
public MultivaluedMap readFrom(Class<MultivaluedMap> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (NoContent.isContentLengthZero(httpHeaders)) return new MultivaluedMapImpl<String, String>(); boolean encoded = FindAnnotation.findAnnotation(annotations, Encoded.class) != null; String charset = mediaType.getParameters().get(MediaType.CHARSET_PARAMETER); if (charset == null) { charset = StandardCharsets.UTF_8.name(); } if (encoded) return parseForm(entityStream, charset); else return Encode.decode(parseForm(entityStream, charset), charset); }
public static InputStream noContentCheck( MultivaluedMap httpHeaders, InputStream is) throws NoContentException { contentLengthCheck(httpHeaders); NoContentInputStreamDelegate delegate = new NoContentInputStreamDelegate(is); return delegate; }
if (NoContent.isContentLengthZero(httpHeaders)) return readDataSource(new ByteArrayInputStream(new byte[0]), mediaType); return readDataSource(entityStream, mediaType);
if (NoContent.isContentLengthZero(httpHeaders)) return downloadedFile; OutputStream output = new BufferedOutputStream(new FileOutputStream( downloadedFile));
public Source readFrom(Class<Source> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (NoContent.isContentLengthZero(httpHeaders)) return new StreamSource(new ByteArrayInputStream(new byte[0])); return new StreamSource(entityStream); }
public String readFrom(Class<String> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { if (NoContent.isContentLengthZero(httpHeaders)) return ""; return ProviderHelper.readString(entityStream, mediaType); }
public String readFrom(Class<String> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { if (NoContent.isContentLengthZero(httpHeaders)) return ""; return ProviderHelper.readString(entityStream, mediaType); }
public Source readFrom(Class<Source> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (NoContent.isContentLengthZero(httpHeaders)) return new StreamSource(new ByteArrayInputStream(new byte[0])); return new StreamSource(entityStream); }
public byte[] readFrom(Class<byte[]> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (NoContent.isContentLengthZero(httpHeaders)) return new byte[0]; return ReadFromStream.readFromStream(1024, entityStream); }