Code example for HttpEntityEnclosingRequest

Methods: getEntity

0
 
        public ConsumingNHttpEntity entityRequest( 
                final HttpEntityEnclosingRequest request,
                final HttpContext context) throws HttpException, IOException {
            return new ConsumingNHttpEntityTemplate( 
                    request.getEntity(),
                    new FileWriteListener(useFileChannels));
        } 
 
        @Override 
        public void handle( 
                final HttpRequest request,
                final HttpResponse response,
                final HttpContext context) throws HttpException, IOException {
            String target = request.getRequestLine().getUri();
            final File file = new File(this.docRoot, URLDecoder.decode(target, "UTF-8"));
            if (!file.exists()) {
                response.setStatusCode(HttpStatus.SC_NOT_FOUND);
                NStringEntity entity = new NStringEntity(
                        "<html><body><h1>File" + file.getPath() +
Contextual code suggestions in your IDE  Get Codota for Java