protected MessageBodyWriter getWriter() { MessageBodyWriter writer = resolveWriter(); if (writer == null) { throwWriterNotFoundException(); } return writer; }
@Override protected void writeTo(MessageBodyWriter writer) throws IOException { //logger.info("*** " + request.getUri().getPath() + " writeTo(" + entity.toString() + ", " + mediaType); super.writeTo(writer); }
public void doWrite(Object toOutput, Class type, Type genericType, MediaType mediaType, Annotation[] annotations, MultivaluedMap<String, Object> requestHeaders, OutputStream outputStream) throws IOException { final Map<String, Object> attributes = new HashMap<String, Object>(); AbstractWriterInterceptorContext messageBodyWriterContext = new ClientWriterInterceptorContext(interceptors, factory, toOutput, type, genericType, annotations, mediaType, requestHeaders, outputStream, attributes); messageBodyWriterContext .proceed(); }
providerFactory, ent, type, generic, annotations, mt, jaxrsResponse.getMetadata(), os, request); writerContext.proceed(); if(sendHeaders) { response.setOutputStream(writerContext.getOutputStream()); //propagate interceptor changes on the outputstream to the response
public void proceed() throws IOException, WebApplicationException { LogMessages.LOGGER.debugf("Interceptor Context: %s, Method : proceed", getClass().getName()); if (interceptors == null || index >= interceptors.length) { MessageBodyWriter writer = getWriter(); if (writer!=null) LogMessages.LOGGER.debugf("MessageBodyWriter: %s", writer.getClass().getName()); writeTo(writer); } else { LogMessages.LOGGER.debugf("WriterInterceptor: %s", interceptors[index].getClass().getName()); interceptors[index++].aroundWriteTo(this); // we used to pop the index, but the TCK doesn't like this } }
public void writeRequestBody(OutputStream outputStream) throws IOException { if (entity == null) { return; } WriterInterceptor[] interceptors = getWriterInterceptors(); AbstractWriterInterceptorContext ctx = new ClientWriterInterceptorContext(interceptors, configuration.getProviderFactory(), entity, entityClass, entityGenericType, entityAnnotations, headers.getMediaType(), headers.getHeaders(), outputStream, getMutableProperties()); ctx.proceed(); }
public void writeRequestBody(OutputStream outputStream) throws IOException { if (entity == null) { return; } WriterInterceptor[] interceptors = getWriterInterceptors(); AbstractWriterInterceptorContext ctx = new ClientWriterInterceptorContext(interceptors, configuration.getProviderFactory(), entity, entityClass, entityGenericType, entityAnnotations, headers.getMediaType(), headers.getHeaders(), outputStream, getMutableProperties()); ctx.proceed(); }