* There is no getProperties() method in Response
* HttpHeaders should have appropriate Link methods
* I don't see why you need all the helper methods in
ContainerRequestContext as @HttpHeaders, @UriInfo, etc. can all be
injected. Or you could just reference them from within the context.
i.e.
interface ContainerRequestContext {
UriInfo getUriInfo();
SecurityContext getSecurityContext();
HttpHeaders getHttpHeaders();
...
}
* I could give up on my header java.lang.Object value insistence and
ClientRequestContext could re-use HttpHeaders too.
Here's another idea:
- Rename ContainerResponseContext to FilterableContainerResponse
- Have FilterableContainerResponse extend Response and add additional
mutator methods
- Rename ClientResponseContext to FilterableClientResponse'
- Have FilterableClientResponse extend Response and add additional
mutator methods
class FilterableContainerResponse extends Response
{
public OutputStream getEntityStream();
// invoking this method DOES NOT invoke handlers or MBR
// must not be null
public void setEntityStream(final OutputStream entityStream);
// conveniece method for setting new entity
public <T> void setEntity(
final Class<T> type,
final Annotation annotations[],
final MediaType mediaType,
final T entity);
public <T> void setEntity(
final GenericType<T> genericType,
final Annotation annotations[],
final MediaType mediaType,
final T entity);
// get the declared entity type (used by MBW)
public GenericType<?> getDeclaredEntityType();
// get the entity annotations (used by MBW)
public Annotation[] getEntityAnnotations();
... and any other specific methods to a container response...
}
public class FilterableClientResponse extends Response {
public void setStatusCode(int code);
// mutable response headers map
public MultivaluedMap<String, String> getHeaders();
public boolean hasEntity();
// invoking this method DOES NOT invoke handlers or MBR
// returns empty stream if no entity
public InputStream getEntityStream();
// invoking this method DOES NOT invoke handlers or MBW
// must not be null
public void setEntityStream(final InputStream entityStream);
// conveniece method for setting new input stream; DOES invoke
handlers & MBW
// produced input stream is not buffered by default
public <T> void writeEntity(
final Class<T> type,
final Annotation annotations[],
final MediaType mediaType,
final T entity);
public <T> void writeEntity(
final GenericType<T> genericType,
final Annotation annotations[],
final MediaType mediaType,
final T entity);
... and any other specific methods to a client response...
}
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com