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


Java SslSocketConnector.setHeaderBufferSize方法代码示例

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


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

示例1: build

import org.mortbay.jetty.security.SslSocketConnector; //导入方法依赖的package包/类
public HttpServer2 build() throws IOException {
  Preconditions.checkNotNull(name, "name is not set");
  Preconditions.checkState(!endpoints.isEmpty(), "No endpoints specified");

  if (hostName == null) {
    hostName = endpoints.get(0).getHost();
  }

  if (this.conf == null) {
    conf = new Configuration();
  }

  HttpServer2 server = new HttpServer2(this);

  if (this.securityEnabled) {
    server.initSpnego(conf, hostName, usernameConfKey, keytabConfKey);
  }

  for (URI ep : endpoints) {
    final Connector listener;
    String scheme = ep.getScheme();
    if ("http".equals(scheme)) {
      listener = HttpServer2.createDefaultChannelConnector();
    } else if ("https".equals(scheme)) {
      SslSocketConnector c = new SslSocketConnectorSecure();
      c.setHeaderBufferSize(1024*64);
      c.setNeedClientAuth(needsClientAuth);
      c.setKeyPassword(keyPassword);

      if (keyStore != null) {
        c.setKeystore(keyStore);
        c.setKeystoreType(keyStoreType);
        c.setPassword(keyStorePassword);
      }

      if (trustStore != null) {
        c.setTruststore(trustStore);
        c.setTruststoreType(trustStoreType);
        c.setTrustPassword(trustStorePassword);
      }
      listener = c;

    } else {
      throw new HadoopIllegalArgumentException(
          "unknown scheme for endpoint:" + ep);
    }
    listener.setHost(ep.getHost());
    listener.setPort(ep.getPort() == -1 ? 0 : ep.getPort());
    server.addListener(listener);
  }
  server.loadListeners();
  return server;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:54,代码来源:HttpServer2.java

示例2: deployWebApp

import org.mortbay.jetty.security.SslSocketConnector; //导入方法依赖的package包/类
private void deployWebApp() {
    try {
        Server server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
        connector.setHeaderBufferSize(HEADER_BUFFER_SIZE);
        connector.setHost(getHost());
        connector.setPort(getPort());
        if (isHttpsEnabled()) {
            connector.setConfidentialPort(getHttpsPort());
        }
        server.addConnector(connector);

        if (isHttpsEnabled()) {
            SslSocketConnector sslConnector = new SslSocketConnector();
            sslConnector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
            sslConnector.setHeaderBufferSize(HEADER_BUFFER_SIZE);
            sslConnector.setHost(getHost());
            sslConnector.setPort(getHttpsPort());
            sslConnector.setKeystore(System.getProperty("subsonic.ssl.keystore", getClass().getResource("/subsonic.keystore").toExternalForm()));
            sslConnector.setPassword(System.getProperty("subsonic.ssl.password", "subsonic"));
            server.addConnector(sslConnector);
        }

        WebAppContext context = new WebAppContext();
        context.setTempDirectory(getJettyDirectory());
        context.setContextPath(getContextPath());
        context.setWar(getWar());
        context.setOverrideDescriptor("/web-jetty.xml");

        if (isHttpsEnabled()) {

            // Allow non-https for streaming and cover art (for Chromecast, UPnP, Sonos etc)
            context.getSecurityHandler().setConstraintMappings(new ConstraintMapping[]{
                    createConstraintMapping("/stream", Constraint.DC_NONE),
                    createConstraintMapping("/coverArt.view", Constraint.DC_NONE),
                    createConstraintMapping("/ws/*", Constraint.DC_NONE),
                    createConstraintMapping("/sonos/*", Constraint.DC_NONE),
                    createConstraintMapping("/", Constraint.DC_CONFIDENTIAL)
            });
        }

        server.addHandler(context);
        server.start();

        System.err.println("Subsonic running on: " + getUrl());
        if (isHttpsEnabled()) {
            System.err.println("                and: " + getHttpsUrl());
        }

    } catch (Throwable x) {
        x.printStackTrace();
        exception = x;
    }
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:56,代码来源:SubsonicDeployer.java

示例3: build

import org.mortbay.jetty.security.SslSocketConnector; //导入方法依赖的package包/类
public HttpServer2 build() throws IOException {
  if (this.name == null) {
    throw new HadoopIllegalArgumentException("name is not set");
  }

  if (endpoints.size() == 0 && connector == null) {
    throw new HadoopIllegalArgumentException("No endpoints specified");
  }

  if (hostName == null) {
    hostName = endpoints.size() == 0 ? connector.getHost() : endpoints.get(
        0).getHost();
  }

  if (this.conf == null) {
    conf = new Configuration();
  }

  HttpServer2 server = new HttpServer2(this);

  if (this.securityEnabled) {
    server.initSpnego(conf, hostName, usernameConfKey, keytabConfKey);
  }

  if (connector != null) {
    server.addUnmanagedListener(connector);
  }

  for (URI ep : endpoints) {
    Connector listener = null;
    String scheme = ep.getScheme();
    if ("http".equals(scheme)) {
      listener = HttpServer2.createDefaultChannelConnector();
    } else if ("https".equals(scheme)) {
      SslSocketConnector c = new SslSocketConnectorSecure();
      c.setHeaderBufferSize(1024*64);
      c.setNeedClientAuth(needsClientAuth);
      c.setKeyPassword(keyPassword);

      if (keyStore != null) {
        c.setKeystore(keyStore);
        c.setKeystoreType(keyStoreType);
        c.setPassword(keyStorePassword);
      }

      if (trustStore != null) {
        c.setTruststore(trustStore);
        c.setTruststoreType(trustStoreType);
        c.setTrustPassword(trustStorePassword);
      }
      listener = c;

    } else {
      throw new HadoopIllegalArgumentException(
          "unknown scheme for endpoint:" + ep);
    }
    listener.setHost(ep.getHost());
    listener.setPort(ep.getPort() == -1 ? 0 : ep.getPort());
    server.addManagedListener(listener);
  }
  server.loadListeners();
  return server;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:64,代码来源:HttpServer2.java


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