Package javax.ws.rs.ext

Examples of javax.ws.rs.ext.WriterInterceptor


    private boolean checkBufferingMode(Message m, List<WriterInterceptor> writers, boolean firstTry) {
        if (!firstTry) {
            return false;
        }
        WriterInterceptor last = writers.get(writers.size() - 1);
        MessageBodyWriter<Object> w = ((WriterInterceptorMBW)last).getMBW();
        Object outBuf = m.getContextualProperty(OUT_BUFFERING);
        boolean enabled = MessageUtils.isTrue(outBuf);
        boolean configurableProvider = w instanceof AbstractConfigurableProvider;
        if (!enabled && outBuf == null && configurableProvider) {
View Full Code Here


                                                      parameterAnnotations,
                                                      mediaType,
                                                      m);
        if (mw != null) {
           
            @SuppressWarnings({
                "unchecked", "rawtypes"
            })
            WriterInterceptor mbwWriter = new WriterInterceptorMBW((MessageBodyWriter)mw, m);
             
            int size = writerInterceptors.size();
View Full Code Here

                                Message message)
        throws WebApplicationException, IOException {
       
        OutputStream entityStream = message.getContent(OutputStream.class);
        if (writers.size() > 1) {
            WriterInterceptor first = writers.remove(0);
            WriterInterceptorContext context = new WriterInterceptorContextImpl(entity,
                                                                                type,
                                                                            genericType,
                                                                            annotations,
                                                                            entityStream,
                                                                            message,
                                                                            writers);
           
            first.aroundWriteTo(context);
        } else {
            MessageBodyWriter<Object> writer = ((WriterInterceptorMBW)writers.get(0)).getMBW();
            if (type == byte[].class) {
                long size = writer.getSize(entity, type, genericType, annotations, mediaType);
                if (size != -1) {
View Full Code Here

    @Override
    public void proceed() throws IOException {
        if (writers == null || writers.isEmpty()) {
            return;
        }
        WriterInterceptor next = writers.remove(0);
        next.aroundWriteTo(this);
    }
View Full Code Here

                                                      mediaType,
                                                      m);
        int size = writerInterceptors.size();
        if (mw != null || size > 0) {
           
            @SuppressWarnings({
                "unchecked", "rawtypes"
            })
            WriterInterceptor mbwWriter = new WriterInterceptorMBW((MessageBodyWriter)mw, m);
             
            List<WriterInterceptor> interceptors = null;
View Full Code Here

                                Message message)
        throws WebApplicationException, IOException {
       
        OutputStream entityStream = message.getContent(OutputStream.class);
        if (writers.size() > 1) {
            WriterInterceptor first = writers.remove(0);
            WriterInterceptorContext context = new WriterInterceptorContextImpl(entity,
                                                                                type,
                                                                            genericType,
                                                                            annotations,
                                                                            entityStream,
                                                                            message,
                                                                            writers);
           
            first.aroundWriteTo(context);
        } else {
            MessageBodyWriter<Object> writer = ((WriterInterceptorMBW)writers.get(0)).getMBW();
            if (type == byte[].class) {
                long size = writer.getSize(entity, type, genericType, annotations, mediaType);
                if (size != -1) {
View Full Code Here

                                                      parameterAnnotations,
                                                      mediaType,
                                                      m);
        if (mw != null) {
           
            @SuppressWarnings({
                "unchecked", "rawtypes"
            })
            WriterInterceptor mbwWriter = new WriterInterceptorMBW((MessageBodyWriter)mw);
             
            int size = writerInterceptors.size();
View Full Code Here

                                Message message)
        throws WebApplicationException, IOException {
       
        OutputStream entityStream = message.getContent(OutputStream.class);
        if (writers.size() > 1) {
            WriterInterceptor first = writers.remove(0);
            WriterInterceptorContext context = new WriterInterceptorContextImpl(entity,
                                                                                type,
                                                                            genericType,
                                                                            annotations,
                                                                            mediaType,
                                                                            entityStream,
                                                                            message,
                                                                            writers);
           
            first.aroundWriteTo(context);
        } else {
            MessageBodyWriter<Object> writer = ((WriterInterceptorMBW)writers.get(0)).getMBW();
            writer.writeTo(entity, type, genericType, annotations, mediaType,
                           httpHeaders, entityStream);
        }
View Full Code Here

   
    private boolean checkBufferingMode(Message m, List<WriterInterceptor> writers, boolean firstTry) {
        if (!firstTry) {
            return false;
        }
        WriterInterceptor last = writers.get(writers.size() - 1);
        MessageBodyWriter<Object> w = ((WriterInterceptorMBW)last).getMBW();
        Object outBuf = m.getContextualProperty(OUT_BUFFERING);
        boolean enabled = MessageUtils.isTrue(outBuf);
        boolean configurableProvider = w instanceof AbstractConfigurableProvider;
        if (!enabled && outBuf == null && configurableProvider) {
View Full Code Here

                                                      parameterAnnotations,
                                                      mediaType,
                                                      m);
        if (mw != null) {
           
            @SuppressWarnings({
                "unchecked", "rawtypes"
            })
            WriterInterceptor mbwWriter = new WriterInterceptorMBW((MessageBodyWriter)mw);
             
            int size = writerInterceptors.size();
View Full Code Here

TOP

Related Classes of javax.ws.rs.ext.WriterInterceptor

Copyright © 2018 www.massapicom. 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.