code: public static Response getEntity(InputStream is, Class<?> type) {
  		Object entity;
  		try {
  			if (is != null && is.available() > 0) {
  				if (is.available() > Config.MAX_ENTITY_SIZE_BYTES) {
  					return getStatusResponse(Response.Status.BAD_REQUEST,
  							"Request is too large - the maximum is " +
  							(Config.MAX_ENTITY_SIZE_BYTES / 1024) + " KB.");
  				}
  				if (type == null) {
  					entity = is;
  				} else {
  					entity = ParaObjectUtils.getJsonReader(type).readValue(is);
  				}
  			} else {
  				return getStatusResponse(Response.Status.BAD_REQUEST, "Missing request body.");
  			}
  		} catch (JsonMappingException e) {
  			return getStatusResponse(Response.Status.BAD_REQUEST, e.getMessage());
  		} catch (JsonParseException e) {
  			return getStatusResponse(Response.Status.BAD_REQUEST, e.getMessage());
  		} catch (IOException e) {
  			logger.error(null, e);
  			return getStatusResponse(Response.Status.INTERNAL_SERVER_ERROR, e.toString());
  		}
  
  		return Response.ok(entity).build();
  	}
docs: Returns a Response with the entity object inside it and 200 status code.
  If there was and error the status code is different than 200.
  
  @param is the entity input stream
  @param type the type to convert the entity into, for example a Map. If null, this returns the InputStream.
  @return response with 200 or error status