Package org.apache.http.nio.entity

Examples of org.apache.http.nio.entity.NFileEntity


                        "UTF-8");
                entity.setContentType("text/html; charset=UTF-8");
                response.setEntity(entity);
            } else {
                response.setStatusCode(HttpStatus.SC_OK);
                NFileEntity entity = new NFileEntity(file, "text/html", useFileChannels);
                response.setEntity(entity);
            }
        }
View Full Code Here


            } else {
                NHttpConnection conn = (NHttpConnection) context.getAttribute(
                        ExecutionContext.HTTP_CONNECTION);
                response.setStatusCode(HttpStatus.SC_OK);
                NFileEntity body = new NFileEntity(file, ContentType.create("text/html"));
                response.setEntity(body);
                System.out.println(conn + ": serving file " + file.getPath());
            }
        }
View Full Code Here

                }
            } finally {
                instream.close();
            }
            if (ok) {
                NFileEntity responseEntity = new NFileEntity(TEST_FILE,
                        ContentType.create("text/plian"));
                if (this.forceChunking) {
                    responseEntity.setChunked(true);
                }
                response.setEntity(responseEntity);
            } else {
                response.setEntity(new NStringEntity("Invalid content"));
            }
View Full Code Here

                System.out.println("Cannot read file " + file.getPath());

            } else {

                response.setStatusCode(HttpStatus.SC_OK);
                NFileEntity body = new NFileEntity(file, ContentType.create("text/html", null));
                response.setEntity(body);
                System.out.println("Serving file " + file.getPath());
            }
        }
View Full Code Here

                System.out.println("Cannot read file " + file.getPath());

            } else {

                response.setStatusCode(HttpStatus.SC_OK);
                NFileEntity body = new NFileEntity(file, ContentType.create("text/html", null));
                response.setEntity(body);
                System.out.println("Serving file " + file.getPath());
            }
        }
View Full Code Here

            } else {
                NHttpConnection conn = (NHttpConnection) context.getAttribute(
                        ExecutionContext.HTTP_CONNECTION);
                response.setStatusCode(HttpStatus.SC_OK);
                NFileEntity body = new NFileEntity(file, ContentType.create("text/html"));
                response.setEntity(body);
                System.out.println(conn + ": serving file " + file.getPath());
            }
        }
View Full Code Here

                System.out.println("Cannot read file " + file.getPath());

            } else {
                NHttpConnection conn = coreContext.getConnection(NHttpConnection.class);
                response.setStatusCode(HttpStatus.SC_OK);
                NFileEntity body = new NFileEntity(file, ContentType.create("text/html"));
                response.setEntity(body);
                System.out.println(conn + ": serving file " + file.getPath());
            }
        }
View Full Code Here

                System.out.println("Using URI: " + uploadUrl);
                DefaultHttpClient client = new DefaultHttpClient();
                HttpPut put = new HttpPut(uploadUrl);
                client.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("admin", "admin"));

                NFileEntity entity = new NFileEntity(new File(featureLocation), "text/xml");
                put.setEntity(entity);
                HttpClient c = client;
                HttpResponse response = c.execute(put);
                System.out.println("Response:" + response.getStatusLine());
                Assert.assertTrue(response.getStatusLine().getStatusCode() == 200 || response.getStatusLine().getStatusCode() == 202);
View Full Code Here

TOP

Related Classes of org.apache.http.nio.entity.NFileEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.