-
- All Superinterfaces:
- InterceptorContext
public interface WriterInterceptorContext extends InterceptorContext
Context class used byWriterInterceptor
to intercept calls toMessageBodyWriter.writeTo(T, java.lang.Class<?>, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.Object>, java.io.OutputStream)
. The getters and setters in this context class correspond to the parameters of the intercepted method.- Since:
- 2.0
- Author:
- Santiago Pericas-Geertsen, Bill Burke
- See Also:
WriterInterceptor
,MessageBodyWriter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Object
getEntity()
Get object to be written as HTTP entity.MultivaluedMap<String,Object>
getHeaders()
Get mutable map of HTTP headers.OutputStream
getOutputStream()
Get the output stream for the object to be written.void
proceed()
Proceed to the next interceptor in the chain.void
setEntity(Object entity)
Update object to be written as HTTP entity.void
setOutputStream(OutputStream os)
Set a new output stream for the object to be written.-
Methods inherited from interface javax.ws.rs.ext.InterceptorContext
getAnnotations, getGenericType, getMediaType, getProperty, getPropertyNames, getType, removeProperty, setAnnotations, setGenericType, setMediaType, setProperty, setType
-
-
-
-
Method Detail
-
proceed
void proceed() throws IOException, WebApplicationException
Proceed to the next interceptor in the chain. Interceptors MUST explicitly call this method to continue the execution chain; the call to this method in the last interceptor of the chain will invoke the wrappedMessageBodyWriter.writeTo(T, java.lang.Class<?>, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.Object>, java.io.OutputStream)
method.- Throws:
IOException
- if an IO error arises or is thrown by the wrappedMessageBodyWriter.writeTo
method.WebApplicationException
- thrown by the wrappedMessageBodyWriter.writeTo
method.
-
getEntity
Object getEntity()
Get object to be written as HTTP entity.- Returns:
- object to be written as HTTP entity.
-
setEntity
void setEntity(Object entity)
Update object to be written as HTTP entity.- Parameters:
entity
- new object to be written.
-
getOutputStream
OutputStream getOutputStream()
Get the output stream for the object to be written. The JAX-RS runtime is responsible for closing the output stream.- Returns:
- output stream for the object to be written.
-
setOutputStream
void setOutputStream(OutputStream os)
Set a new output stream for the object to be written. For example, by wrapping it with another output stream. The JAX-RS runtime is responsible for closing the output stream that is set.- Parameters:
os
- new output stream for the object to be written.
-
getHeaders
MultivaluedMap<String,Object> getHeaders()
Get mutable map of HTTP headers.- Returns:
- map of HTTP headers.
-
-
Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/ws/rs/ext/WriterInterceptorContext.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.