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


Java SimpleInstanceManager类代码示例

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


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

示例1: initialize

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
@Override
public void initialize() throws Exception {
    if (context == null) {
        throw new IllegalStateException();
    }

    /*
     * Configure the application to support the compilation of JSP files.
     * We need a new class loader and some stuff so that Jetty can call the
     * onStartup() methods as required.
     */
    setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
    setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
    addBean(new ServletContainerInitializersStarter(this), true);
    //setClassLoader(new URLClassLoader(new URL[0], context.getClassLoader()));

    if (!standalone) {
        CoreService rootService = context.getRootService();
        WebService webService = WebService.create(getServletContext(), rootService);
        webService.start();

        setAttribute(WebService.ROOT_WEB_SERVICE_ATTRIBUTE, webService);
    }
}
 
开发者ID:aspectran,项目名称:aspectran,代码行数:25,代码来源:JettyWebAppContext.java

示例2: configureWebAppContext

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
/**
 * Setups the web application context.
 * 
 * @throws IOException
 * @throws Exception
 */
protected void configureWebAppContext(final WebContextWithExtraConfigurations context) throws Exception {
	context.setAttribute("javax.servlet.context.tempdir", getScratchDir());
	// 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.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
	context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
	context.addBean(new ServletContainerInitializersStarter(context), true);
	// context.setClassLoader(getUrlClassLoader());

	context.addServlet(jspServletHolder(), "*.jsp");
	context.replaceConfiguration(WebInfConfiguration.class, WebInfConfigurationHomeUnpacked.class);
}
 
开发者ID:logsniffer,项目名称:logsniffer,代码行数:23,代码来源:JettyLauncher.java

示例3: createDeployedApplicationInstance

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
private WebAppContext createDeployedApplicationInstance(File workDirectory,
		String deployedApplicationPath) {
	WebAppContext deployedApplication = new WebAppContext();
	deployedApplication.setContextPath(this.getContextPath());
	deployedApplication.setWar(deployedApplicationPath);
	deployedApplication.setAttribute("javax.servlet.context.tempdir",
			workDirectory.getAbsolutePath());
	deployedApplication
			.setAttribute(
					"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
					".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/.*taglibs.*\\.jar$");
	deployedApplication.setAttribute(
			"org.eclipse.jetty.containerInitializers", jspInitializers());
	deployedApplication.setAttribute(InstanceManager.class.getName(),
			new SimpleInstanceManager());
	deployedApplication.addBean(new ServletContainerInitializersStarter(
			deployedApplication), true);
	// webapp.setClassLoader(new URLClassLoader(new
	// URL[0],App.class.getClassLoader()));
	deployedApplication.addServlet(jspServletHolder(), "*.jsp");
	return deployedApplication;
}
 
开发者ID:yahoo,项目名称:mysql_perf_analyzer,代码行数:23,代码来源:App.java

示例4: createCrossDomainHandler

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
/**
 * Creates a Jetty context handler that can be used to expose the cross-domain functionality as implemented by
 * {@link FlashCrossDomainServlet}.
 *
 * Note that an invocation of this method will not register the handler (and thus make the related functionality
 * available to the end user). Instead, the created handler is returned by this method, and will need to be
 * registered with the embedded Jetty webserver by the caller.
 *
 * @return A Jetty context handler (never null).
 */
protected Handler createCrossDomainHandler()
{
    final ServletContextHandler context = new ServletContextHandler( null, "/crossdomain.xml", ServletContextHandler.SESSIONS );

    // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
    final List<ContainerInitializer> initializers = new ArrayList<>();
    initializers.add( new ContainerInitializer( new JasperInitializer(), null ) );
    context.setAttribute( "org.eclipse.jetty.containerInitializers", initializers );
    context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager() );

    // Generic configuration of the context.
    context.setAllowNullPathInfo( true );

    // Add the functionality-providers.
    context.addServlet( new ServletHolder( new FlashCrossDomainServlet() ), "" );

    return context;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:29,代码来源:HttpBindManager.java

示例5: initializePlugin

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
@Override
public void initializePlugin( PluginManager manager, File pluginDirectory )
{
    for ( final String publicResource : publicResources )
    {
        AuthCheckFilter.addExclude( publicResource );
    }

    // Add the Webchat sources to the same context as the one that's providing the BOSH interface.
    context = new WebAppContext( null, pluginDirectory.getPath() + File.separator + "classes/", "/inverse" );
    context.setClassLoader( this.getClass().getClassLoader() );

    // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
    final List<ContainerInitializer> initializers = new ArrayList<>();
    initializers.add( new ContainerInitializer( new JettyJasperInitializer(), null ) );
    context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
    context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager());

    HttpBindManager.getInstance().addJettyHandler( context );
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:InversePlugin.java

示例6: initializePlugin

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
@Override
public void initializePlugin( PluginManager manager, File pluginDirectory )
{
    for ( final String publicResource : publicResources )
    {
        AuthCheckFilter.addExclude( publicResource );
    }

    // Add the Webchat sources to the same context as the one that's providing the BOSH interface.
    context = new WebAppContext( null, pluginDirectory.getPath() + File.separator + "classes", "/candy" );
    context.setClassLoader( this.getClass().getClassLoader() );

    // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
    final List<ContainerInitializer> initializers = new ArrayList<>();
    initializers.add( new ContainerInitializer( new JettyJasperInitializer(), null ) );
    context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
    context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager());

    HttpBindManager.getInstance().addJettyHandler( context );
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:CandyPlugin.java

示例7: main

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();

        Server server = new Server();
        ServerConnector connector = new ServerConnector(server);
        connector.setPort(8080);
        server.setConnectors(new Connector[]{connector});

        WebAppContext context = new WebAppContext();
        context.setServer(server);
        context.setContextPath("/");
        context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*/[^/]*taglibs.*\\.jar$");
        context.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
        context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
        context.addBean(new ServletContainerInitializersStarter(context), true);

        // Prevent loading of logging classes
        context.getSystemClasspathPattern().add("org.apache.log4j.");
        context.getSystemClasspathPattern().add("org.slf4j.");
        context.getSystemClasspathPattern().add("org.apache.commons.logging.");

        ProtectionDomain protectionDomain = EmbeddedJettyServer.class.getProtectionDomain();
        URL location = protectionDomain.getCodeSource().getLocation();
        context.setWar(location.toExternalForm());

        server.setHandler(context);
        try {
            server.start();
            server.join();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
 
开发者ID:stevespringett,项目名称:Alpine,代码行数:37,代码来源:EmbeddedJettyServer.java

示例8: createWebApp

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
/**
     * Creates a web-app deployment for a war file gives as path
     * @param webappWar
     *  path to the war file
     * @return
     *  a webApplication context that can be deployed on the jetty server.
     */
    private static WebAppContext createWebApp(final Path webappWar) throws IOException {

//        Path tempWar = Files.createTempFile("bdj-", webappWar.getFileName().toString());
//        LOG.info("Creating temporary copy of war " + tempWar);
//        Files.copy(webappWar, tempWar, StandardCopyOption.REPLACE_EXISTING);
//        LOG.info("Deploying web app from " + tempWar);

        final WebAppContext webapp = new WebAppContext();
        webapp.setSystemClasses(new String[] {
                Configuration.class.getName(), ConfigChangeListener.class.getName()
        });
        webapp.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                            ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");

		/*
         * Configure the application to support the compilation of JSP files.
		 * We need a new class loader and some stuff so that Jetty can call the
		 * onStartup() methods as required.
		 */
        webapp.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
        webapp.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
        webapp.addBean(new ServletContainerInitializersStarter(webapp), true);
        webapp.setContextPath("/");
        webapp.setWar(webappWar.toString());
        return webapp;
    }
 
开发者ID:gmuecke,项目名称:boutique-de-jus,代码行数:34,代码来源:BoutiqueDeJusWebServer.java

示例9: addJspSupport

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
void addJspSupport(BeyondJWebAppContext webApp, File scratchDir, Server server) {

        System.setProperty("org.apache.jasper.compiler.disablejsr199", "false");
        webApp.setAttribute(JSP_TEMP_DIR, scratchDir);
        webApp.setAttribute(
                "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");

        webApp.setAttribute(JETTY_CONTAINER_INITIALIZERS, jspInitializers());
        webApp.setAttribute(InstanceManagerFactory.class.getName(), new SimpleInstanceManager());
        webApp.addBean(new ServletContainerInitializersStarter(webApp), Boolean.TRUE);
        webApp.addServlet(jspServletHolder(), "*.jsp");
        addDefaultServlet(webApp);
    }
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:15,代码来源:JettyLauncher.java

示例10: onStartup

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
@Override
public void onStartup(Set<Class<?>> types, ServletContext context) throws ServletException {
    if (log.isDebugEnabled()) {
        log.debug(Localizer.getMessage(MSG + ".onStartup", context.getServletContextName()));
    }

    // Setup a simple default Instance Manager
    if (context.getAttribute(InstanceManager.class.getName())==null) {
        context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
    }

    boolean validate = Boolean.parseBoolean(
            context.getInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM));
    String blockExternalString = context.getInitParameter(
            Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
    boolean blockExternal;
    if (blockExternalString == null) {
        blockExternal = true;
    } else {
        blockExternal = Boolean.parseBoolean(blockExternalString);
    }

    // scan the application for TLDs
    TldScanner scanner = newTldScanner(context, true, validate, blockExternal);
    try {
        scanner.scan();
    } catch (IOException | SAXException e) {
        throw new ServletException(e);
    }

    // add any listeners defined in TLDs
    for (String listener : scanner.getListeners()) {
        context.addListener(listener);
    }

    context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME,
            new TldCache(context, scanner.getUriTldResourcePathMap(),
                    scanner.getTldResourcePathTaglibXmlMap()));
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:40,代码来源:JasperInitializer.java

示例11: createBoshHandler

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
/**
 * Creates a Jetty context handler that can be used to expose BOSH (HTTP-Bind) functionality.
 *
 * Note that an invocation of this method will not register the handler (and thus make the related functionality
 * available to the end user). Instead, the created handler is returned by this method, and will need to be
 * registered with the embedded Jetty webserver by the caller.
 *
 * @return A Jetty context handler (never null).
 */
protected Handler createBoshHandler()
{
    final ServletContextHandler context = new ServletContextHandler( null, "/http-bind", ServletContextHandler.SESSIONS );

    // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
    final List<ContainerInitializer> initializers = new ArrayList<>();
    initializers.add( new ContainerInitializer( new JasperInitializer(), null ) );
    context.setAttribute( "org.eclipse.jetty.containerInitializers", initializers );
    context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager() );

    // Generic configuration of the context.
    context.setAllowNullPathInfo( true );

    // Add the functionality-providers.
    context.addServlet( new ServletHolder( new HttpBindServlet() ), "/*" );

    // Add compression filter when needed.
    if ( isHttpCompressionEnabled() )
    {
        final Filter gzipFilter = new AsyncGzipFilter()
        {
            @Override
            public void init( FilterConfig config ) throws ServletException
            {
                super.init( config );
                _methods.add( HttpMethod.POST.asString() );
                Log.info( "Installed response compression filter" );
            }
        };

        final FilterHolder filterHolder = new FilterHolder();
        filterHolder.setFilter( gzipFilter );
        context.addFilter( filterHolder, "/*", EnumSet.of( DispatcherType.REQUEST ) );
    }

    return context;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:47,代码来源:HttpBindManager.java

示例12: createWebAppContext

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
private void createWebAppContext() {
    WebAppContext context;
    // Add web-app. Check to see if we're in development mode. If so, we don't
    // add the normal web-app location, but the web-app in the project directory.
    boolean developmentMode = Boolean.getBoolean("developmentMode");
    if( developmentMode )
    {
        System.out.println(LocaleUtils.getLocalizedString("admin.console.devmode"));

        context = new WebAppContext(contexts, pluginDir.getParentFile().getParentFile().getParentFile().getParent() +
                File.separator + "src" + File.separator + "web", "/");
    }
    else {
        context = new WebAppContext(contexts, pluginDir.getAbsoluteFile() + File.separator + "webapp",
                "/");
    }

    // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
    final List<ContainerInitializer> initializers = new ArrayList<>();
    initializers.add(new ContainerInitializer(new JasperInitializer(), null));
    context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
    context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());

    // The index.html includes a redirect to the index.jsp and doesn't bypass
    // the context security when in development mode
    context.setWelcomeFiles(new String[]{"index.html"});

    // Make sure the context initialization is done when in development mode
    if( developmentMode )
    {
        context.addBean( new ServletContainerInitializersStarter( context ), true );
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:34,代码来源:AdminConsolePlugin.java

示例13: initJSP

import org.apache.tomcat.SimpleInstanceManager; //导入依赖的package包/类
private void initJSP(WebAppContext ctx) throws IOException {
    ctx.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
    ctx.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
    ctx.addBean(new ServletContainerInitializersStarter(ctx), true);
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:6,代码来源:SteveAppContext.java


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