congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.eclipse.jetty.server
Code IndexAdd Tabnine to your IDE (free)

How to use org.eclipse.jetty.server

Best Java code snippets using org.eclipse.jetty.server (Showing top 20 results out of 7,155)

origin: perwendel/spark

private static HttpConnectionFactory createHttpConnectionFactory() {
  HttpConfiguration httpConfig = new HttpConfiguration();
  httpConfig.setSecureScheme("https");
  httpConfig.addCustomizer(new ForwardedRequestCustomizer());
  return new HttpConnectionFactory(httpConfig);
}
origin: dropwizard/dropwizard

/**
 * Return the local port of the first {@link ServerConnector} in the
 * provided {@link Server} instance.
 *
 * @param server Server instance to use
 * @return First local port of the server instance
 */
default int getLocalPort(Server server) {
  return ((ServerConnector) server.getConnectors()[0]).getLocalPort();
}
origin: perwendel/spark

  /**
   * Creates a Jetty server with supplied thread pool
   * @param threadPool thread pool
   * @return a new jetty server instance
   */
  @Override
  public Server create(ThreadPool threadPool) {
    return threadPool != null ? new Server(threadPool) : new Server();
  }
}
origin: spring-projects/spring-framework

public TestJettyWebSocketServer(final WebSocketHandler webSocketHandler) {
  this.server = new Server();
  ServerConnector connector = new ServerConnector(this.server);
  connector.setPort(0);
  this.server.addConnector(connector);
  this.server.setHandler(new org.eclipse.jetty.websocket.server.WebSocketHandler() {
    @Override
    public void configure(WebSocketServletFactory factory) {
      factory.setCreator(new WebSocketCreator() {
        @Override
        public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) {
          if (!CollectionUtils.isEmpty(req.getSubProtocols())) {
            resp.setAcceptedSubProtocol(req.getSubProtocols().get(0));
          }
          JettyWebSocketSession session = new JettyWebSocketSession(null, null);
          return new JettyWebSocketHandlerAdapter(webSocketHandler, session);
        }
      });
    }
  });
}
origin: spring-projects/spring-framework

@Override
protected void startInternal() throws Exception {
  this.jettyServer.start();
  setPort(((ServerConnector) this.jettyServer.getConnectors()[0]).getLocalPort());
}
origin: spring-projects/spring-framework

@Override
public void start() throws Exception {
  this.jettyServer.start();
  this.contextHandler.start();
  Connector[] connectors = jettyServer.getConnectors();
  NetworkConnector connector = (NetworkConnector) connectors[0];
  this.port = connector.getLocalPort();
}
origin: spring-projects/spring-framework

public void stop() throws Exception {
  this.server.stop();
}
origin: spring-projects/spring-framework

public void start() throws Exception {
  this.server.start();
}
origin: spring-projects/spring-framework

@Override
public void stop() throws Exception {
  try {
    if (this.contextHandler.isRunning()) {
      this.contextHandler.stop();
    }
  }
  finally {
    if (this.jettyServer.isRunning()) {
      this.jettyServer.setStopTimeout(5000);
      this.jettyServer.stop();
    }
  }
}
origin: AsyncHttpClient/async-http-client

public static ServerConnector addHttpConnector(Server server) {
 ServerConnector connector = new ServerConnector(server);
 server.addConnector(connector);
 return connector;
}
origin: perwendel/spark

/**
 * {@inheritDoc}
 */
@Override
public void join() throws InterruptedException {
  server.join();
}
origin: dropwizard/dropwizard

  @Override
  public void handle(String target,
            Request baseRequest,
            HttpServletRequest request,
            HttpServletResponse response) throws IOException, ServletException {
    final Connector connector = baseRequest.getHttpChannel().getConnector();
    for (Entry entry : entries) {
      // reference equality works fine — none of the connectors implement #equals(Object)
      if (entry.connector == connector) {
        entry.handler.handle(target, baseRequest, request, response);
        return;
      }
    }
  }
}
origin: apache/incubator-druid

@Override
public String getProtocol()
{
 return connectionFactory.getProtocol();
}
origin: spring-projects/spring-framework

@Override
public void setup() {
  // Let server pick its own random, available port.
  this.jettyServer = new Server(0);
}
origin: spring-projects/spring-framework

@AfterClass
public static void stopJettyServer() throws Exception {
  if (jettyServer != null) {
    jettyServer.stop();
  }
}
origin: apache/storm

/**
 * The port the HTTP server is listening on. Not available until {@link #start() } has run.
 * @return The port the HTTP server is listening on. Not available until {@link #start() } has run.
 */
public int getHttpServerPort() {
  assert httpServer.getConnectors().length == 1;
  
  return ((ServerConnector) (httpServer.getConnectors()[0])).getLocalPort();
}
origin: spring-projects/spring-framework

@AfterClass
public static void stopServer() throws Exception {
  if (server != null) {
    server.stop();
  }
}
origin: dropwizard/dropwizard

  /**
   * Return the local port of the last {@link ServerConnector} in the
   * provided {@link Server} instance. This may be the same value as returned
   * by {@link #getLocalPort(Server)} if using the "simple" server configuration.
   *
   * @param server Server instance to use
   * @return Last local port or the server instance
   */
  default int getAdminPort(Server server) {
    final Connector[] connectors = server.getConnectors();
    return ((ServerConnector) connectors[connectors.length - 1]).getLocalPort();
  }
}
origin: spring-projects/spring-framework

  public int getPort() {
    return ((ServerConnector) this.server.getConnectors()[0]).getLocalPort();
  }
}
origin: neo4j/neo4j

private int getLocalPort( Server server )
{
  return ((ServerConnector) (server.getConnectors()[0])).getLocalPort();
}
org.eclipse.jetty.server

Most used classes

  • Server
    Jetty HTTP Servlet Server. This class is the main class for the Jetty HTTP Servlet server. It aggreg
  • ServerConnector
    This Connector implementation is the primary connector for the Jetty server over TCP/IP. By the use
  • Request
    Jetty Request. Implements javax.servlet.http.HttpServletRequest from the javax.servlet.http package
  • HttpConnectionFactory
    A Connection Factory for HTTP Connections.Accepts connections either directly or via SSL and/or NPN
  • HttpConfiguration
    HTTP Configuration.This class is a holder of HTTP configuration for use by the HttpChannel class. Ty
  • SslConnectionFactory,
  • HandlerList,
  • SecureRequestCustomizer,
  • ContextHandlerCollection,
  • Connector,
  • ContextHandler,
  • ResourceHandler,
  • SessionHandler,
  • RequestLogHandler,
  • ContextHandler$Context,
  • DefaultHandler,
  • Response,
  • SelectChannelConnector,
  • HandlerWrapper
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now