本文整理汇总了Java中org.mortbay.jetty.servlet.ServletHolder.setName方法的典型用法代码示例。如果您正苦于以下问题:Java ServletHolder.setName方法的具体用法?Java ServletHolder.setName怎么用?Java ServletHolder.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mortbay.jetty.servlet.ServletHolder
的用法示例。
在下文中一共展示了ServletHolder.setName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filters
import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
* Add an internal servlet in the server, specifying whether or not to
* protect with Kerberos authentication.
* Note: This method is to be used for adding servlets that facilitate
* internal communication and not for user facing functionality. For
+ * servlets added using this method, filters (except internal Kerberos
* filters) are not enabled.
*
* @param name The name of the servlet (can be passed as null)
* @param pathSpec The path spec for the servlet
* @param clazz The servlet class
* @param requireAuth Require Kerberos authenticate to access servlet
*/
public void addInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz, boolean requireAuth) {
ServletHolder holder = new ServletHolder(clazz);
if (name != null) {
holder.setName(name);
}
webAppContext.addServlet(holder, pathSpec);
if(requireAuth && UserGroupInformation.isSecurityEnabled()) {
LOG.info("Adding Kerberos (SPNEGO) filter to " + name);
ServletHandler handler = webAppContext.getServletHandler();
FilterMapping fmap = new FilterMapping();
fmap.setPathSpec(pathSpec);
fmap.setFilterName(SPNEGO_FILTER);
fmap.setDispatches(Handler.ALL);
handler.addFilterMapping(fmap);
}
}
示例2: filters
import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
* Add an internal servlet in the server, specifying whether or not to
* protect with Kerberos authentication.
* Note: This method is to be used for adding servlets that facilitate
* internal communication and not for user facing functionality. For
+ * servlets added using this method, filters (except internal Kerberos
* filters) are not enabled.
*
* @param name The name of the servlet (can be passed as null)
* @param pathSpec The path spec for the servlet
* @param clazz The servlet class
* @param requireAuth Require Kerberos authenticate to access servlet
*/
public void addInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz, boolean requireAuth) {
ServletHolder holder = new ServletHolder(clazz);
if (name != null) {
holder.setName(name);
}
webAppContext.addServlet(holder, pathSpec);
if(requireAuth && UserGroupInformation.isSecurityEnabled()) {
LOG.info("Adding Kerberos (SPNEGO) filter to " + name);
ServletHandler handler = webAppContext.getServletHandler();
FilterMapping fmap = new FilterMapping();
fmap.setPathSpec(pathSpec);
fmap.setFilterName(SPNEGO_FILTER);
fmap.setDispatches(Handler.ALL);
handler.addFilterMapping(fmap);
}
}
示例3: addInternalServlet
import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
* Add an internal servlet in the server, specifying whether or not to
* protect with Kerberos authentication.
* Note: This method is to be used for adding servlets that facilitate
* internal communication and not for user facing functionality. For
* servlets added using this method, filters (except internal Kerberos
* filters) are not enabled.
*
* @param name The name of the servlet (can be passed as null)
* @param pathSpec The path spec for the servlet
* @param clazz The servlet class
* @param requireAuth Require Kerberos authenticate to access servlet
*/
public void addInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz, boolean requireAuth) {
ServletHolder holder = new ServletHolder(clazz);
if (name != null) {
holder.setName(name);
}
webAppContext.addServlet(holder, pathSpec);
if(requireAuth && UserGroupInformation.isSecurityEnabled()) {
LOG.info("Adding Kerberos (SPNEGO) filter to " + name);
ServletHandler handler = webAppContext.getServletHandler();
FilterMapping fmap = new FilterMapping();
fmap.setPathSpec(pathSpec);
fmap.setFilterName(SPNEGO_FILTER);
fmap.setDispatches(Handler.ALL);
handler.addFilterMapping(fmap);
}
}
示例4: startHttpServer
import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
private void startHttpServer() throws Exception {
server = new Server();
SelectChannelConnector selectChannelConnector = new SelectChannelConnector();
selectChannelConnector.setPort(11060);
server.setConnectors(new Connector[]{selectChannelConnector});
PackagesResourceConfig packagesResourceConfig = new PackagesResourceConfig("com/ngdata/hbaseindexer/rest");
ServletHolder servletHolder = new ServletHolder(new ServletContainer(packagesResourceConfig));
servletHolder.setName("HBase-Indexer");
Context context = new Context(server, "/", Context.NO_SESSIONS);
context.addServlet(servletHolder, "/*");
context.setContextPath("/");
context.setAttribute("indexerModel", indexerModel);
context.setAttribute("indexerSupervisor", indexerSupervisor);
server.setHandler(context);
server.start();
}
示例5: addInternalServlet
import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
* Add an internal servlet in the server.
* @param name The name of the servlet (can be passed as null)
* @param pathSpec The path spec for the servlet
* @param clazz The servlet class
* @deprecated this is a temporary method
*/
@Deprecated
public void addInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
ServletHolder holder = new ServletHolder(clazz);
if (name != null) {
holder.setName(name);
}
webAppContext.addServlet(holder, pathSpec);
}
示例6: main
import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void main(String[] args) {
/* parse properties */
int port = 8989;
for (String arg: args) {
if (arg.startsWith("-Droot="))
rootPath = arg.substring(7);
else if (arg.startsWith("-DWOPort="))
port = Integer.parseInt(arg.substring(9));
}
/* setup HTTP server */
Server server = new Server(port);
log.info("application started on HTTP port: " + port);
/* create a context */
org.mortbay.jetty.servlet.Context root =
new org.mortbay.jetty.servlet.Context(server, "/",
org.mortbay.jetty.servlet.Context.NO_SESSIONS |
org.mortbay.jetty.servlet.Context.NO_SECURITY);
/* a ServletHolder wraps a Servlet configuration in Jetty */
String _appName = "org.opengroupware.pubexport.OGoPubExport";
ServletHolder servletHolder = new ServletHolder(WOServletAdaptor.class);
servletHolder.setName(_appName);
servletHolder.setInitParameter("WOAppName", _appName);
/* This makes the Servlet being initialize on startup (instead of first
* request).
*/
servletHolder.setInitOrder(10); /* positive values: init asap */
/* add Servlet to the Jetty Context */
root.addServlet(servletHolder, "/");
/* start server */
log.debug("starting Jetty ...");
try {
server.start();
log.debug("Jetty is running ...");
}
catch (Exception e) {
log.error("Jetty exception", e);
}
}