當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。