Package org.jboss.com.sun.net.httpserver

Examples of org.jboss.com.sun.net.httpserver.HttpContext


        *
        * (Later may change the return type to return the context so a sub-class can just continue after the parent class start)
        */
        @Override
        public void start(HttpServer httpServer, SecurityRealm securityRealm) {
            HttpContext httpContext = httpServer.createContext(getContext(), this);
            if (securityRealm != null
                    && securityRealm.getSupportedAuthenticationMechanisms().contains(AuthenticationMechanism.CLIENT_CERT) == false) {
                httpContext.getFilters().add(new RealmReadinessFilter(securityRealm, ErrorHandler.getRealmRedirect()));
            }
        }
View Full Code Here


        return parameters;
    }

    public void start(HttpServer httpServer, SecurityRealm securityRealm) {
        HttpContext context = httpServer.createContext(DOMAIN_API_CONTEXT, this);
        if (securityRealm != null) {
            DomainCallbackHandler callbackHandler = securityRealm.getCallbackHandler();
            Class[] supportedCallbacks = callbackHandler.getSupportedCallbacks();
            if (DigestAuthenticator.requiredCallbacksSupported(supportedCallbacks)) {
                context.setAuthenticator(new DigestAuthenticator(callbackHandler, securityRealm.getName(), contains(DigestHashCallback.class, supportedCallbacks)));
            } else if (BasicAuthenticator.requiredCallbacksSupported(supportedCallbacks)) {
                context.setAuthenticator(new BasicAuthenticator(callbackHandler, securityRealm.getName()));
            }
            context.getFilters().add(new RealmReadinessFilter(callbackHandler, ERROR_CONTEXT));
        }
    }
View Full Code Here

     * (Later may change the return type to return the context so a sub-class can just continue after the parent class start)
     */

    @Override
    public void start(HttpServer httpServer, SecurityRealm securityRealm) {
        HttpContext httpContext = httpServer.createContext(CONTEXT, this);
        if (securityRealm != null) {
            DomainCallbackHandler domainCBH = securityRealm.getCallbackHandler();
            httpContext.getFilters().add(new RealmReadinessFilter(domainCBH, ERROR_CONTEXT));
        }
    }
View Full Code Here

        return parameters;
    }

    public void start(HttpServer httpServer, SecurityRealm securityRealm) {
        HttpContext context = httpServer.createContext(DOMAIN_API_CONTEXT, this);
        if (securityRealm != null) {
            DomainCallbackHandler callbackHandler = securityRealm.getCallbackHandler();
            Class[] supportedCallbacks = callbackHandler.getSupportedCallbacks();
            if (DigestAuthenticator.requiredCallbacksSupported(supportedCallbacks)) {
                context.setAuthenticator(new DigestAuthenticator(callbackHandler, securityRealm.getName()));
            } else if (BasicAuthenticator.requiredCallbacksSupported(supportedCallbacks)) {
                context.setAuthenticator(new BasicAuthenticator(callbackHandler, securityRealm.getName()));
            }
        }
    }
View Full Code Here

        *
        * (Later may change the return type to return the context so a sub-class can just continue after the parent class start)
        */
        @Override
        public void start(HttpServer httpServer, SecurityRealm securityRealm) {
            HttpContext httpContext = httpServer.createContext(getContext(), this);
            if (securityRealm != null
                    && securityRealm.getSupportedAuthenticationMechanisms().contains(AuthenticationMechanism.CLIENT_CERT) == false) {
                httpContext.getFilters().add(new RedirectReadinessFilter(securityRealm, ErrorHandler.getRealmRedirect()));
            }
        }
View Full Code Here

    public static void main (String[] args) throws Exception {
        System.out.print ("Test 11: ");
        HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
        ExecutorService s = Executors.newCachedThreadPool();
        try {
            HttpContext ctx = server.createContext (
                "/foo/bar/", new Handler ()
            );
            s =  Executors.newCachedThreadPool();
            server.start ();
            URL url = new URL ("http://localhost:" + server.getAddress().getPort()+
View Full Code Here

    public static void main (String[] args) throws Exception {
        Handler handler = new Handler();
        InetSocketAddress addr = new InetSocketAddress (0);
        HttpServer server = HttpServer.create (addr, 0);
        HttpContext ctx = server.createContext ("/test", handler);
        ExecutorService executor = Executors.newCachedThreadPool();
        server.setExecutor (executor);
        server.start ();

        URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html");
View Full Code Here

        System.out.print ("Test4: ");
        Handler handler = new Handler();
        InetSocketAddress addr = new InetSocketAddress (0);
        HttpServer server = HttpServer.create (addr, 0);
        int port = server.getAddress().getPort();
        HttpContext c2 = server.createContext ("/test", handler);
        c2.getAttributes().put ("name", "This is the http handler");

        ExecutorService exec = Executors.newCachedThreadPool();
        server.setExecutor (exec);
        try {
            server.start ();
View Full Code Here

            "localhost", 0);
        HttpServer server = HttpServer.create(inetAddress, 5);
        int port = server.getAddress().getPort();
        ExecutorService e = (Executors.newFixedThreadPool(5));
        server.setExecutor(e);
        HttpContext context = server.createContext("/hello");
        server.start();
        context.setHandler(new HttpHandler() {
            public void handle(HttpExchange msg) {
                iter ++;
                System.out.println("Got request");
                switch (iter) {
                case 1:
View Full Code Here

    public static void main (String[] args) throws Exception {
        Handler handler = new Handler();
        InetSocketAddress addr = new InetSocketAddress (0);
        HttpServer server = HttpServer.create (addr, 0);
        HttpContext ctx = server.createContext ("/test", handler);

        ExecutorService executor = Executors.newCachedThreadPool();
        server.setExecutor (executor);
        server.start ();
View Full Code Here

TOP

Related Classes of org.jboss.com.sun.net.httpserver.HttpContext

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.