Package org.apache.http.nio.entity

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


 
              } 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", null));
                if (this.forceChunking) {
                    responseEntity.setChunked(true);
                }
                response.setEntity(responseEntity);
            } else {
                response.setEntity(new NStringEntity("Invalid content"));
            }
View Full Code Here

                // write header buffer
                webcontext.getResponse().writeHeaderBuffer();
               
                return new NStringEntity(template, UTF8);
            } else {
                return new NFileEntity(file, contentType);
            }

        } catch (Throwable t) {
            // error creating entity
        }
        return new NFileEntity(file, contentType);
    }
View Full Code Here

                        "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;charset=UTF-8", useFileChannels);
                response.setEntity(entity);
            }
        }
View Full Code Here

                        "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

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

            } else {

                response.setStatusCode(HttpStatus.SC_OK);
                NFileEntity body = new NFileEntity(file, "text/html");
                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, "text/html");
                response.setEntity(body);
                System.out.println("Serving file " + file.getPath());

            }
        }
View Full Code Here

                        "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", null));
                response.setEntity(body);
                System.out.println(conn + ": serving file " + file.getPath());
            }
        }
View Full Code Here

                }
            } finally {
                instream.close();
            }
            if (ok) {
                final 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

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.