Package org.simpleframework.http.core

Examples of org.simpleframework.http.core.Container


                setAddress(new InetSocketAddress(getHelped().getPort()));
            }
        }

        // Complete initialization
        Container container = new SimpleContainer(this);
        ContainerServer server = new ContainerServer(container,
                getDefaultThreads());
        SimpleServer filter = new SimpleServer(server);
        Connection connection = new SocketConnection(filter);
        setConfidential(true);
View Full Code Here


            // Use ephemeral port
            if (port > 0) {
                setAddress(new InetSocketAddress(getHelped().getPort()));
            }
        }
        final Container container = new SimpleContainer(this);
        final ContainerServer server = new ContainerServer(container,
                getDefaultThreads());
        final SimpleServer restletServer = new SimpleServer(server);
        final Connection connection = new SocketConnection(restletServer);
View Full Code Here

            e.printStackTrace();
        }
    }

    public static void main(String[] list) throws Exception {
        Container container = new HelloWorld();
        Server server = new ContainerServer(container);
        Connection connection = new SocketConnection(server);
        SocketAddress address = new InetSocketAddress(8080);

        connection.connect(address);
View Full Code Here

     * @param port port of the server
     * @throws Exception
     */
   public void start(int port) throws Exception {
      ServerLyzer.port = port;
      Container container = new ServerLyzer(config);
      Server server = new ContainerServer(container);
      this.connection = new SocketConnection(server);
      SocketAddress address = new InetSocketAddress(port);
      System.out.println("Starting server on port "+port);
      this.connection.connect(address);
View Full Code Here

 
  public static Connection connection;
  public PrintStream stdOut = System.out;

  public static void start() throws Exception {
    Container container = new HttpServer();
    Server server = new ContainerServer(container);
    connection = new SocketConnection(server);
    SocketAddress address = new InetSocketAddress(Integer.valueOf(StartMain.args[0]));
   
    connection.connect(address);
View Full Code Here

  private static SocketConnection socketConnection;
  private static String baseUrl;

  @BeforeClass
  public static void startServer() throws IOException {
    socketConnection = new SocketConnection(new Container() {
      public void handle(Request req, Response resp) {
        try {
          if (req.getPath().getPath().contains("/redirect/")) {
            resp.setCode(303);
            resp.add("Location", "/");
View Full Code Here

    private String responseText = "";
    private int code = 200;

    public DummyServer() {
        try {
            connection = new SocketConnection(new Container(){
                @Override public void handle(Request request, Response response) {
                    try {
                        handleSafely(response);
                    } catch (IOException e) {
                        throw new IllegalStateException(e);
View Full Code Here

import java.net.InetSocketAddress;

public class SimpleHttpFileServerFactory implements HttpFileServerFactory {

    public HttpFileServer start(File contentRoot, int port) {
        Container container = new SimpleFileServerContainer(new FileContext(contentRoot));

        try {
            final Server server = new ContainerServer(container);
            Connection connection = new SocketConnection(server);
            InetSocketAddress address = new InetSocketAddress(port);
View Full Code Here

        logger.debug("starting web server");
        WebServers.register(this);

        router = setupRouter();

        Container container = new Container() {
            @Override
            public void handle(Request request, Response response) {
                try {
                    if (request.getTarget().startsWith(routerPath)) {
                        router.route(
View Full Code Here

TOP

Related Classes of org.simpleframework.http.core.Container

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.