當前位置: 首頁>>代碼示例>>Java>>正文


Java ServletContextHandler.NO_SECURITY屬性代碼示例

本文整理匯總了Java中org.eclipse.jetty.servlet.ServletContextHandler.NO_SECURITY屬性的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextHandler.NO_SECURITY屬性的具體用法?Java ServletContextHandler.NO_SECURITY怎麽用?Java ServletContextHandler.NO_SECURITY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.jetty.servlet.ServletContextHandler的用法示例。


在下文中一共展示了ServletContextHandler.NO_SECURITY屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createServletForConnector

protected CamelServlet createServletForConnector(Server server, Connector connector,
                                                 List<Handler> handlers, JettyHttpEndpoint endpoint) throws Exception {
    ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
    if (Server.getVersion().startsWith("8")) {
        context.getClass().getMethod("setConnectorNames", new Class[] {String[].class})
            .invoke(context, new Object[] {new String[] {connector.getName()}});
    }

    addJettyHandlers(server, handlers);

    CamelServlet camelServlet = new CamelContinuationServlet();
    ServletHolder holder = new ServletHolder();
    holder.setServlet(camelServlet);
    holder.setAsyncSupported(true);
    holder.setInitParameter(CamelServlet.ASYNC_PARAM, Boolean.toString(endpoint.isAsync()));
    context.addServlet(holder, "/*");

    // use rest enabled resolver in case we use rest
    camelServlet.setServletResolveConsumerStrategy(new HttpRestServletResolveConsumerStrategy());

    return camelServlet;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:22,代碼來源:JettyHttpComponent.java

示例2: createContext

protected ServletContextHandler createContext(Server server, Connector connector, List<Handler> handlers) throws Exception {
    ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
    server.addConnector(connector);

    if (handlers != null && !handlers.isEmpty()) {
        for (Handler handler : handlers) {
            if (handler instanceof HandlerWrapper) {
                ((HandlerWrapper) handler).setHandler(server.getHandler());
                server.setHandler(handler);
            } else {
                HandlerCollection handlerCollection = new HandlerCollection();
                handlerCollection.addHandler(server.getHandler());
                handlerCollection.addHandler(handler);
                server.setHandler(handlerCollection);
            }
        }
    }

    return context;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:20,代碼來源:WebsocketComponent.java

示例3: createServletForConnector

protected CamelServlet createServletForConnector(Server server, Connector connector,
                                                 List<Handler> handlers, JettyHttpEndpoint endpoint) throws Exception {
    ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
    if (Server.getVersion().startsWith("8")) {
        context.getClass().getMethod("setConnectorNames", new Class[] {String[].class})
            .invoke(context, new Object[] {new String[] {connector.getName()}});
    }

    addJettyHandlers(server, handlers);

    CamelServlet camelServlet;
    boolean jetty = endpoint.getUseContinuation() != null ? endpoint.getUseContinuation() : isUseContinuation();
    if (jetty) {
        // use Jetty continuations
        CamelContinuationServlet jettyServlet = new CamelContinuationServlet();
        // configure timeout and log it so end user know what we are using
        Long timeout = endpoint.getContinuationTimeout() != null ? endpoint.getContinuationTimeout() : getContinuationTimeout();
        if (timeout != null) {
            LOG.info("Using Jetty continuation timeout: " + timeout + " millis for: " + endpoint);
            jettyServlet.setContinuationTimeout(timeout);
        } else {
            LOG.info("Using default Jetty continuation timeout for: " + endpoint);
        }

        // use the jetty servlet
        camelServlet = jettyServlet;
    } else {
        // do not use jetty so use a plain servlet
        camelServlet = new CamelServlet();
        LOG.info("Jetty continuation is disabled for: " + endpoint);
    }

    ServletHolder holder = new ServletHolder();
    holder.setServlet(camelServlet);
    context.addServlet(holder, "/*");

    // use rest enabled resolver in case we use rest
    camelServlet.setServletResolveConsumerStrategy(new JettyRestServletResolveConsumerStrategy());

    return camelServlet;
}
 
開發者ID:nkasvosve,項目名稱:beyondj,代碼行數:41,代碼來源:JettyHttpComponent.java

示例4: createServletContextHandler

private ServletContextHandler createServletContextHandler() {
    ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
    servletContextHandler.setContextPath("/");
    servletContextHandler.setDisplayName(getDisplayName(listenedPorts));
    return servletContextHandler;
}
 
開發者ID:vespa-engine,項目名稱:vespa,代碼行數:6,代碼來源:JettyHttpServer.java

示例5: createServletForConnector

protected CometDServlet createServletForConnector(Server server, Connector connector, CometdEndpoint endpoint) throws Exception {
    CometDServlet servlet = new CometDServlet();

    ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);

    ServletHolder holder = new ServletHolder();
    holder.setServlet(servlet);
    holder.setAsyncSupported(true);

    // Use baseResource to pass as a parameter the url
    // pointing to by example classpath:webapp
    if (endpoint.getBaseResource() != null) {
        String[] resources = endpoint.getBaseResource().split(":");
        if (LOG.isDebugEnabled()) {
            LOG.debug(">>> Protocol found: " + resources[0] + ", and resource: " + resources[1]);
        }

        if (resources[0].equals("file")) {
            context.setBaseResource(Resource.newResource(resources[1]));
        } else if (resources[0].equals("classpath")) {
            // Create a URL handler using classpath protocol
            URL url = this.getCamelContext().getClassResolver().loadResourceAsURL(resources[1]);
            context.setBaseResource(Resource.newResource(url));
        }
    }

    applyCrossOriginFiltering(endpoint, context);

    context.addServlet(holder, "/cometd/*");
    context.addServlet("org.eclipse.jetty.servlet.DefaultServlet", "/");
    context.setSessionHandler(new SessionHandler(new HashSessionManager()));

    holder.setInitParameter("timeout", Integer.toString(endpoint.getTimeout()));
    holder.setInitParameter("interval", Integer.toString(endpoint.getInterval()));
    holder.setInitParameter("maxInterval", Integer.toString(endpoint.getMaxInterval()));
    holder.setInitParameter("multiFrameInterval", Integer.toString(endpoint.getMultiFrameInterval()));
    holder.setInitParameter("JSONCommented", Boolean.toString(endpoint.isJsonCommented()));
    holder.setInitParameter("logLevel", Integer.toString(endpoint.getLogLevel()));

    return servlet;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:41,代碼來源:CometdComponent.java


注:本文中的org.eclipse.jetty.servlet.ServletContextHandler.NO_SECURITY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。