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


Java Server.join方法代码示例

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


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

示例1: startServer

import org.mortbay.jetty.Server; //导入方法依赖的package包/类
private static void startServer() throws Exception, InterruptedException {
  Server server = new Server(port);
  Context context = new Context(server, "/", Context.SESSIONS);
  context.addServlet(DefaultServlet.class, "/*");

  context.addEventListener(new ContextLoaderListener(getContext()));
  context.addEventListener(new RequestContextListener());

  WicketFilter filter = new WicketFilter();
  filter.setFilterPath("/");
  FilterHolder holder = new FilterHolder(filter);
  holder.setInitParameter("applicationFactoryClassName", APP_FACTORY_NAME);
  context.addFilter(holder, "/*", Handler.DEFAULT);

  server.setHandler(context);
  server.start();
  server.join();
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:19,代码来源:NutchUiServer.java

示例2: main

import org.mortbay.jetty.Server; //导入方法依赖的package包/类
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8081 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/reporting" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    server.start();
    server.join();
}
 
开发者ID:DistX,项目名称:Learning,代码行数:18,代码来源:EmbeddedServer.java

示例3: main

import org.mortbay.jetty.Server; //导入方法依赖的package包/类
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8080 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/xdocreport-webapp" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    // JSP Servlet + Context
    Context jsp_ctx = new Context( servlet_contexts, "/jsp", Context.SESSIONS );
    jsp_ctx.addServlet( new ServletHolder( new org.apache.jasper.servlet.JspServlet() ), "*.jsp" );

    server.start();
    server.join();
}
 
开发者ID:DistX,项目名称:Learning,代码行数:22,代码来源:EmbeddedServer.java

示例4: main

import org.mortbay.jetty.Server; //导入方法依赖的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

示例5: main

import org.mortbay.jetty.Server; //导入方法依赖的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

示例6: main

import org.mortbay.jetty.Server; //导入方法依赖的package包/类
public static void main(String[] args) {
    Server server = new Server();
    SocketConnector connector = new SocketConnector();

    // Set some timeout options to make debugging easier.
    connector.setMaxIdleTime(1000 * 60 * 60);
    connector.setSoLingerTime(-1);
    connector.setPort(9080);
    server.setConnectors(new Connector[]{connector});

    WebAppContext context = new WebAppContext();
    context.setServer(server);
    context.setContextPath("/");

    ProtectionDomain protectionDomain = Main.class.getProtectionDomain();
    URL location = protectionDomain.getCodeSource().getLocation();
    context.setWar(location.toExternalForm());

    server.addHandler(context);
    try {
        server.start();
        System.in.read();
        server.stop();
        server.join();
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(100);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:30,代码来源:WebLauncher.java

示例7: main

import org.mortbay.jetty.Server; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception
{
    String jetty_home=System.getProperty("jetty.home","../../..");

    String jetty_port=System.getProperty("jetty.port", "8080");

    String node_name=System.getProperty("node.name", "red");

    Server server = new Server();
    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(Integer.parseInt(jetty_port));
    server.setConnectors(new Connector[]{connector});
    
    HandlerCollection handlers = new HandlerCollection();
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    
    //TODO: find a way to dynamically get the endpoint url
    WadiCluster wadiCluster = new WadiCluster("CLUSTER", node_name, "http://localhost:"+jetty_port+"/test");
    wadiCluster.doStart();
    
    WadiSessionManager wadiManager = new WadiSessionManager(wadiCluster, 2, 24, 360);
    
    WadiSessionHandler wSessionHandler = new WadiSessionHandler(wadiManager);
    WebAppContext wah = new WebAppContext(null, wSessionHandler, null, null);
    wah.setContextPath("/test");
    wah.setResourceBase(jetty_home+"/webapps/test");
    
    contexts.setHandlers(new Handler[]{wah});
    handlers.setHandlers(new Handler[]{contexts,new DefaultHandler()});
    server.setHandler(handlers);

    HashUserRealm hur = new HashUserRealm();
    hur.setName("Test Realm");
    hur.setConfig(jetty_home+"/etc/realm.properties");
    wah.getSecurityHandler().setUserRealm(hur);
    
    server.start();
    server.join();
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:40,代码来源:WadiSessionHandler.java

示例8: main

import org.mortbay.jetty.Server; //导入方法依赖的package包/类
/** temp main - just to help testing */
public static void main(String[] args)
throws Exception
{
    Server server = new Server();
    Connector connector=new GrizzlyConnector();
    connector.setPort(8080);
    server.setConnectors(new Connector[]{connector});
    
    HandlerCollection handlers = new HandlerCollection();
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    handlers.setHandlers(new Handler[]{contexts,new DefaultHandler()});
    server.setHandler(handlers);
    
    // TODO add javadoc context to contexts
    
    WebAppContext.addWebApplications(server, "../../webapps", "org/mortbay/jetty/webapp/webdefault.xml", true, false);
    
    HashUserRealm userRealm = new HashUserRealm();
    userRealm.setName("Test Realm");
    userRealm.setConfig("../../etc/realm.properties");
    server.setUserRealms(new UserRealm[]{userRealm});
    
    
    server.start();
    server.join();
    
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:29,代码来源:GrizzlyConnector.java

示例9: doStart

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

        Server server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(JETTY_SERVER_PORT);

        String webDefault = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + "**/webdefault.xml";
        Resource web = resolver.getResources(webDefault)[0];
        String descriptor = web.getFile().getAbsolutePath();

        String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + "**/" + SpiderJetty.class.getName() + ".class";
        Resource resource = resolver.getResources(pattern)[0];
        String resourcePath = resource.getFile().getAbsolutePath().replaceAll("target.*$", "") + "webapp";

        WebAppContext context = new WebAppContext();
        context.setContextPath("/");
        context.setDefaultsDescriptor(descriptor);
        context.setResourceBase("file:" + resourcePath);
        context.setClassLoader(Thread.currentThread().getContextClassLoader());

        server.setConnectors(new Connector[]{connector});
        server.setHandler(context);

        server.setStopAtShutdown(true);
        server.setSendServerVersion(false);
        server.setSendDateHeader(false);
        server.setGracefulShutdown(1000);


        try {
            server.start();
            server.join();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
开发者ID:MartinDai,项目名称:TBSpider,代码行数:37,代码来源:SpiderJetty.java

示例10: main

import org.mortbay.jetty.Server; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
int port = 8080;
if (args.length != 1) {
	printMessage();
} else {
	int argPort = port;
	try {
		argPort = Integer.parseInt(args[0]);
	} catch (NumberFormatException e) {
		printMessage();
	}
	if (argPort < 0) {
		System.err
				.println("Port number cannot be negative. Reverting to default port 8080.");
		argPort = port;
	}
	port = argPort;
}
Server server = new Server(port);
  	
  	DB db = new DB();
  	
  	db.loadDriver();
  	if (db.isIndexEmpty()) {
  		System.out.println("No indexes found. Please create an index before starting the application.");
  		db.shutdown();
  		System.exit(0);
  	}
  	db.loadCorporaInformation();
  	db.shutdown();
  	
      WebAppContext context = new WebAppContext();
      context.setDescriptor("./server/WEB-INF/web.xml");
      context.setResourceBase("./server");
      context.setContextPath("/");
      context.setParentLoaderPriority(true);

      server.setHandler(context);
      server.setThreadPool(new QueuedThreadPool(500));

      server.start();
      server.join();
  }
 
开发者ID:arne-cl,项目名称:fangorn,代码行数:44,代码来源:StartServer.java


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