environ.put("PATH_INFO", StringUtils.join(seg.toArray(), "/"));
//environ.put("PATH_INFO", );
environ.put("QUERY_STRING", request.getResourceRef().getQuery());
environ.put("wsgi.version", new PyTuple(new PyInteger(0), new PyInteger(1)));
environ.put("wsgi.url_scheme", ref.getScheme());
environ.put("wsgi.input", new PyFile(request.getEntity().getStream()));
environ.put("wsgi.errors", new PyFile(System.err));
environ.put("wsgi.multithread", true);
environ.put("wsgi.multitprocess", false);