@POST
    @Consumes("multipart/form-data")
    @Produces("application/json")
    @Path("form{" + HANDLER_TYPE_PARAM + " : (\\w+)?}")
    public Metadata getJsonFromMultipart(Attachment att, @Context HttpHeaders httpHeaders, @Context final UriInfo info, @PathParam(HANDLER_TYPE_PARAM) String handlerTypeName)
            throws IOException, TikaException {
        Metadata metadata = new Metadata();
        parseToMetadata(getInputStream(att.getObject(InputStream.class), metadata, httpHeaders, info), metadata, preparePostHeaderMap(att, httpHeaders), info, handlerTypeName);
        TikaResource
                .getConfig()
                .getMetadataFilter()
                .filter(metadata);
        return metadata;
    }
Use this to call a parser and unify exception handling.
NOTE: This call to parse closes the InputStream. DO NOT surround
the call in an auto-close block.

@param parser       parser to use
@param logger       logger to use
@param path         file path
@param inputStream  inputStream (which is closed by this call!)
@param handler      handler to use
@param metadata     metadata
@param parseContext parse context
@throws IOException wrapper for all exceptions
tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaResource.java