本文整理汇总了Java中org.eclipse.jetty.webapp.Configuration.ClassList方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.ClassList方法的具体用法?Java Configuration.ClassList怎么用?Java Configuration.ClassList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.webapp.Configuration
的用法示例。
在下文中一共展示了Configuration.ClassList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JettyServer
import org.eclipse.jetty.webapp.Configuration; //导入方法依赖的package包/类
public JettyServer(final NiFiRegistryProperties properties, final CryptoKeyProvider cryptoKeyProvider) {
final QueuedThreadPool threadPool = new QueuedThreadPool(properties.getWebThreads());
threadPool.setName("NiFi Registry Web Server");
this.properties = properties;
this.masterKeyProvider = cryptoKeyProvider;
this.server = new Server(threadPool);
// enable the annotation based configuration to ensure the jsp container is initialized properly
final Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
classlist.addBefore(JettyWebXmlConfiguration.class.getName(), AnnotationConfiguration.class.getName());
try {
configureConnectors();
loadWars();
} catch (final Throwable t) {
startUpFailure(t);
}
}
示例2: createServer
import org.eclipse.jetty.webapp.Configuration; //导入方法依赖的package包/类
private Server createServer() {
// Taken from Jetty doc
final QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(this.configuration.getMaxThreads());
final Server server = new Server(threadPool);
server.addBean(new ScheduledExecutorScheduler());
if (this.configuration.isNcc()) {
final Configuration.ClassList classList = Configuration.ClassList.setServerDefault(server);
classList.addAfter(
"org.eclipse.jetty.webapp.FragmentConfiguration",
"org.eclipse.jetty.plus.webapp.EnvConfiguration",
"org.eclipse.jetty.plus.webapp.PlusConfiguration");
classList.addBefore(
"org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");
}
return server;
}
示例3: main
import org.eclipse.jetty.webapp.Configuration; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
// add web applications
HandlerCollection handlers = new HandlerCollection();
Preconditions.checkArgument(args != null && args.length > 0, "Missing args: web project. Please pass a list of web projects, e.g.: JettyServer helloworld");
for (String arg : args) {
Iterator<String> it = Splitter.on(":").split(arg).iterator();
String domain = it.next();
String projectName = it.hasNext() ? it.next() : domain;
WebAppContext webappContext = createContext(domain, projectName);
handlers.addHandler(webappContext);
}
server.setHandler(handlers);
// enable web 3.0 annotations
Configuration.ClassList classList = Configuration.ClassList.setServerDefault(server);
classList.addBefore(JettyWebXmlConfiguration.class.getName(), AnnotationConfiguration.class.getName());
server.start();
server.join();
}
示例4: start
import org.eclipse.jetty.webapp.Configuration; //导入方法依赖的package包/类
/**
* Start
* @exception Throwable If an error occurs
*/
public void start() throws Throwable
{
stop();
if (executorService != null)
{
server = new Server(new ExecutorThreadPool(executorService));
}
else
{
server = new Server();
}
MBeanContainer jmx = new MBeanContainer(mbeanServer != null ? mbeanServer :
ManagementFactory.getPlatformMBeanServer());
server.addBean(jmx);
Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");
ServerConnector connector = new ServerConnector(server);
connector.setHost(host);
connector.setPort(port);
connector.setAcceptQueueSize(acceptQueueSize);
server.setConnectors(new Connector[]{connector});
log.info("Jetty " + Server.getVersion() + " started");
}
示例5: run
import org.eclipse.jetty.webapp.Configuration; //导入方法依赖的package包/类
/**
* Runs a webhook example application.
*
* @exception Exception if any exception occurs
*/
protected void run() throws Exception {
Properties serverProperties = new Properties();
serverProperties.load(
ClassLoader.getSystemResourceAsStream(SERVER_PROPERTIES));
System.getProperties().putAll(serverProperties);
int httpPort = DEFAULT_HTTP_PORT;
String httpPortProperty = System.getProperty(HTTP_PORT_NAME);
if (httpPortProperty != null) {
httpPort = Integer.parseInt(httpPortProperty);
}
Server server = new Server(httpPort);
// Setting up logs.
String logDirectory = System.getProperty("jetty.logs");
if (logDirectory != null) {
if (!logDirectory.endsWith(File.separator)) {
if (logDirectory.endsWith("/")) {
logDirectory = logDirectory.substring(
0, logDirectory.length() - 1);
}
logDirectory = logDirectory + File.separator;
}
String serverLog = logDirectory + SERVER_LOG;
RolloverFileOutputStream serverLogStream
= new RolloverFileOutputStream(serverLog, true, 14);
System.setErr(new PrintStream(serverLogStream, true));
}
// Setting up for jetty-annotations.
Configuration.ClassList classes
= Configuration.ClassList.setServerDefault(server);
classes.addBefore(
"org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");
ContextHandlerCollection contexts = new ContextHandlerCollection();
server.setHandler(contexts);
DeploymentManager deploymentManager = new DeploymentManager();
deploymentManager.setContexts(contexts);
deploymentManager.setContextAttribute(
WebInfConfiguration.CONTAINER_JAR_PATTERN,
".*\\.jar$|.*/classes/?$");
deploymentManager.addAppProvider(this);
server.addBean(deploymentManager);
server.start();
server.join();
}
示例6: start
import org.eclipse.jetty.webapp.Configuration; //导入方法依赖的package包/类
/**
* Starts Jetty.
*
* @param args
* @throws Exception
*/
public void start(final String[] args, final URL warLocation) throws Exception {
Server server = new Server();
ServerConnector connector = new ServerConnector(server);
// Set JSP to use Standard JavaC always
System.setProperty("org.apache.jasper.compiler.disablejsr199", "false");
// Set some timeout options to make debugging easier.
connector.setIdleTimeout(1000 * 60 * 60);
connector.setSoLingerTime(-1);
connector.setPort(Integer.parseInt(System.getProperty("logsniffer.httpPort", "8082")));
connector.setHost(System.getProperty("logsniffer.httpListenAddress", "0.0.0.0"));
server.setConnectors(new Connector[] { connector });
// Log.setLog(new Slf4jLog());
// This webapp will use jsps and jstl. We need to enable the
// AnnotationConfiguration in order to correctly
// set up the jsp container
Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");
WebContextWithExtraConfigurations ctx = createWebAppContext();
ctx.setServer(server);
ctx.setWar(warLocation.toExternalForm());
String ctxPath = System.getProperty("logsniffer.contextPath", "/");
if (!ctxPath.startsWith("/")) {
ctxPath = "/" + ctxPath;
}
ctx.setContextPath(ctxPath);
configureWebAppContext(ctx);
ctx.freezeConfigClasses();
server.setHandler(ctx);
server.setStopAtShutdown(true);
try {
server.start();
server.join();
} catch (Exception e) {
e.printStackTrace();
System.exit(100);
}
}
示例7: JettyRunTime
import org.eclipse.jetty.webapp.Configuration; //导入方法依赖的package包/类
public JettyRunTime( String ip, String port, String webapp, String adminport ) throws Exception{
System.out.println( "Jetty starting up ... please wait" );
// Set JSP to use Standard JavaC always
System.setProperty("org.apache.jasper.compiler.disablejsr199", "false");
if ( ip == null )
server = new Server( Integer.valueOf(port) );
else
server = new Server( InetSocketAddress.createUnresolved(ip, Integer.valueOf(port)) );
int aport = Integer.valueOf(adminport);
if ( aport > 0 ){
new adminPort(aport);
}
WebAppContext context = new WebAppContext();
// This webapp will use jsps and jstl. We need to enable the
// AnnotationConfiguration in order to correctly
// set up the jsp container
Configuration.ClassList classlist = Configuration.ClassList
.setServerDefault( server );
classlist.addBefore(
"org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration" );
// Set the ContainerIncludeJarPattern so that jetty examines these
// container-path jars for tlds, web-fragments etc.
// If you omit the jar that contains the jstl .tlds, the jsp engine will
// scan for them instead.
context.setAttribute(
"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$" );
context.setDescriptor( webapp + "/WEB-INF/web.xml");
context.setResourceBase( webapp );
context.setContextPath("/");
context.setParentLoaderPriority(true);
context.setDefaultsDescriptor("org/aw20/jettydesktop/rte/webdefault.xml");
server.setHandler(context);
server.start();
System.out.println( JETTYSTARTED );
}