Package javax.ws.rs.ext

Examples of javax.ws.rs.ext.MessageBodyReader.readFrom()


       
        MessageBodyReader mbr = ProviderFactory.getInstance(outMessage).createMessageBodyReader(
            cls, type, anns, contentType, outMessage);
        if (mbr != null) {
            try {
                return mbr.readFrom(cls, type, anns, contentType,
                       new MetadataMap<String, Object>(r.getMetadata(), true, true), inputStream);
            } catch (Exception ex) {
                reportMessageHandlerProblem("MSG_READER_PROBLEM", cls, contentType, ex, r);
            }
        } else if (cls == Response.class) {
View Full Code Here


                                         type,
                                         m);
            if (provider != null) {
                try {
                    HttpHeaders headers = new HttpHeadersImpl(m);
                    return provider.readFrom(
                              targetTypeClass, parameterType, parameterAnnotations, contentType,
                              headers.getRequestHeaders(), is);
                } catch (IOException e) {
                    String errorMessage = "Error deserializing input stream into target class "
                                          + targetTypeClass.getSimpleName()
View Full Code Here

       
        MessageBodyReader mbr = ProviderFactory.getInstance(inMessage).createMessageBodyReader(
            cls, type, anns, contentType, inMessage);
        if (mbr != null) {
            try {
                return mbr.readFrom(cls, type, anns, contentType,
                       new MetadataMap<String, Object>(r.getMetadata(), true, true), inputStream);
            } catch (Exception ex) {
                reportMessageHandlerProblem("MSG_READER_PROBLEM", cls, contentType, ex, r);
            }
        } else if (cls == Response.class) {
View Full Code Here

                                         type,
                                         m);
            if (provider != null) {
                try {
                    HttpHeaders headers = new HttpHeadersImpl(m);
                    return provider.readFrom(
                              targetTypeClass, parameterType, parameterAnnotations, contentType,
                              headers.getRequestHeaders(), is);
                } catch (IOException e) {
                    String errorMessage = "Error deserializing input stream into target class "
                                          + targetTypeClass.getSimpleName()
View Full Code Here

         MessageBodyReader reader =
            context.getProviders().getMessageBodyReader(MultivaluedMap.class, formType, null, contentType);
         if (reader != null)
         {
            form =
               (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, formType, null, contentType,
                  context.getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
         }
      }
      catch (IllegalStateException e)
      {
View Full Code Here

      if (reader == null)
         throw new IllegalStateException("Can't find appropriate entity reader for entity type "
            + MultivaluedMap.class.getName() + " and content-type " + conetentType);

      MultivaluedMap<String, String> form =
         (MultivaluedMap<String, String>)reader.readFrom(MultivaluedMap.class, FORM_TYPE, null, conetentType, context
            .getHttpHeaders().getRequestHeaders(), context.getContainerRequest().getEntityStream());
      return typeProducer.createValue(param, form, parameter.getDefaultValue());
   }

}
View Full Code Here

               {
                  try
                  {
                     MultivaluedMap<String, String> headers = context.getContainerRequest().getRequestHeaders();
                     p[i++] =
                        entityReader.readFrom(mp.getParameterClass(), mp.getGenericType(), mp.getAnnotations(),
                           contentType, headers, entityStream);
                  }
                  catch (WebApplicationException e)
                  {
                     if (LOG.isDebugEnabled())
View Full Code Here

                                         type,
                                         m);
            if (provider != null) {
                try {
                    HttpHeaders headers = new HttpHeadersImpl(m);
                    return provider.readFrom(
                              targetTypeClass, parameterType, parameterAnnotations, contentType,
                              headers.getRequestHeaders(), is);
                } catch (IOException e) {
                    String errorMessage = "Error deserializing input stream into target class "
                                          + targetTypeClass.getSimpleName()
View Full Code Here

            ProviderFactory.getInstance().createMessageBodyReader(
                cls, type, anns, contentType, outMessage);
        }
        if (mbr != null) {
            try {
                return mbr.readFrom(cls, type, anns, contentType,
                       new MetadataMap<String, Object>(r.getMetadata(), true, true), inputStream);
            } catch (Exception ex) {
                throw new WebApplicationException(ex);
            }
            
View Full Code Here

                String c = form.getFirst(p.getSourceName());
                if (c == null)
                    return null;
               
                InputStream is = new ByteArrayInputStream(c.getBytes("UTF-8"));
                return r.readFrom(
                        p.getParameterClass(),
                        p.getParameterType(),
                        p.getAnnotations(),
                        MediaType.TEXT_PLAIN_TYPE,
                        context.getRequest().getRequestHeaders(),
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.