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


Java ErrorHandler.setShowStacks方法代码示例

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


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

示例1: startTheControllerServer

import org.eclipse.jetty.server.handler.ErrorHandler; //导入方法依赖的package包/类
/**
 * Start the controller as a RESTful server.
 * Use the setters of this class to change the default
 * port and host.
 * <br>
 * This method is blocking until the server is initialized.
 */
public final boolean startTheControllerServer() {

    //Jersey
    ResourceConfig config = new ResourceConfig();
    config.register(JacksonFeature.class);
    config.register(new EMController(this));
    config.register(LoggingFeature.class);

    //Jetty
    controllerServer = new Server(InetSocketAddress.createUnresolved(
            getControllerHost(), getControllerPort()));

    ErrorHandler errorHandler = new ErrorHandler();
    errorHandler.setShowStacks(true);
    controllerServer.setErrorHandler(errorHandler);

    ServletHolder servlet = new ServletHolder(new ServletContainer(config));

    ServletContextHandler context = new ServletContextHandler(controllerServer,
            ControllerConstants.BASE_PATH + "/*");
    context.addServlet(servlet, "/*");


    try {
        controllerServer.start();
    } catch (Exception e) {
        SimpleLogger.error("Failed to start Jetty: " + e.getMessage());
        controllerServer.destroy();
    }

    //just make sure we start from a clean state
    newSearch();

    SimpleLogger.info("Started controller server on: " + controllerServer.getURI());

    return true;
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:45,代码来源:SutController.java

示例2: JettyServer

import org.eclipse.jetty.server.handler.ErrorHandler; //导入方法依赖的package包/类
public JettyServer(List<HttpServerConnectorCreator> connectors, List<Object> resources) {
        server=new org.eclipse.jetty.server.Server();
        currentConnectors.addAll(connectors);
        for (HttpServerConnectorCreator creator : currentConnectors) {
            creator.addToServer(server);
        }

        rootServlet = new UpdateableServlet(new ServletContainer(jerseySetup(resources)));
        ServletHolder holder = new ServletHolder(rootServlet);
        ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
        contextHandler.addServlet( holder, "/*");
        ErrorHandler errorHandler = new ErrorHandler();
        errorHandler.setShowStacks(true);
        contextHandler.setErrorHandler(errorHandler);

        GzipHandler gzipHandler = new GzipHandler();
//            HashSet<String> mimeTypes = new HashSet<>();
//            mimeTypes.add("text/html");
//            mimeTypes.add("text/plain");
//            mimeTypes.add("text/css");
//            mimeTypes.add("application/x-javascript");
//            mimeTypes.add("application/json");
        gzipHandler.setMinGzipSize(0);

        gzipHandler.setHandler(contextHandler);

        HandlerCollection handlers = new HandlerList();
        additionalHandlers().forEach(handler -> handlers.addHandler(handler));
        handlers.addHandler(gzipHandler);
        server.setHandler(handlers);
    }
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:32,代码来源:JettyServer.java

示例3: main

import org.eclipse.jetty.server.handler.ErrorHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	
	org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(8080);
	
	final ErrorHandler errorHandler = new ErrorHandler();
       errorHandler.setServer(server);
       errorHandler.setShowStacks(false);
       server.addBean(errorHandler);
              
       server.setStopAtShutdown(true);
       server.setStopTimeout(30*1000l);
	        
       ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);

       handler.setClassLoader(Thread.currentThread().getContextClassLoader());
       handler.setContextPath("/");
       handler.setInitParameter("tapestry.app-package", "com.ckfce.tapfatjar");
       
       FilterHolder filterHolder = new FilterHolder();
       filterHolder.setHeldClass(TapestryFilter.class);
       filterHolder.setName("app");
       
       handler.addFilter(filterHolder, "/*", EnumSet.of(DispatcherType.REQUEST));
       								
	server.setHandler(handler);
					 
       server.start();        
       server.join();
}
 
开发者ID:cakeface,项目名称:tapestry-fat-jar,代码行数:30,代码来源:Server.java

示例4: start

import org.eclipse.jetty.server.handler.ErrorHandler; //导入方法依赖的package包/类
/**
 * Start the web server including setup.
 * @throws Exception
 */
public void start() throws Exception {
  if (embeddedJetty == null) {
    return;
  }

  final ServerConnector serverConnector;
  if (config.getBoolean(ExecConstants.HTTP_ENABLE_SSL)) {
    serverConnector = createHttpsConnector();
  } else {
    serverConnector = createHttpConnector();
  }
  embeddedJetty.addConnector(serverConnector);

  // Add resources
  final ErrorHandler errorHandler = new ErrorHandler();
  errorHandler.setShowStacks(true);
  errorHandler.setShowMessageInTitle(true);

  final ServletContextHandler servletContextHandler =
      new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
  servletContextHandler.setErrorHandler(errorHandler);
  servletContextHandler.setContextPath("/");
  embeddedJetty.setHandler(servletContextHandler);

  final ServletHolder servletHolder = new ServletHolder(new ServletContainer(new DrillRestServer(workManager)));
  servletHolder.setInitOrder(1);
  servletContextHandler.addServlet(servletHolder, "/*");

  servletContextHandler.addServlet(
      new ServletHolder(new MetricsServlet(metrics)), "/status/metrics");
  servletContextHandler.addServlet(new ServletHolder(new ThreadDumpServlet()), "/status/threads");

  final ServletHolder staticHolder = new ServletHolder("static", DefaultServlet.class);
  staticHolder.setInitParameter("resourceBase", Resource.newClassPathResource("/rest/static").toString());
  staticHolder.setInitParameter("dirAllowed","false");
  staticHolder.setInitParameter("pathInfoOnly","true");
  servletContextHandler.addServlet(staticHolder,"/static/*");

  embeddedJetty.start();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:45,代码来源:WebServer.java

示例5: start

import org.eclipse.jetty.server.handler.ErrorHandler; //导入方法依赖的package包/类
public void start() {
        System.setProperty("java.net.preferIPv4Stack", "true");//TODO optional?

        server = new org.eclipse.jetty.server.Server();
//        HashSessionIdManager sessionIdManager = new HashSessionIdManager();
//        server.setSessionIdManager(sessionIdManager);

        connector = new NetworkTrafficServerConnector(server);
        connector.setPort(httpPort);
        connector.setHost(host);
        server.addConnector(connector);


        ServletContextHandler contextHandler = new ServletContextHandler();
        SessionHandler sessionHandler = new SessionHandler();
//        HashSessionManager sessionManager = new HashSessionManager();
//        sessionManager.setMaxInactiveInterval(sessionTimeoutS);
//        sessionManager.setSessionCookie(sessionManager.getSessionCookie()+httpPort); //avoid session mix up for 2 server running as localhost
//        sessionHandler.setSessionManager(sessionManager);


        contextHandler.setSessionHandler(sessionHandler);
        contextHandler.addServlet(new ServletHolder(new ServletContainer(jerseySetup(restResource))), "/applicationServer/*");

        ErrorHandler errorHandler = new ErrorHandler();
        errorHandler.setShowStacks(true);
        contextHandler.setErrorHandler(errorHandler);

        GzipHandler gzipHandler = new GzipHandler();
//            HashSet<String> mimeTypes = new HashSet<>();
//            mimeTypes.add("text/html");
//            mimeTypes.add("text/plain");
//            mimeTypes.add("text/css");
//            mimeTypes.add("application/x-javascript");
//            mimeTypes.add("application/json");
        gzipHandler.setMinGzipSize(0);
//            gzipHandler.setMimeTypes(mimeTypes);

        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers(new Handler[]{resourceHandler, contextHandler});
        gzipHandler.setHandler(handlers);
        server.setHandler(gzipHandler);

        try {
            server.start();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:50,代码来源:HttpServer.java


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