public MultivaluedMap<String, String> getRequestHeaders() { return httpHeaders.getRequestHeaders(); }
public MultivaluedMap<String, String> getRequestHeaders() { return httpHeaders.getRequestHeaders(); }
public static String getProtocolHeader(Message m, String name, String defaultValue, boolean setOnMessage) { String value = (String)m.get(name); if (value == null) { value = new HttpHeadersImpl(m).getRequestHeaders().getFirst(name); if (value != null && setOnMessage) { m.put(name, value); } } return value == null ? defaultValue : value; }
public static String getProtocolHeader(Message m, String name, String defaultValue, boolean setOnMessage) { String value = (String)m.get(name); if (value == null) { value = new HttpHeadersImpl(m).getRequestHeaders().getFirst(name); if (value != null && setOnMessage) { m.put(name, value); } } return value == null ? defaultValue : value; }
@SuppressWarnings("unchecked") public static Object readFromMessageBodyReader(List<ReaderInterceptor> readers, Class<?> targetTypeClass, Type parameterType, Annotation[] parameterAnnotations, InputStream is, MediaType mediaType, Message m) throws IOException, WebApplicationException { // Verbose but avoids an extra context instantiation for the typical path if (readers.size() > 1) { ReaderInterceptor first = readers.remove(0); ReaderInterceptorContext context = new ReaderInterceptorContextImpl(targetTypeClass, parameterType, parameterAnnotations, is, m, readers); return first.aroundReadFrom(context); } MessageBodyReader<?> provider = ((ReaderInterceptorMBR)readers.get(0)).getMBR(); @SuppressWarnings("rawtypes") Class cls = targetTypeClass; return provider.readFrom( cls, parameterType, parameterAnnotations, mediaType, new HttpHeadersImpl(m).getRequestHeaders(), is); }
@SuppressWarnings("unchecked") public static Object readFromMessageBodyReader(List<ReaderInterceptor> readers, Class<?> targetTypeClass, Type parameterType, Annotation[] parameterAnnotations, InputStream is, MediaType mediaType, Message m) throws IOException, WebApplicationException { // Verbose but avoids an extra context instantiation for the typical path if (readers.size() > 1) { ReaderInterceptor first = readers.remove(0); ReaderInterceptorContext context = new ReaderInterceptorContextImpl(targetTypeClass, parameterType, parameterAnnotations, is, m, readers); return first.aroundReadFrom(context); } else { MessageBodyReader<?> provider = ((ReaderInterceptorMBR)readers.get(0)).getMBR(); @SuppressWarnings("rawtypes") Class cls = (Class)targetTypeClass; return provider.readFrom( cls, parameterType, parameterAnnotations, mediaType, new HttpHeadersImpl(m).getRequestHeaders(), is); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Object aroundReadFrom(ReaderInterceptorContext c) throws IOException, WebApplicationException { Class entityCls = (Class)c.getType(); Type entityType = c.getGenericType(); MediaType entityMt = c.getMediaType(); Annotation[] entityAnns = c.getAnnotations(); if (m.get(ProviderFactory.PROVIDER_SELECTION_PROPERTY_CHANGED) == Boolean.TRUE && !reader.isReadable(entityCls, entityType, entityAnns, entityMt)) { reader = ProviderFactory.getInstance(m) .createMessageBodyReader(entityCls, entityType, entityAnns, entityMt, m); if (reader == null) { throw new RuntimeException("No reader available"); } } return reader.readFrom(entityCls, entityType, entityAnns, entityMt, new HttpHeadersImpl(m).getRequestHeaders(), c.getInputStream()); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Object aroundReadFrom(ReaderInterceptorContext c) throws IOException, WebApplicationException { Class entityCls = c.getType(); Type entityType = c.getGenericType(); MediaType entityMt = c.getMediaType(); Annotation[] entityAnns = c.getAnnotations(); if ((reader == null || m.get(ProviderFactory.PROVIDER_SELECTION_PROPERTY_CHANGED) == Boolean.TRUE && !reader.isReadable(entityCls, entityType, entityAnns, entityMt)) && entityStreamAvailable(c.getInputStream())) { reader = ProviderFactory.getInstance(m) .createMessageBodyReader(entityCls, entityType, entityAnns, entityMt, m); } if (reader == null) { String errorMessage = JAXRSUtils.logMessageHandlerProblem("NO_MSG_READER", entityCls, entityMt); throw new ProcessingException(errorMessage); } return reader.readFrom(entityCls, entityType, entityAnns, entityMt, new HttpHeadersImpl(m).getRequestHeaders(), c.getInputStream()); }