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


Java ServletHolder.setInitParameter方法代码示例

本文整理汇总了Java中org.mortbay.jetty.servlet.ServletHolder.setInitParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ServletHolder.setInitParameter方法的具体用法?Java ServletHolder.setInitParameter怎么用?Java ServletHolder.setInitParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mortbay.jetty.servlet.ServletHolder的用法示例。


在下文中一共展示了ServletHolder.setInitParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupPspMithraService

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
protected void setupPspMithraService()
    {
        server = new Server(this.getApplicationPort1());
        Context context = new Context (server,"/",Context.SESSIONS);
        ServletHolder holder = context.addServlet(PspServlet.class, "/PspServlet");
        holder.setInitParameter("serviceInterface.MasterCacheService", "com.gs.fw.common.mithra.cache.offheap.MasterCacheService");
        holder.setInitParameter("serviceClass.MasterCacheService", "com.gs.fw.common.mithra.cache.offheap.MasterCacheServiceImpl");
        holder.setInitOrder(10);
//        System.out.println(holder.getServlet().getClass().getName());

        try
        {
            server.start();
        }
        catch (Exception e)
        {
            throw new RuntimeException("could not start server", e);
        }
        finally
        {
        }
    }
 
开发者ID:goldmansachs,项目名称:reladomo,代码行数:23,代码来源:CacheReplicationTestCase.java

示例2: setupServerWithHandler

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
protected void setupServerWithHandler(
        Handler handler) throws Exception
{
    this.port = (int) (Math.random() * 10000.0 + 10000.0);
    this.pspUrl = "http://localhost:" + this.port + "/PspServlet";
    this.server = new Server(this.port);
    Context context = new Context(server, "/", Context.SESSIONS);
    if (handler != null)
    {
        context.addHandler(handler);
    }
    ServletHolder holder = context.addServlet(PspServlet.class, "/PspServlet");
    holder.setInitParameter("serviceInterface.Echo", "com.gs.fw.common.mithra.test.tinyproxy.Echo");
    holder.setInitParameter("serviceClass.Echo", "com.gs.fw.common.mithra.test.tinyproxy.EchoImpl");
    holder.setInitOrder(10);

    this.server.start();
    this.servlet = (PspServlet) holder.getServlet();
}
 
开发者ID:goldmansachs,项目名称:reladomo,代码行数:20,代码来源:PspTestCase.java

示例3: setupPspMithraService

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
protected void setupPspMithraService()
{
    server = new Server(this.getApplicationPort1());
    Context context = new Context (server,"/",Context.SESSIONS);
    ServletHolder holder = context.addServlet(PspServlet.class, "/PspServlet");
    holder.setInitParameter("serviceInterface.RemoteMithraService", "com.gs.fw.common.mithra.remote.RemoteMithraService");
    holder.setInitParameter("serviceClass.RemoteMithraService", "com.gs.fw.common.mithra.remote.RemoteMithraServiceImpl");
    holder.setInitOrder(10);

    try
    {
        server.start();
    }
    catch (Exception e)
    {
        throw new RuntimeException("could not start server", e);
    }
    finally
    {
    }
}
 
开发者ID:goldmansachs,项目名称:reladomo,代码行数:22,代码来源:RemoteMithraServerTestCase.java

示例4: createHandler

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
private Context createHandler(
    Map<String, Path> runfiles,
    ImmutableList<Route> routes,
    ImmutableList<Class<? extends Filter>> filters) {
  Context context = new Context(server, CONTEXT_PATH, Context.SESSIONS);
  context.addServlet(new ServletHolder(HealthzServlet.class), "/healthz");
  for (Map.Entry<String, Path> runfile : runfiles.entrySet()) {
    context.addServlet(
        StaticResourceServlet.create(runfile.getKey(), runfile.getValue()),
        runfile.getKey());
  }
  for (Route route : routes) {
    context.addServlet(
        new ServletHolder(wrapServlet(route.servletClass(), filters)), route.path());
  }
  ServletHolder holder = new ServletHolder(DefaultServlet.class);
  holder.setInitParameter("aliases", "1");
  context.addServlet(holder, "/*");
  return context;
}
 
开发者ID:google,项目名称:nomulus,代码行数:21,代码来源:TestServer.java

示例5: create

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
 * Creates a servlet holder for this servlet so it can be used with Jetty.
 *
 * @param prefix servlet path starting with a slash and ending with {@code "/*"} if {@code root}
 *     is a directory
 * @param root file or root directory to serve
 */
public static ServletHolder create(String prefix, Path root) {
  root = root.toAbsolutePath();
  checkArgument(Files.exists(root), "Root must exist: %s", root);
  checkArgument(prefix.startsWith("/"), "Prefix must start with a slash: %s", prefix);
  ServletHolder holder = new ServletHolder(StaticResourceServlet.class);
  holder.setInitParameter("root", root.toString());
  if (Files.isDirectory(root)) {
    checkArgument(prefix.endsWith("/*"),
        "Prefix (%s) must end with /* since root (%s) is a directory", prefix, root);
    holder.setInitParameter("prefix", prefix.substring(0, prefix.length() - 1));
  } else {
    holder.setInitParameter("prefix", prefix);
  }
  return holder;
}
 
开发者ID:google,项目名称:nomulus,代码行数:23,代码来源:StaticResourceServlet.java

示例6: start

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void start() throws Exception {

        RealmService realmService = new InMemoryRealmService();
        RegistryContext regContext = RegistryContext.getBaseInstance(realmService);
        regContext.selectDBConfig("in-memory");
        //RegistryContext.setSingleton(regContext);

        server = new Server(port);
        Context context = new Context(server, null/*RegistryProvider.baseURI*/, Context.SESSIONS);
        ServletHolder servletHolder = new ServletHolder(new AbderaServlet());
        servletHolder.setInitParameter(ServiceManager.PROVIDER,
                                       RegistryProvider.class.getName());
        context.addServlet(servletHolder, "/*");
        server.start();

//        root.addServlet(new ServletHolder(new RegistryServlet()), "/resources/*");
//        root.addServlet(new ServletHolder(new AbderaServlet()), "/atom/*");
//        server.start();
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:RegistryServer.java

示例7: startServer

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void startServer(int port, String classBound) throws BindException,
		Exception {
	sh = new ServletHolder(ServletContainer.class);

	sh.setInitParameter(
			"com.sun.jersey.config.property.resourceConfigClass",
			"com.sun.jersey.api.core.PackagesResourceConfig");
	sh.setInitParameter("com.sun.jersey.config.property.packages",
			classBound);

	// custom parameters
	// Map<String, Object> initParameters = getCustomInitParamters(port);
	// sh.setInitParameters(initParameters);

	Server server = new Server(port);

	Context context = new Context(server, "/", Context.SESSIONS);

	context.addServlet(sh, "/*");
	server.start();

}
 
开发者ID:Aeronbroker,项目名称:Aeron,代码行数:23,代码来源:ServerDummy.java

示例8: addJerseyResourcePackage

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
 * Add a Jersey resource package.
 * @param packageName The Java package name containing the Jersey resource.
 * @param pathSpec The path spec for the servlet
 */
public void addJerseyResourcePackage(final String packageName,
    final String pathSpec) {
  LOG.info("addJerseyResourcePackage: packageName=" + packageName
      + ", pathSpec=" + pathSpec);
  final ServletHolder sh = new ServletHolder(ServletContainer.class);
  sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
      "com.sun.jersey.api.core.PackagesResourceConfig");
  sh.setInitParameter("com.sun.jersey.config.property.packages", packageName);
  webAppContext.addServlet(sh, pathSpec);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:16,代码来源:HttpServer2.java

示例9: start

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void start() {
    String serverPort = ConfigUtils.getProperty(JETTY_PORT);
    int port;
    if (serverPort == null || serverPort.length() == 0) {
        port = DEFAULT_JETTY_PORT;
    } else {
        port = Integer.parseInt(serverPort);
    }
    connector = new SelectChannelConnector();
    connector.setPort(port);
    ServletHandler handler = new ServletHandler();
    
    String resources = ConfigUtils.getProperty(JETTY_DIRECTORY);
    if (resources != null && resources.length() > 0) {
        FilterHolder resourceHolder = handler.addFilterWithMapping(ResourceFilter.class, "/*", Handler.DEFAULT);
        resourceHolder.setInitParameter("resources", resources);
    }
    
    ServletHolder pageHolder = handler.addServletWithMapping(PageServlet.class, "/*");
    pageHolder.setInitParameter("pages", ConfigUtils.getProperty(JETTY_PAGES));
    pageHolder.setInitOrder(2);
    
    Server server = new Server();
    server.addConnector(connector);
    server.addHandler(handler);
    try {
        server.start();
    } catch (Exception e) {
        throw new IllegalStateException("Failed to start jetty server on " + NetUtils.getLocalHost() + ":" + port + ", cause: " + e.getMessage(), e);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:32,代码来源:JettyContainer.java

示例10: main

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
 * Sets up and runs server.
 * @param args
 */
public static void main(String[] args)
{
    final Server server = new Server();

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(8080);
    server.addConnector(connector);

    Context htmlContext = new Context(server, "/", Context.SESSIONS);

    ResourceHandler htmlHandler = new ResourceHandler();
    htmlHandler.setResourceBase("web");
    htmlContext.setHandler(htmlHandler);

    Context servletContext = new Context(server, "/", Context.SESSIONS);

    GenericWebApplicationContext springContext = new GenericWebApplicationContext();
    springContext.setParent(new ClassPathXmlApplicationContext("org/getahead/dwrdemo/cli/spring.xml"));
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, springContext);

    ServletHolder holder = new ServletHolder(new DwrSpringServlet());
    holder.setInitParameter("pollAndCometEnabled", "true");
    holder.setInitParameter("debug", "true");
    servletContext.addServlet(holder, "/dwr/*");

    try
    {
        JettyShutdown.addShutdownHook(server);
        server.start();
        server.join();
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:JettySpringLauncher.java

示例11: main

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
 * Sets up and runs server.
 * @param args
 */
public static void main(String[] args)
{
    Server server = new Server();

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(8080);
    server.addConnector(connector);

    Context htmlContext = new Context(server, "/", Context.SESSIONS);
    ResourceHandler htmlHandler = new ResourceHandler();
    htmlHandler.setResourceBase("web");
    htmlContext.setHandler(htmlHandler);

    Context servletContext = new Context(server, "/", Context.SESSIONS);
    ServletHolder holder = new ServletHolder(new DwrServlet());
    holder.setInitParameter("activeReverseAjaxEnabled", "true");
    holder.setInitParameter("debug", "true");
    servletContext.addServlet(holder, "/dwr/*");
    servletContext.setResourceBase("web");

    try
    {
        JettyShutdown.addShutdownHook(server);
        server.start();
        server.join();
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:36,代码来源:JettyLauncher.java

示例12: addJerseyResourcePackage

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/** 
 * Add a Jersey resource package.
 * @param packageName The Java package name containing the Jersey resource.
 * @param pathSpec The path spec for the servlet
 */
public void addJerseyResourcePackage(final String packageName,
    final String pathSpec) {
  LOG.info("addJerseyResourcePackage: packageName=" + packageName
      + ", pathSpec=" + pathSpec);
  final ServletHolder sh = new ServletHolder(ServletContainer.class);
  sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
      "com.sun.jersey.api.core.PackagesResourceConfig");
  sh.setInitParameter("com.sun.jersey.config.property.packages", packageName);
  webAppContext.addServlet(sh, pathSpec);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:HttpServer.java

示例13: start

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void start() {
    String serverPort = ConfigUtils.getProperty(JETTY_PORT);
    int port;
    if (serverPort == null || serverPort.length() == 0) {
        port = DEFAULT_JETTY_PORT;
    } else {
        port = Integer.parseInt(serverPort);
    }
    connector = new SelectChannelConnector();
    
    connector.setPort(port);
    ServletHandler handler = new ServletHandler();
    
    String resources = ConfigUtils.getProperty(JETTY_DIRECTORY);
    if (resources != null && resources.length() > 0) {
        FilterHolder resourceHolder = handler.addFilterWithMapping(ResourceFilter.class, "/*", Handler.DEFAULT);
        resourceHolder.setInitParameter("resources", resources);
    }
    
    ServletHolder pageHolder = handler.addServletWithMapping(PageServlet.class, "/*");
    pageHolder.setInitParameter("pages", ConfigUtils.getProperty(JETTY_PAGES));
    pageHolder.setInitOrder(2);
    
    Server server = new Server();
    server.addConnector(connector);
    server.addHandler(handler);
    try {
        server.start();
    } catch (Exception e) {
        throw new IllegalStateException("Failed to start jetty server on " + NetUtils.getLocalHost() + ":" + port + ", cause: " + e.getMessage(), e);
    }
}
 
开发者ID:spccold,项目名称:dubbo-comments,代码行数:33,代码来源:JettyContainer.java

示例14: startServletContainer

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void startServletContainer(Configuration conf) throws Exception {
  if (server != null) {
    LOG.error("ServletContainer already running");
    return;
  }

  // Inject the conf for the test by being first to make singleton
  RESTServlet.getInstance(conf);

  // set up the Jersey servlet container for Jetty
  ServletHolder sh = new ServletHolder(ServletContainer.class);
  sh.setInitParameter(
    "com.sun.jersey.config.property.resourceConfigClass",
    ResourceConfig.class.getCanonicalName());
  sh.setInitParameter("com.sun.jersey.config.property.packages",
    "jetty");

  LOG.info("configured " + ServletContainer.class.getName());
  
  // set up Jetty and run the embedded server
  server = new Server(0);
  server.setSendServerVersion(false);
  server.setSendDateHeader(false);
    // set up context
  Context context = new Context(server, "/", Context.SESSIONS);
  context.addServlet(sh, "/*");
  context.addFilter(GzipFilter.class, "/*", 0);
    // start the server
  server.start();
    // get the port
  testServletPort = server.getConnectors()[0].getLocalPort();

  LOG.info("started " + server.getClass().getName() + " on port " + 
    testServletPort);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:36,代码来源:HBaseRESTTestingUtility.java

示例15: addContext

import org.mortbay.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void addContext(HttpServer server, String strContext, String host, String path, String strWebContext, String strServerContext) {

    	if (strWebContext == null) strWebContext = "./web";
    	if (strServerContext == null) strServerContext = "./server";
        
        HttpContext context = new HttpContext();
        context.setContextPath(strContext);
        context.addWelcomeFile("index.cfm");

	    if ( host != null && !host.isEmpty() )
	        context.addVirtualHost(host);

        server.addContext(context);

        // Create a servlet container
        ServletHandler servlets = new ServletHandler();
        context.addHandler(servlets);

        // Map a servlet onto the container
        ServletHolder cfml = servlets.addServlet("CFMLServlet", "*.cfc/*,*.cfm/*,*.cfml/*,*.cfc,*.cfm,*.cfml", "lucee.debug.loader.servlet.CFMLServlet");
        cfml.setInitOrder(0);

        cfml.setInitParameter("lucee-server-directory", strServerContext);
        
        // Lucee REST Servlet
        ServletHolder rest = servlets.addServlet("RESTServlet", "/rest/*", "lucee.debug.loader.servlet.RESTServlet");
        rest.setInitOrder(0);

        strWebContext += path;
        context.setResourceBase(strWebContext);
        context.addHandler(new ResourceHandler());
    }
 
开发者ID:lucee,项目名称:Lucee4,代码行数:33,代码来源:RunAsJavaApplication.java


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