Examples of HttpServer


Examples of org.openqa.jetty.http.HttpServer

                sendForbid(request, response, uri);
            } else {
                HttpConnection http_connection = request.getHttpConnection();
                http_connection.forceClose();

                HttpServer server = http_connection.getHttpServer();

                SslRelay listener = getSslRelayOrCreateNew(uri, addrPort, server);
                                                    
                int port = listener.getPort();
View Full Code Here

Examples of org.papoose.http.HttpServer

        Properties properties = new Properties();

        properties.setProperty(HttpServer.HTTP_PORT, "8080");

        HttpServer server = JettyHttpServer.generate(properties);

        server.start();

        HttpServiceImpl httpService = new HttpServiceImpl(bundleContext, server.getServletDispatcher());

        httpService.start();
        bundleContext.registerService(HttpService.class.getName(), httpService, null);

        try
        {
            ServiceReference sr = bundleContext.getServiceReference(HttpService.class.getName());
            HttpService service = (HttpService) bundleContext.getService(sr);

            service.registerResources("/a/b", "/org/papoose/tck", new HttpContext()
            {
                public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException
                {
                    return true;
                }

                public URL getResource(String name)
                {
                    return HttpServiceImplTest.class.getResource(name);
                }

                public String getMimeType(String name)
                {
                    return null;
                }
            });

            URL url = new URL("http://localhost:8080/a/b/http/HttpServiceImplTest.class");

            DataInputStream reader = new DataInputStream(url.openStream());

            assertEquals((byte) 0xca, reader.readByte());
            assertEquals((byte) 0xfe, reader.readByte());

            assertEquals((byte) 0xba, reader.readByte());
            assertEquals((byte) 0xbe, reader.readByte());

            service.unregister("/a/b");
        }
        finally
        {
            httpService.stop();
            server.stop();
        }
    }
View Full Code Here

Examples of org.uscxml.HTTPServer

public class TestVoiceXMLInvoker {

  public static void main(String[] args) throws IOException, InterpreterException {
    System.load("/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava64.jnilib");

    HTTPServer http = HTTPServer.getInstance(5080, 5081);
   
    URL jVoiceXMLDoc = new URL(new URL("file:"), "../../test/uscxml/test-jvoicexml.scxml");
    Interpreter interpreter = Interpreter.fromURI(jVoiceXMLDoc);
    interpreter.interpret();
  }
View Full Code Here

Examples of org.vertx.java.core.http.HttpServer

  Logger logger;

  public void start() {
    logger = container.logger();
   
    HttpServer server = vertx.createHttpServer();

    // Also serve the static resources. In real life this would probably be done by a CDN
    server.requestHandler(new Handler<HttpServerRequest>() {
      public void handle(HttpServerRequest req) {
        if (req.path().equals("/")) req.response().sendFile("eventbusbridge/index.html"); // Serve the index.html
        if (req.path().endsWith("vertxbus.js")) req.response().sendFile("eventbusbridge/vertxbus.js"); // Serve the js
      }
    });

    JsonArray permitted = new JsonArray();
    permitted.add(new JsonObject()); // Let everything through

    ServerHook hook = new ServerHook(logger);

    SockJSServer sockJSServer = vertx.createSockJSServer(server);
    sockJSServer.setHook(hook);
    sockJSServer.bridge(new JsonObject().putString("prefix", "/eventbus"), permitted, permitted);

    server.listen(8080);
  }
View Full Code Here

Examples of org.wikipediacleaner.api.HttpServer

    if (!useBotList) {
      properties.put("view", "bots");
      String url = useLabs ?
          "checkwiki/cgi-bin/checkwiki.cgi" :
          "~sk/cgi-bin/checkwiki/checkwiki.cgi";
      HttpServer server = useLabs ? labs : toolServer;
      server.sendPost(
          url, properties,
          new PagesResponseManager(true, algorithm, wiki, errors));
    } else {
      properties.put("action", "list");
      String url = useLabs ?
          "checkwiki/cgi-bin/checkwiki_bots.cgi" :
          "~sk/cgi-bin/checkwiki/checkwiki_bots.cgi";
      HttpServer server = useLabs ? labs : toolServer;
      server.sendPost(
          url, properties,
          new PagesResponseManager(false, algorithm, wiki, errors));
    }
  }
View Full Code Here

Examples of org.xlightweb.server.HttpServer

   
    @BeforeClass
    public static void setUp() throws Exception {
        IHttpRequestHandler hdl = new RequestHandler();
       
        proxyServer = new HttpServer(0, hdl);
        proxyServer.start();
       
        proxySslServer = new HttpServer(0, hdl, SSLTestContextFactory.getSSLContext(), true);
        proxySslServer.start();
       
       
        IHttpRequestHandler busiHdl = new BusinessRequestHandler();
        server = new HttpServer(0, busiHdl);
        server.start();
       
        sslServer = new HttpServer(0, busiHdl, SSLTestContextFactory.getSSLContext(), true);
        sslServer.start();

    }
View Full Code Here

Examples of org.xlightweb.server.HttpServer

  @Test
  public void testSimple() throws Exception {
     

      RequestHandler reqHdl = new RequestHandler();
      HttpServer server = new HttpServer(reqHdl);
      server.start();
     
     
      HttpClient httpClient = new HttpClient();
     
      FutureResponseHandler hdl = new FutureResponseHandler();
      BodyDataSink ds = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/test"), 100, hdl);
      for (int i = 0; i < 10; i++) {
            ds.write("0123456789");
        }
        ds.close();
       
       
        IHttpResponse response = hdl.get();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals(100, response.getBlockingBody().readBytes().length);
     
      httpClient.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.server.HttpServer

    public void testMessageOrientedInterceptor() throws Exception {

        RequestHandlerChain chain = new RequestHandlerChain();
        chain.addLast(new MessageorientedInterceptor());
        chain.addLast(new RequestHandler());
        HttpServer server = new HttpServer(chain);
        server.start();
       
       
        HttpClient httpClient = new HttpClient();
       
        FutureResponseHandler hdl = new FutureResponseHandler();
        BodyDataSink ds = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/test"), 100, hdl);
        for (int i = 0; i < 10; i++) {
            ds.write("0123456789");
        }
        ds.close();
       
       
        IHttpResponse response = hdl.get();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("true", response.getHeader("X-Intercepted"));
        Assert.assertEquals(100, response.getBlockingBody().readBytes().length);
       
        httpClient.close();
        server.close();
    }
View Full Code Here

Examples of org.xlightweb.server.HttpServer

    public void testByteOrientedInterceptor() throws Exception {

        RequestHandlerChain chain = new RequestHandlerChain();
        chain.addLast(new ByteorientedForwardInterceptor());
        chain.addLast(new RequestHandler());
        HttpServer server = new HttpServer(chain);
        server.start();
       
       
        HttpClient httpClient = new HttpClient();
       
        FutureResponseHandler hdl = new FutureResponseHandler();
        BodyDataSink ds = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/test"), 100, hdl);
        for (int i = 0; i < 10; i++) {
            ds.write("0123456789");
        }
        ds.close();
       
       
        IHttpResponse response = hdl.get();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals(100, response.getBlockingBody().readBytes().length);
       
        httpClient.close();
        server.close();
    }
View Full Code Here

Examples of org.xlightweb.server.HttpServer

    public void testNonThreadedByteOrientedInterceptor() throws Exception {

        RequestHandlerChain chain = new RequestHandlerChain();
        chain.addLast(new NonTheadedByteorientedForwardInterceptor());
        chain.addLast(new RequestHandler());
        HttpServer server = new HttpServer(chain);
        server.start();
       
       
        HttpClient httpClient = new HttpClient();
       
        FutureResponseHandler hdl = new FutureResponseHandler();
        BodyDataSink ds = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/test"), 100, hdl);
        for (int i = 0; i < 10; i++) {
            ds.write("0123456789");
        }
        ds.close();
       
       
        IHttpResponse response = hdl.get();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals(100, response.getBlockingBody().readBytes().length);
       
        httpClient.close();
        server.close();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.