本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: createServletContextHandler
private ServletContextHandler createServletContextHandler() {
ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
servletContextHandler.setContextPath("/");
servletContextHandler.setDisplayName(getDisplayName(listenedPorts));
return servletContextHandler;
}
示例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;
}