org.eclipse.jetty.server.session.HashSessionIdManager Java Examples

The following examples show how to use org.eclipse.jetty.server.session.HashSessionIdManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestServerUtil.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?>... configClasses) {
  int port = NEXT_PORT.incrementAndGet();
  Server server = new Server(port);

  HashSessionIdManager idmanager = new HashSessionIdManager();
  server.setSessionIdManager(idmanager);

  AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
  applicationContext.register(configClasses);
  applicationContext.refresh();

  try {
    server.setHandler(getServletContextHandler(applicationContext));
    server.start();
  } catch (Exception e) {
    log.error("Error starting server", e);
  }

  return new TestServer(server, applicationContext, port);
}
 
Example #2
Source File: BaseJPARestTestCase.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public static void createAndStartServer() {
  server = new Server(HTTP_SERVER_PORT);

  HashSessionIdManager idmanager = new HashSessionIdManager();
  server.setSessionIdManager(idmanager);

  AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
  applicationContext.register(JPAApplicationConfiguration.class);
  applicationContext.refresh();

  appContext = applicationContext;

  try {
    server.setHandler(getServletContextHandler(applicationContext));
    server.start();
  } catch (Exception e) {
    log.error("Error starting server", e);
  }
}
 
Example #3
Source File: TestServerUtil.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?> ... configClasses) {
	int port= NEXT_PORT.incrementAndGet();
  Server server = new Server(port);

  HashSessionIdManager idmanager = new HashSessionIdManager();
  server.setSessionIdManager(idmanager);
  
  AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
  applicationContext.register(configClasses);
  applicationContext.refresh();
    
  try {
    server.setHandler(getServletContextHandler(applicationContext));
    server.start();
  } catch (Exception e) {
    log.error("Error starting server", e);
  }
  
  return new TestServer(server, applicationContext, port);
}
 
Example #4
Source File: TestServerUtil.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?>... configClasses) {
    int port = NEXT_PORT.incrementAndGet();
    Server server = new Server(port);

    HashSessionIdManager idmanager = new HashSessionIdManager();
    server.setSessionIdManager(idmanager);

    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    applicationContext.register(configClasses);
    applicationContext.refresh();

    try {
        server.setHandler(getServletContextHandler(applicationContext));
        server.start();
    } catch (Exception e) {
        LOGGER.error("Error starting server", e);
    }

    return new TestServer(server, applicationContext, port);
}
 
Example #5
Source File: TestServerUtil.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?>... configClasses) {
    int port = NEXT_PORT.incrementAndGet();
    Server server = new Server(port);

    HashSessionIdManager idmanager = new HashSessionIdManager();
    server.setSessionIdManager(idmanager);

    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    applicationContext.register(configClasses);
    applicationContext.refresh();

    try {
        server.setHandler(getServletContextHandler(applicationContext));
        server.start();
    } catch (Exception e) {
        LOGGER.error("Error starting server", e);
    }

    return new TestServer(server, applicationContext, port);
}
 
Example #6
Source File: TestServerUtil.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?>... configClasses) {
    int port = NEXT_PORT.incrementAndGet();
    Server server = new Server(port);

    HashSessionIdManager idmanager = new HashSessionIdManager();
    server.setSessionIdManager(idmanager);

    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    applicationContext.register(configClasses);
    applicationContext.refresh();

    try {
        server.setHandler(getServletContextHandler(applicationContext));
        server.start();
    } catch (Exception e) {
        LOGGER.error("Error starting server", e);
    }

    return new TestServer(server, applicationContext, port);
}
 
Example #7
Source File: TestServerUtil.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?>... configClasses) {
    int port = NEXT_PORT.incrementAndGet();
    Server server = new Server(port);

    HashSessionIdManager idmanager = new HashSessionIdManager();
    server.setSessionIdManager(idmanager);

    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    applicationContext.register(configClasses);
    applicationContext.refresh();

    try {
        server.setHandler(getServletContextHandler(applicationContext));
        server.start();
    } catch (Exception e) {
        LOGGER.error("Error starting server", e);
    }

    return new TestServer(server, applicationContext, port);
}
 
Example #8
Source File: TestServerUtil.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?>... configClasses) {
    int port = NEXT_PORT.incrementAndGet();
    Server server = new Server(port);

    HashSessionIdManager idmanager = new HashSessionIdManager();
    server.setSessionIdManager(idmanager);

    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    applicationContext.register(configClasses);
    applicationContext.refresh();

    try {
        server.setHandler(getServletContextHandler(applicationContext));
        server.start();
    } catch (Exception e) {
        LOGGER.error("Error starting server", e);
    }

    return new TestServer(server, applicationContext, port);
}
 
Example #9
Source File: TestServerUtil.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public static TestServer createAndStartServer(Class<?>... configClasses) {
    int port = NEXT_PORT.incrementAndGet();
    Server server = new Server(port);

    HashSessionIdManager idmanager = new HashSessionIdManager();
    server.setSessionIdManager(idmanager);

    AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
    applicationContext.register(configClasses);
    applicationContext.refresh();

    try {
        server.setHandler(getServletContextHandler(applicationContext));
        server.start();
    } catch (Exception e) {
        LOGGER.error("Error starting server", e);
    }

    return new TestServer(server, applicationContext, port);
}
 
Example #10
Source File: JettyLauncher.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
/**
 * Starts a Jetty server with D2R Server as root webapp.
 * 
 * @return <code>true</code> on success, <code>false</code> if webapp init failed 
 */
public boolean start() {
	Server jetty = new Server(port);

	// use Random (/dev/urandom) instead of SecureRandom to generate session keys - otherwise Jetty may hang during startup waiting for enough entropy
	// see http://jira.codehaus.org/browse/JETTY-331 and http://docs.codehaus.org/display/JETTY/Connectors+slow+to+startup
	jetty.setSessionIdManager(new HashSessionIdManager(new Random()));
	WebAppContext context = new WebAppContext(jetty, "webapp", "");

	// Wave a chicken at Jetty to make some annoying System.err.println noise go away
	context.getSecurityHandler().setIdentityService(new DefaultIdentityService());
	context.getSecurityHandler().setAuthenticator(null);
	context.getSecurityHandler().setAuthenticatorFactory(null);
	
	// Place the system loader into the servlet context. The webapp init
	// listener will find it there and create the D2RServer instance.
	D2RServer.storeSystemLoader(loader, context.getServletContext());
	try {
		jetty.start();
		D2RServer server = D2RServer.fromServletContext(context.getServletContext());
		if (server == null || server.errorOnStartup()) {
			jetty.stop();
			log.warn("[[[ Server startup failed, see messages above ]]]");
			return false;
		}
		log.info("[[[ Server started at " + loader.getSystemBaseURI() + " ]]]");
		return true;
	} catch (Exception ex) {
		throw new RuntimeException(ex);
	}
}