本文整理匯總了Java中org.eclipse.jetty.server.nio.SelectChannelConnector.setRequestHeaderSize方法的典型用法代碼示例。如果您正苦於以下問題:Java SelectChannelConnector.setRequestHeaderSize方法的具體用法?Java SelectChannelConnector.setRequestHeaderSize怎麽用?Java SelectChannelConnector.setRequestHeaderSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.server.nio.SelectChannelConnector
的用法示例。
在下文中一共展示了SelectChannelConnector.setRequestHeaderSize方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initJettyServer
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
private Server initJettyServer(ComponentRepository repo) {
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(getPort());
connector.setConfidentialPort(getSecurePort());
connector.setRequestHeaderSize(16384);
Server jettyServer = new Server();
jettyServer.setConnectors(new Connector[] {connector});
ContextHandlerCollection contexts = new ContextHandlerCollection();
HandlerCollection handlers = new HandlerCollection();
handlers.addHandler(contexts);
addHandlers(repo, jettyServer, contexts);
jettyServer.setHandler(handlers);
jettyServer.setStopAtShutdown(true);
jettyServer.setGracefulShutdown(2000);
jettyServer.setSendDateHeader(true);
jettyServer.setSendServerVersion(true);
ComponentInfo info = new ComponentInfo(Server.class, "jetty");
repo.registerComponent(info, jettyServer);
repo.registerLifecycle(new ServerLifecycle(jettyServer));
return jettyServer;
}
示例2: run
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
@Override
public void run() throws Exception {
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(config.getPort());
connector.setRequestHeaderSize(config.getMaxHeaderSize());
connector.setRequestBufferSize(config.getMaxContentSize());
server.setHandler(rootHandler);
server.setConnectors(new Connector[]{connector});
server.start();
}
示例3: main
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
/**
* Entry point of Ephyra. Initializes the engine and starts the web service interface.
*
* @param args command line arguments are ignored
*/
public static void main(String[] args) throws Exception {
// enable output of status and error messages
MsgPrinter.enableStatusMsgs(true);
MsgPrinter.enableErrorMsgs(true);
// set log file and enable logging
Logger.setLogfile("log/OpenEphyra");
Logger.enableLogging(true);
String addr = "localhost";
int port = 8080;
if (args.length > 1) {
addr = args[0];
port = Integer.parseInt(args[1]);
}
int NTHREADS = Integer.parseInt(System.getenv("THREADS"));
Server server = new Server();
SelectChannelConnector con1 = new SelectChannelConnector();
con1.setHost(addr);
con1.setPort(port);
con1.setThreadPool(new QueuedThreadPool(NTHREADS));
con1.setMaxIdleTime(30000);
con1.setRequestHeaderSize(8192);
server.setConnectors(new Connector[]{con1});
server.setHandler(new OpenEphyraServer());
server.start();
server.join();
}
示例4: startUp
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
public static Server startUp(UndoAwareMolecularModelManager models, MinervaStartUpConfig conf)
throws Exception {
LOGGER.info("Setup Jetty config.");
// Configuration: Use an already existing handler instance
// Configuration: Use custom JSON renderer (GSON)
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.register(GsonMessageBodyHandler.class);
resourceConfig.register(RequireJsonpFilter.class);
if (conf.useRequestLogging) {
resourceConfig.register(LoggingApplicationEventListener.class);
}
//resourceConfig.register(AuthorizationRequestFilter.class);
LOGGER.info("BatchHandler config inference provider: "+conf.reasonerOpt);
LOGGER.info("BatchHandler config importantRelations: "+conf.importantRelations);
LOGGER.info("BatchHandler config lookupService: "+conf.lookupService);
LOGGER.info("BatchHandler config checkLiteralIds: "+conf.checkLiteralIds);
LOGGER.info("BatchHandler config useRequestLogging: "+conf.useRequestLogging);
if (conf.golrSeedUrl == null) {
// default fall back to normal golr URL
conf.golrSeedUrl = conf.golrUrl;
}
LOGGER.info("SeedHandler config golrUrl: "+conf.golrSeedUrl);
InferenceProviderCreator ipc = createInferenceProviderCreator(conf.reasonerOpt, models);
JsonOrJsonpBatchHandler batchHandler = new JsonOrJsonpBatchHandler(models, conf.defaultModelState,
ipc, conf.importantRelations, conf.lookupService);
batchHandler.CHECK_LITERAL_IDENTIFIERS = conf.checkLiteralIds;
SimpleEcoMapper ecoMapper = EcoMapperFactory.createSimple();
JsonOrJsonpSeedHandler seedHandler = new JsonOrJsonpSeedHandler(models, conf.defaultModelState, conf.golrSeedUrl, ecoMapper );
resourceConfig = resourceConfig.registerInstances(batchHandler, seedHandler);
// setup jetty server port, buffers and context path
Server server = new Server();
// create connector with port and custom buffer sizes
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(conf.port);
connector.setRequestHeaderSize(conf.requestHeaderSize);
connector.setRequestBufferSize(conf.requestBufferSize);
server.addConnector(connector);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath(conf.contextString);
server.setHandler(context);
ServletHolder h = new ServletHolder(new ServletContainer(resourceConfig));
context.addServlet(h, "/*");
// start jetty server
LOGGER.info("Start server on port: "+conf.port+" context: "+conf.contextString);
server.start();
return server;
}
示例5: createServer
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
/**
* Creates a Server that exposes the TestClient1 services via http and https
*
* @return the Server instance
*/
@Override
protected Server createServer() {
// Need this CredentialsSourceFactory in our config to enable our test of basic auth
// with our httpInvoker-echoServiceSecure
registerTestCredentialsSourceFactory();
ConfigConstants configConstants = new ConfigConstants();
Server server = new Server();
SelectChannelConnector connector0 = new SelectChannelConnector();
connector0.setPort(configConstants.SERVER_HTTP_PORT);
connector0.setMaxIdleTime(30000);
connector0.setRequestHeaderSize(8192);
SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
ssl_connector.setPort(configConstants.SERVER_HTTPS_PORT);
SslContextFactory cf = ssl_connector.getSslContextFactory();
cf.setKeyStore(configConstants.KEYSTORE_PATH);
cf.setKeyStorePassword(configConstants.KEYSTORE_PASS);
cf.setKeyManagerPassword(configConstants.KEYSTORE_PASS);
server.setConnectors(new Connector[]{connector0, ssl_connector});
URL webRoot = getClass().getClassLoader().getResource(configConstants.WEB_ROOT);
String location = webRoot.getPath();
LOG.debug("#####################################");
LOG.debug("#");
LOG.debug("# Starting Client1 using following web root " + location);
LOG.debug("#");
LOG.debug("#####################################");
WebAppContext context = new WebAppContext();
context.setResourceBase(location);
context.setContextPath(configConstants.CONTEXT);
HandlerCollection handlers = new HandlerCollection();
handlers.addHandler(context);
server.setHandler(handlers);
server.setDumpAfterStart(true);
//server.setDumpBeforeStop(true);
return server;
}
示例6: deployWebApp
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
private void deployWebApp() {
try {
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
connector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
connector.setResponseHeaderSize(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.setRequestHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setResponseHeaderSize(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());
if (isHttpsEnabled()) {
ConstraintMapping constraintMapping = new ConstraintMapping();
Constraint constraint = new Constraint();
constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
constraintMapping.setPathSpec("/");
constraintMapping.setConstraint(constraint);
ConstraintSecurityHandler csh = (ConstraintSecurityHandler) context.getSecurityHandler();
csh.setConstraintMappings(new ConstraintMapping[]{constraintMapping});
}
server.setHandler(context);
server.start();
System.err.println("FutureSonic running on: " + getUrl());
if (isHttpsEnabled()) {
System.err.println(" and: " + getHttpsUrl());
}
} catch (Throwable x) {
x.printStackTrace();
exception = x;
}
}
示例7: deployWebApp
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private void deployWebApp() {
try {
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
connector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
connector.setResponseHeaderSize(HEADER_BUFFER_SIZE);
connector.setHost(getHost());
connector.setPort(getPort());
if (isHttpsEnabled()) {
connector.setConfidentialPort(getHttpsPort());
}
server.addConnector(connector);
if (isHttpsEnabled()) {
SslSocketConnector sslConnector = new SslSocketConnector();
SslContextFactory sslContextFactory = sslConnector.getSslContextFactory();
sslContextFactory = sslConnector.getSslContextFactory();
sslContextFactory.setExcludeCipherSuites(
new String[] {
"SSL_RSA_WITH_DES_CBC_SHA",
"SSL_DHE_RSA_WITH_DES_CBC_SHA",
"SSL_DHE_DSS_WITH_DES_CBC_SHA",
"SSL_RSA_EXPORT_WITH_RC4_40_MD5",
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"
});
sslContextFactory.addExcludeProtocols(new String[]{"SSLv3","SSLv2Hello"});
sslConnector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
sslConnector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setResponseHeaderSize(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 etc)
((ConstraintSecurityHandler) context.getSecurityHandler()).setConstraintMappings(new ConstraintMapping[]{
createConstraintMapping("/stream", Constraint.DC_NONE),
createConstraintMapping("/coverArt.view", Constraint.DC_NONE),
createConstraintMapping("/", Constraint.DC_CONFIDENTIAL)
});
}
server.setHandler(context);
server.start();
System.err.println("Madsonic running on: " + getUrl());
if (isHttpsEnabled()) {
System.err.println(" and: " + getHttpsUrl());
}
} catch (Throwable x) {
x.printStackTrace();
exception = x;
}
}
示例8: deployWebApp
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
private void deployWebApp() {
try {
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
connector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
connector.setResponseHeaderSize(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.setRequestHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setResponseHeaderSize(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());
if (isHttpsEnabled()) {
ConstraintMapping constraintMapping = new ConstraintMapping();
Constraint constraint = new Constraint();
constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
constraintMapping.setPathSpec("/");
constraintMapping.setConstraint(constraint);
ConstraintSecurityHandler csh = (ConstraintSecurityHandler) context.getSecurityHandler();
csh.setConstraintMappings(new ConstraintMapping[]{constraintMapping});
}
server.setHandler(context);
server.start();
System.err.println("Madsonic running on: " + getUrl());
if (isHttpsEnabled()) {
System.err.println(" and: " + getHttpsUrl());
}
} catch (Throwable x) {
x.printStackTrace();
exception = x;
}
}