public ContainerRequest filter(ContainerRequest request) {
int contentLength = Integer.parseInt(request.getHeaderValue("Content-Length"));
// make it big enough to hold the path.
ByteBuffer buf = ByteBuffer.allocateDirect(contentLength + 128);
CodedOutputStream out = CodedOutputStream.newInstance(new ByteBufferBackedOutputStream(buf));
InputStream in = request.getEntityInputStream();
try {
if (in.available() > 0) {
// copy the json into a byte array. this will get reused later.