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


Java AnnotationConfiguration类代码示例

本文整理汇总了Java中org.eclipse.jetty.annotations.AnnotationConfiguration的典型用法代码示例。如果您正苦于以下问题:Java AnnotationConfiguration类的具体用法?Java AnnotationConfiguration怎么用?Java AnnotationConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: start

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
public void start() {
    // TODO: remove redundant fields from config and move this check to XRE Redirector
    if (! config.getEnableCommunicationEndpoint()) {
        log.warn("skipping Jetty endpoint due to configuration");
        return;
    }

    if (started) {
        log.warn("Jetty is already started");
    }

    started = true;
    Integer port = config.getCommunicationEndpointPort();

    log.info("Starting embedded jetty server (XRERedirector Gateway) on port: {}", port);

    WebAppContext webAppContext = new WebAppContext();
    webAppContext.setConfigurations(new Configuration[]{new AnnotationConfiguration() {
        @Override
        public void preConfigure(WebAppContext context) {
            ClassInheritanceMap map = new ClassInheritanceMap();
            map.put(WebApplicationInitializer.class.getName(), new ConcurrentHashSet<String>() {{
                add(WebAppInitializer.class.getName());
            }});
            context.setAttribute(CLASS_INHERITANCE_MAP, map);
            _classInheritanceHandler = new ClassInheritanceHandler(map);
        }
    }});

    server = new Server(port);
    server.setHandler(webAppContext);

    try {
        server.start();
    } catch (Exception e) {
        log.error("Failed to start embedded jetty server (XRERedirector communication endpoint) on port: " + port, e);
    }

    log.info("Started embedded jetty server (Redirector Gateway) on port: {}", port);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:41,代码来源:EmbeddedJetty.java

示例2: JettyServer

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的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);
    }
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:20,代码来源:JettyServer.java

示例3: init

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
private void init() {
	System.out.println("host:" + hostList + " war:" + war);
	this.setContextPath("/");
	this.setWar(war);
	if (hostList != null && !hostList.isEmpty()) {
		if (!"localhost".equals(hostList.get(0))) {
			String[] hosts = new String[hostList.size()];
			hostList.toArray(hosts);
			super.setVirtualHosts(hosts);
		}
	}

	this.setConfigurations(new Configuration[] { //
			new io.leopard.myjetty.webapp.EmbedWebInfConfiguration(hostList, war), //
			new MetaInfConfiguration(), //
			new AnnotationConfiguration(), //
			new WebXmlConfiguration(), //
			new FragmentConfiguration() //
			// new TagLibConfiguration() //
	});
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:22,代码来源:MyJettyWebAppContext.java

示例4: main

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	int port = 8080;
	Server server = new Server(port);
	

	WebAppContext context = new WebAppContext();
       context.setWar("./src/main/webapp");
	context.setConfigurations(new Configuration[] {
			new AnnotationConfiguration(), new WebXmlConfiguration(),
			new WebInfConfiguration(), new TagLibConfiguration(),
			new PlusConfiguration(), new MetaInfConfiguration(),
			new FragmentConfiguration(), new EnvConfiguration() });

	context.setContextPath("/");
	context.setParentLoaderPriority(true);
	server.setHandler(context);
	server.start();
	server.dump(System.err);
	server.join();
}
 
开发者ID:extrema,项目名称:jetty-embedded,代码行数:21,代码来源:EmbedMe.java

示例5: main

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的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();
    }
 
开发者ID:extrema,项目名称:jetty-embedded,代码行数:24,代码来源:JettyServer.java

示例6: start

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
public void start() throws Exception {
    server = new Server(8080);

    WebAppContext webAppContext = new WebAppContext();
    webAppContext.setResourceBase("src/main/webapp");
    webAppContext.setContextPath("/");
    File[] mavenLibs = Maven.resolver().loadPomFromFile("pom.xml")
                .importCompileAndRuntimeDependencies()
                .resolve().withTransitivity().asFile();
    for (File file: mavenLibs) {
        webAppContext.getMetaData().addWebInfJar(new FileResource(file.toURI()));
    }
    webAppContext.getMetaData().addContainerResource(new FileResource(new File("./target/classes").toURI()));

    webAppContext.setConfigurations(new Configuration[] {
        new AnnotationConfiguration(),
        new WebXmlConfiguration(),
        new WebInfConfiguration()
    });
    server.setHandler(webAppContext);

    logger.info(">>> STARTING EMBEDDED JETTY SERVER");
    server.start();
    
}
 
开发者ID:pjagielski,项目名称:jersey2-starter,代码行数:26,代码来源:EmbeddedJetty.java

示例7: createConfigurations

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
private Configuration[] createConfigurations() {
    Configuration[] configurations = {
            new AnnotationConfiguration(),
            new WebInfConfiguration(),
            new WebXmlConfiguration(),
            new MetaInfConfiguration(),
            new FragmentConfiguration(),
            new EnvConfiguration(),
            new PlusConfiguration(),
            new JettyWebXmlConfiguration()
    };

    return configurations;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:15,代码来源:Application.java

示例8: JettyConsoleWebappContext

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
public JettyConsoleWebappContext(HandlerContainer parent, String webApp, String contextPath) {
    super(parent, webApp, contextPath);
    setConfigurations(new Configuration[]{
            new WebInfConfiguration(),
            new WebXmlConfiguration(),
            new MetaInfConfiguration(),
            new FragmentConfiguration(),
            new EnvConfiguration(),
            new org.eclipse.jetty.plus.webapp.PlusConfiguration(),
            new AnnotationConfiguration(),
            new JettyWebXmlConfiguration()
    });
}
 
开发者ID:eirbjo,项目名称:jetty-console,代码行数:14,代码来源:JettyConsoleWebappContext.java

示例9: createClassList

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
private Configuration.ClassList createClassList() {

        Configuration.ClassList classList = new Configuration.ClassList(new String[0]);

        classList.add(AnnotationConfiguration.class.getName());
        classList.add(WebInfConfiguration.class.getName());
        classList.add(WebXmlConfiguration.class.getName());
        classList.add(MetaInfConfiguration.class.getName());
        classList.add(FragmentConfiguration.class.getName());
        classList.add(JettyWebXmlConfiguration.class.getName());
        classList.add(EnvConfiguration.class.getName());
        classList.add(PlusConfiguration.class.getName());

        return classList;
    }
 
开发者ID:kumuluz,项目名称:kumuluzee,代码行数:16,代码来源:JettyFactory.java

示例10: JettyLaucher

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
JettyLaucher(final Properties props) {
	String host = props.getProperty("host", "127.0.0.1");
	int port = Integer.parseInt(props.getProperty("port", "8080"));
	int timeout = Integer.parseInt(props.getProperty("timeoutSec", "900"));
	String baseDir  = props.getProperty("baseDir", "webapp");
	logger.info("Try to start server [{}:{}], baseDir={}, connection-timeout={}sec.", host, port, baseDir, timeout);
	System.setProperty(Constants.SYSPROP_DIR_WEBAPP, baseDir);

       // Handler for multiple web apps
       HandlerCollection handlers = new HandlerCollection();
       
       webAppContext = new WebAppContext();
       webAppContext.setContextPath("/");
       webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", 
               ".*/classes/*");
       webAppContext.setResourceBase(baseDir);
       webAppContext.setConfigurations(new Configuration[] {
       	    new AnnotationConfiguration(), new WebInfConfiguration(),
               new PlusConfiguration(), new MetaInfConfiguration(),
               new FragmentConfiguration(), new EnvConfiguration()
       	});
       handlers.addHandler(webAppContext);
       
	ServerConnector connector = new ServerConnector(server);
	connector.setHost(host);
	connector.setPort(port);
	connector.setIdleTimeout(timeout * 1000);
	server.addConnector(connector);
	 
	server.setHandler(handlers);
}
 
开发者ID:th-schwarz,项目名称:bacoma,代码行数:32,代码来源:JettyLaucher.java

示例11: start

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
private void start() {

        ProtectionDomain domain = WebAppRunner.class.getProtectionDomain();
        URL location = domain.getCodeSource().getLocation();

        WebAppContext context = new WebAppContext();
        context.setContextPath( "/" );
        context.setWar( location.toExternalForm() );
        context.setParentLoaderPriority( true );
        context.setConfigurations( new Configuration[] { 
                        new WebInfConfiguration(), 
                        new WebXmlConfiguration(),
                        new MetaInfConfiguration(),
                        new PlusConfiguration(), 
                        new JettyWebXmlConfiguration(),
                        new AnnotationConfiguration()
        } );

        Server server = new Server( 8080 );
        server.dumpStdErr();
        server.setHandler( context );
        try {
            server.start();
            server.join();
        }
        catch ( Exception e ) {
            LOG.warn( e );
        }
    }
 
开发者ID:ragnarruutel,项目名称:java8-jetty9-spring4-noxml,代码行数:30,代码来源:WebAppRunner.java

示例12: main

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    
    System.out.println(IOUtils.toString(new FileInputStream("../metl-server/src/main/resources/Metl.asciiart")));

    new File(System.getProperty("java.io.tmpdir")).mkdirs();
    new File("working").mkdirs();
    System.setProperty("org.jumpmind.metl.ui.init.config.dir","working");
    
    Server server = new Server(42000);
    ClassList classlist = Configuration.ClassList.setServerDefault(server);
    classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration");

    WebAppContext webapp = new WebAppContext();
    webapp.setParentLoaderPriority(true);
    webapp.setConfigurationDiscovered(true);
    webapp.setContextPath("/metl");
    webapp.setWar("../metl-war/src/main/webapp");
    webapp.setResourceBase("../metl-war/src/main/webapp");

    ConcurrentHashMap<String, ConcurrentHashSet<String>> map = new ClassInheritanceMap();
    ConcurrentHashSet<String> set = new ConcurrentHashSet<>();
    set.add("org.jumpmind.metl.ui.init.AppInitializer");
    map.put("org.springframework.web.WebApplicationInitializer", set);
    webapp.setAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP, map);

    server.setHandler(webapp);
    
    ServerContainer webSocketServer = WebSocketServerContainerInitializer.configureContext(webapp);
    webSocketServer.setDefaultMaxSessionIdleTimeout(10000000);        
    
    server.start();
    server.join();

}
 
开发者ID:JumpMind,项目名称:metl,代码行数:35,代码来源:Develop.java

示例13: createWebAppContext

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
private WebAppContext createWebAppContext(String path, File war) throws MalformedURLException {
	WebAppContext webAppContext = new WebAppContext();
	webAppContext.setContextPath(path);
	webAppContext.setParentLoaderPriority(false);
	if (war == null) {
		webAppContext.setWar(Main.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm());
	} else {
		webAppContext.setWar(war.toURI().toURL().toExternalForm());
	}
	webAppContext.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebInfConfiguration(),
			new WebXmlConfiguration(), new MetaInfConfiguration(), new FragmentConfiguration(),
			new EnvConfiguration(), new PlusConfiguration(), new JettyWebXmlConfiguration() });
	return webAppContext;
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:15,代码来源:Main.java

示例14: loadWar

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
private void loadWar()
{
    File war = new File("./webapp/jqm-ws.war");
    if (!war.exists() || !war.isFile())
    {
        return;
    }
    jqmlogger.info("Jetty will now load the web service application war");

    // Load web application.
    webAppContext = new WebAppContext(war.getPath(), "/");
    webAppContext.setDisplayName("JqmWebServices");

    // Hide server classes from the web app
    final int nbEx = 5;
    String[] defExcl = webAppContext.getDefaultServerClasses();
    String[] exclusions = new String[defExcl.length + nbEx];
    for (int i = nbEx; i <= defExcl.length; i++)
    {
        exclusions[i] = defExcl[i - nbEx];
    }
    exclusions[0] = "com.enioka.jqm.tools.";
    exclusions[1] = "com.enioka.jqm.api.";
    // exclusions[2] = "org.slf4j.";
    // exclusions[3] = "org.apache.log4j.";
    exclusions[4] = "org.glassfish."; // Jersey
    webAppContext.setServerClasses(exclusions);

    // JQM configuration should be on the class path
    webAppContext.setExtraClasspath("conf/jqm.properties");
    webAppContext.setInitParameter("jqmnode", node.getName());
    webAppContext.setInitParameter("jqmnodeid", node.getId().toString());

    // Set configurations (order is important: need to unpack war before reading web.xml)
    webAppContext.setConfigurations(new Configuration[] { new WebInfConfiguration(), new WebXmlConfiguration(),
            new MetaInfConfiguration(), new FragmentConfiguration(), new AnnotationConfiguration() });

    h.addHandler(webAppContext);
}
 
开发者ID:enioka,项目名称:jqm,代码行数:40,代码来源:JettyServer.java

示例15: startJetty

import org.eclipse.jetty.annotations.AnnotationConfiguration; //导入依赖的package包/类
@Before
public void startJetty() throws Exception {
	server = new Server(new InetSocketAddress("127.0.0.1", 0));

	final WebAppContext sillyWebApp = new WebAppContext("sillyWebApp", "/");
	final AnnotationConfiguration annotationConfiguration = new AnnotationConfiguration();
	annotationConfiguration.createServletContainerInitializerAnnotationHandlers(sillyWebApp,
		Collections.<ServletContainerInitializer>singletonList(new TestConfig()));
	sillyWebApp.setConfigurations(new Configuration[]{annotationConfiguration});
	server.setHandler(sillyWebApp);
	server.start();
	serverUrl = "http://" + server.getConnectors()[0].getName() + "/";
}
 
开发者ID:tracee,项目名称:tracee,代码行数:14,代码来源:TraceeFilterIT.java


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