Package javax.ws.rs.ext

Examples of javax.ws.rs.ext.MessageBodyWriter.writeTo()


         if (size > -1) response.getOutputHeaders().putSingle(HttpHeaderNames.CONTENT_LENGTH, String.valueOf(size));


         if (messageBodyWriterInterceptors == null || messageBodyWriterInterceptors.length == 0)
         {
            writer.writeTo(ent, type, generic, annotations,
                    contentType, response.getOutputHeaders(), response
                            .getOutputStream());
         }
         else
         {
View Full Code Here


        throw new WebApplicationException(Response.Status.BAD_REQUEST);
      }

      try {
        // TODO Need to infer media type
        messageBodyWriter.writeTo(entity, entity.getClass(),
          entity.getClass(), new Annotation[0],
          MediaType.APPLICATION_JSON_TYPE, clientRequest.getHeaders(), baos);
      } catch (IOException e) {
        throw new WebApplicationException(Response.Status.BAD_REQUEST);
      }
View Full Code Here

        throw new WebApplicationException(Response.Status.BAD_REQUEST);
      }

      try {
        // TODO Need to infer media type
        messageBodyWriter.writeTo(entity, entity.getClass(),
          entity.getClass(), new Annotation[0],
          MediaType.APPLICATION_JSON_TYPE, originalHeaders, baos);
      } catch (IOException e) {
        throw new WebApplicationException(Response.Status.BAD_REQUEST);
      }
View Full Code Here

                responseHeaders.putSingle(HttpHeaders.CONTENT_LENGTH, Long.toString(size));
            }
           
            LOG.fine("Response EntityProvider is: " + writer.getClass().getName());
            try {
                writer.writeTo(entity, targetType, genericType,
                               annotations,
                               responseType,
                               responseHeaders,
                               message.getContent(OutputStream.class));
               
View Full Code Here

            mbw = ProviderFactory.getInstance().createMessageBodyWriter(
                      cls, type, anns, contentType, outMessage);
        }
        if (mbw != null) {
            try {
                mbw.writeTo(o, cls, type, anns, contentType, headers, os);
                os.flush();
            } catch (Exception ex) {
                throw new WebApplicationException(ex);
            }
            
View Full Code Here

            if (writer == null) {
                throw new RuntimeException(String.format(Messages.getMessage("clientNoWriterForTypeAndMediaType"),
                                                         String.valueOf(type),
                                                         contentType));
            }
            writer.writeTo(entity,
                           type,
                           genericType,
                           null,
                           contentMediaType,
                           request.getHeaders(),
View Full Code Here

            }
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("Response EntityProvider is: " + writer.getClass().getName());
            }
            try {
                writer.writeTo(entity, targetType, genericType,
                               annotations,
                               responseType,
                               responseHeaders,
                               message.getContent(OutputStream.class));
               
View Full Code Here

                responseHeaders.putSingle(HttpHeaders.CONTENT_LENGTH, Long.toString(size));
            }
           
            LOG.fine("Response EntityProvider is: " + writer.getClass().getName());
            try {
                writer.writeTo(entity, targetType, genericType,
                               annotations,
                               responseType,
                               responseHeaders,
                               message.getContent(OutputStream.class));
               
View Full Code Here

            mbw = ProviderFactory.getInstance().createMessageBodyWriter(
                      cls, type, anns, contentType, outMessage);
        }
        if (mbw != null) {
            try {
                mbw.writeTo(o, cls, type, anns, contentType, headers, os);
                os.flush();
            } catch (Exception ex) {
                throw new WebApplicationException(ex);
            }
            
View Full Code Here

            mbw = ProviderFactory.getInstance().createMessageBodyWriter(
                      cls, type, anns, contentType, m);
        }
        if (mbw != null) {
            try {
                mbw.writeTo(o, cls, type, anns, contentType, headers, os);
                os.flush();
            } catch (Exception ex) {
                throw new WebApplicationException();
            }
            
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.