当前位置: 首页>>代码示例>>Java>>正文


Java ServletHolder.setName方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:32,代码来源:HttpServer.java

示例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);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:32,代码来源:HttpServer2.java

示例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);
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:32,代码来源:HttpServer.java

示例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();
}
 
开发者ID:NGDATA,项目名称:hbase-indexer,代码行数:22,代码来源:Main.java

示例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);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:17,代码来源:HttpServer.java

示例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);
  }
}
 
开发者ID:AlwaysRightInstitute,项目名称:StaticCMS,代码行数:50,代码来源:pubd.java


注:本文中的org.mortbay.jetty.servlet.ServletHolder.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。