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


Java ServletHandler.addServletWithMapping方法代码示例

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


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

示例1: main

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  initWeixin();

  Server server = new Server(8080);

  ServletHandler servletHandler = new ServletHandler();
  server.setHandler(servletHandler);

  ServletHolder endpointServletHolder = new ServletHolder(new WxCpEndpointServlet(wxCpConfigStorage, wxCpService, wxCpMessageRouter));
  servletHandler.addServletWithMapping(endpointServletHolder, "/*");

  ServletHolder oauthServletHolder = new ServletHolder(new WxCpOAuth2Servlet(wxCpService));
  servletHandler.addServletWithMapping(oauthServletHolder, "/oauth2/*");

  server.start();
  server.join();
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:18,代码来源:WxCpDemoServer.java

示例2: startInJvmProxy

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
/**
 * To test that the CF client is able to go through a proxy, we point the CC client to a broken url that can only be resolved by going
 * through an inJVM proxy which rewrites the URI. This method starts this inJvm proxy.
 *
 * @throws Exception
 */
private static void startInJvmProxy() throws Exception {
    inJvmProxyPort = getNextAvailablePort(8080);
    inJvmProxyServer = new Server(new InetSocketAddress("127.0.0.1", inJvmProxyPort)); // forcing use of loopback
    // that will be used both for Httpclient proxy and SocketDestHelper
    QueuedThreadPool threadPool = new QueuedThreadPool();
    threadPool.setMinThreads(1);
    inJvmProxyServer.setThreadPool(threadPool);

    HandlerCollection handlers = new HandlerCollection();
    inJvmProxyServer.setHandler(handlers);

    ServletHandler servletHandler = new ServletHandler();
    handlers.addHandler(servletHandler);
    nbInJvmProxyRcvReqs = new AtomicInteger();
    ChainedProxyServlet chainedProxyServlet = new ChainedProxyServlet(httpProxyConfiguration, nbInJvmProxyRcvReqs);
    servletHandler.addServletWithMapping(new ServletHolder(chainedProxyServlet), "/*");

    // Setup proxy handler to handle CONNECT methods
    ConnectHandler proxyHandler;
    proxyHandler = new ChainedProxyConnectHandler(httpProxyConfiguration, nbInJvmProxyRcvReqs);
    handlers.addHandler(proxyHandler);

    inJvmProxyServer.start();
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:31,代码来源:CloudFoundryClientTest.java

示例3: run

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void run() {
	try {
		this.server = new Server(this.serverPort);

		ServletHandler servletHandler = new ServletHandler();
		servletHandler.addServletWithMapping(TaskTrackerServlet.class, "/tracker");
		this.server.setHandler(servletHandler);

		this.server.start();
		this.server.join();
	} catch (Exception ex) {
		// suppress
	}
}
 
开发者ID:ran-jit,项目名称:distributed-task-scheduler,代码行数:17,代码来源:TaskTrackerHandler.java

示例4: main

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  initWeixin();

  Server server = new Server(8080);

  ServletHandler servletHandler = new ServletHandler();
  server.setHandler(servletHandler);

  ServletHolder endpointServletHolder = new ServletHolder(
    new WxMpEndpointServlet(wxMpConfigStorage, wxMpService,
      wxMpMessageRouter));
  servletHandler.addServletWithMapping(endpointServletHolder, "/*");

  ServletHolder oauthServletHolder = new ServletHolder(
    new WxMpOAuth2Servlet(wxMpService));
  servletHandler.addServletWithMapping(oauthServletHolder, "/oauth2/*");

  server.start();
  server.join();
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:21,代码来源:WxMpDemoServer.java

示例5: getAllServices

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
private HandlerList getAllServices() throws Exception{
    // File server & Context Handler for root, also setting the index.html
    // to be the "welcome file", i.e, autolink on root addresses.
    ContextHandler rootContext = new ContextHandler();
    rootContext.setContextPath("/*");
    rootContext.setHandler(getResourceHandlers());

    // Possible servlet lists, for all servlets or custom services you want to access later.
    // Warning, it might become a little bit nested if you add to many classes.
    ServletHandler questionHandler = new ServletHandler();
    questionHandler.addServletWithMapping(QuestionHandler.class, "/question");

    // Add the ResourceHandler to the server.
    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[] {
            rootContext ,
            questionHandler,
    });

    return handlers;
}
 
开发者ID:Rebstorm,项目名称:paul0-application-server,代码行数:22,代码来源:HomeServerConfig.java

示例6: createServer

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
private Server createServer() {
    Server server = new Server();
    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(8384);
    server.addConnector(connector);

    ServletHandler handler = new ServletHandler();
    Servlet servlet = new HttpServlet() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
            String path = req.getServletPath().substring(1);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
            resp.getWriter().append(path);
        }
        
    };
    handler.addServletWithMapping(new ServletHolder(servlet), "/");
    server.setHandler(handler);
    return server;
}
 
开发者ID:cschneider,项目名称:reactive-components,代码行数:27,代码来源:TestRs.java

示例7: init

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
@PostConstruct
private void init()
{
    internal = new Server();

    ServletHandler servletHandler = new ServletHandler();
    KasijeServlet servlet = context.find(KasijeServlet.class);
    ServletHolder servletHolder = new ServletHolder("kasije", servlet);
    servletHandler.addServletWithMapping(servletHolder, "/*");
    internal.setHandler(servletHandler);

    ConfigProvider configProv = context.find(ConfigProvider.class);
    ServerConfig config = configProv.getServerConfig();
    if (null == config || null == config.getConnectors() || config.getConnectors().isEmpty())
    {
        internal.addConnector(createConnector(null));
    }
    else
    {
        for (Connector connectorConfig : config.getConnectors())
        {
            internal.addConnector(createConnector(connectorConfig));
        }
    }
}
 
开发者ID:touwolf,项目名称:kasije,代码行数:26,代码来源:KasijeServer.java

示例8: createReverseProxy

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
private ServletHandler createReverseProxy(ProxyMap proxyMap) {
    AsyncProxyServlet servlet = new ReverseProxy(proxyMap);
    ServletHolder proxyServletHolder = new ServletHolder(servlet);
    proxyServletHolder.setAsyncSupported(true);
    proxyServletHolder.setInitParameter("maxThreads", "256");
    proxyServletHolder.setInitParameter("idleTimeout", String.valueOf(idleTimeout));
    proxyServletHolder.setInitParameter("timeout", String.valueOf(totalTimeout));
    ServletHandler proxyHandler = new ServletHandler();
    proxyHandler.addServletWithMapping(proxyServletHolder, "/*");
    return proxyHandler;
}
 
开发者ID:danielflower,项目名称:app-runner,代码行数:12,代码来源:WebServer.java

示例9: main

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  initWeixin();

  Server server = new Server(8080);

  ServletHandler servletHandler = new ServletHandler();
  server.setHandler(servletHandler);

  ServletHolder endpointServletHolder = new ServletHolder(
      new WxMpEndpointServlet(wxMpConfigStorage, wxMpService,
          wxMpMessageRouter));
  servletHandler.addServletWithMapping(endpointServletHolder, "/*");

  ServletHolder oauthServletHolder = new ServletHolder(
      new WxMpOAuth2Servlet(wxMpService));
  servletHandler.addServletWithMapping(oauthServletHolder, "/oauth2/*");

  server.start();
  server.join();
}
 
开发者ID:binarywang,项目名称:weixin-java-tools-for-JDK6,代码行数:21,代码来源:WxMpDemoServer.java

示例10: LfsServer

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
/**
 * Ctor.
 * @param path Server path.
 * @param storage Storage container.
 * @param port Server port
 */
LfsServer(final String path, final ContentManager storage,
    final int port) {
    this.server = new Server();
    this.http =
        new ServerConnector(this.server, new HttpConnectionFactory());
    this.http.setPort(port);
    // @checkstyle MagicNumber (1 line)
    this.http.setIdleTimeout(30000);
    this.server.addConnector(this.http);
    final ServletHandler handler = new ServletHandler();
    this.server.setHandler(handler);
    handler.addServletWithMapping(
        new ServletHolder(
            new PointerServlet(
                storage, String.format("%s/info/lfs/storage/", path)
            )
        ),
        String.format("%s/info/lfs/objects/*", path)
    );
    handler.addServletWithMapping(
        new ServletHolder(new ContentServlet(storage)),
        String.format("%s/info/lfs/storage/*", path)
    );
}
 
开发者ID:carlosmiranda,项目名称:git-lfs-azureblob,代码行数:31,代码来源:LfsServer.java

示例11: beforeClass

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	ourPort = PortUtil.findFreePort();
	ourServer = new Server(ourPort);

	ResourceProvider patientProvider = new ResourceProvider();

	ServletHandler proxyHandler = new ServletHandler();
	RestfulServer servlet = new RestfulServer();
	servlet.setResourceProviders(patientProvider);
	ServletHolder servletHolder = new ServletHolder(servlet);
	proxyHandler.addServletWithMapping(servletHolder, "/*");
	ourServer.setHandler(proxyHandler);
	ourServer.start();

	PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
	HttpClientBuilder builder = HttpClientBuilder.create();
	builder.setConnectionManager(connectionManager);
	ourClient = builder.build();

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:22,代码来源:BinaryTestDstu2.java

示例12: beforeClass

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	ourPort = PortUtil.findFreePort();
	ourServer = new Server(ourPort);

	DummyPatientResourceProvider patientProvider = new DummyPatientResourceProvider();

	ServletHandler proxyHandler = new ServletHandler();
	RestfulServer servlet = new RestfulServer();
	servlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());

	servlet.setResourceProviders(patientProvider);
	ServletHolder servletHolder = new ServletHolder(servlet);
	proxyHandler.addServletWithMapping(servletHolder, "/*");
	ourServer.setHandler(proxyHandler);
	ourServer.start();

	PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
	HttpClientBuilder builder = HttpClientBuilder.create();
	builder.setConnectionManager(connectionManager);
	ourClient = builder.build();

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:DateRangeParamSearchTest.java

示例13: beforeClass

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	ourPort = PortUtil.findFreePort();
	ourServer = new Server(ourPort);

	DummyPatientResourceProvider patientProvider = new DummyPatientResourceProvider();

	ServletHandler proxyHandler = new ServletHandler();
	servlet = new RestfulServer();
	servlet.setResourceProviders(patientProvider);
	ServletHolder servletHolder = new ServletHolder(servlet);
	proxyHandler.addServletWithMapping(servletHolder, "/*");
	ourServer.setHandler(proxyHandler);
	ourServer.start();

	PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
	HttpClientBuilder builder = HttpClientBuilder.create();
	builder.setConnectionManager(connectionManager);
	ourClient = builder.build();

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:22,代码来源:InterceptorTest.java

示例14: beforeClass

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	ourPort = PortUtil.findFreePort();
	ourServer = new Server(ourPort);

	DummyPlainProvider plainProvider = new DummyPlainProvider();
	DummyResourceProvider patientProvider = new DummyResourceProvider();

	ServletHandler proxyHandler = new ServletHandler();
	RestfulServer servlet = new RestfulServer();
	servlet.setPlainProviders(plainProvider);
	servlet.setResourceProviders(patientProvider);
	ServletHolder servletHolder = new ServletHolder(servlet);
	proxyHandler.addServletWithMapping(servletHolder, "/*");
	ourServer.setHandler(proxyHandler);
	ourServer.start();

	PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
	HttpClientBuilder builder = HttpClientBuilder.create();
	builder.setConnectionManager(connectionManager);
	ourClient = builder.build();

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:HistoryTest.java

示例15: beforeClass

import org.eclipse.jetty.servlet.ServletHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	ourPort = PortUtil.findFreePort();
	ourServer = new Server(ourPort);

	ServletHandler proxyHandler = new ServletHandler();
	ourServlet = new RestfulServer();
	ourServlet.setFhirContext(ourCtx);
	ourServlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());

	ServletHolder servletHolder = new ServletHolder(ourServlet);
	proxyHandler.addServletWithMapping(servletHolder, "/*");
	ourServer.setHandler(proxyHandler);

	PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
	HttpClientBuilder builder = HttpClientBuilder.create();
	builder.setConnectionManager(connectionManager);
	ourClient = builder.build();

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:MethodPriorityTest.java


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