本文整理汇总了Java中org.apache.tomcat.InstanceManager类的典型用法代码示例。如果您正苦于以下问题:Java InstanceManager类的具体用法?Java InstanceManager怎么用?Java InstanceManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InstanceManager类属于org.apache.tomcat包,在下文中一共展示了InstanceManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
import org.apache.tomcat.InstanceManager; //导入依赖的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.InstanceManager; //导入依赖的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.InstanceManager; //导入依赖的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.InstanceManager; //导入依赖的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.InstanceManager; //导入依赖的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.InstanceManager; //导入依赖的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.InstanceManager; //导入依赖的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: getInstanceManager
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
private InstanceManager getInstanceManager() {
if (instanceManager == null) {
if (context instanceof StandardContext) {
instanceManager = ((StandardContext)context).getInstanceManager();
} else {
instanceManager = new DefaultInstanceManager(null,
new HashMap<String, Map<String, String>>(),
context,
getClass().getClassLoader());
}
}
return instanceManager;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:ApplicationFilterConfig.java
示例9: getInstanceManager
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
private InstanceManager getInstanceManager() {
if (instanceManager == null) {
if (context instanceof StandardContext) {
instanceManager = ((StandardContext)context).getInstanceManager();
} else {
instanceManager = new DefaultInstanceManager(null,
new HashMap<String, Map<String, String>>(),
context,
getClass().getClassLoader());
}
}
return instanceManager;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:AsyncContextImpl.java
示例10: fireEndpointOnClose
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
private void fireEndpointOnClose(CloseReason closeReason) {
// Fire the onClose event
Throwable throwable = null;
InstanceManager instanceManager = webSocketContainer.getInstanceManager();
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
t.setContextClassLoader(applicationClassLoader);
try {
localEndpoint.onClose(this, closeReason);
} catch (Throwable t1) {
ExceptionUtils.handleThrowable(t1);
throwable = t1;
} finally {
if (instanceManager != null) {
try {
instanceManager.destroyInstance(localEndpoint);
} catch (Throwable t2) {
ExceptionUtils.handleThrowable(t2);
if (throwable == null) {
throwable = t2;
}
}
}
t.setContextClassLoader(cl);
}
if (throwable != null) {
fireEndpointOnError(throwable);
}
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:32,代码来源:WsSession.java
示例11: getInstanceManager
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
public static InstanceManager getInstanceManager(ServletConfig config) {
InstanceManager instanceManager =
(InstanceManager) config.getServletContext().getAttribute(InstanceManager.class.getName());
if (instanceManager == null) {
throw new IllegalStateException("No org.apache.tomcat.InstanceManager set in ServletContext");
}
return instanceManager;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:InstanceManagerFactory.java
示例12: createWebApp
import org.apache.tomcat.InstanceManager; //导入依赖的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
示例13: backgroundProcess
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
@Override
public void backgroundProcess() {
InstanceManager instanceManager = getInstanceManager();
if (instanceManager instanceof DefaultInstanceManager) {
try {
((DefaultInstanceManager) instanceManager).backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("standardContext.backgroundProcess.instanceManager", resources), e);
}
}
super.backgroundProcess();
}
开发者ID:how2j,项目名称:lazycat,代码行数:14,代码来源:StandardContext.java
示例14: getInstanceManager
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
private InstanceManager getInstanceManager() {
if (instanceManager == null) {
if (context instanceof StandardContext) {
instanceManager = ((StandardContext) context).getInstanceManager();
} else {
instanceManager = new DefaultInstanceManager(null, new HashMap<String, Map<String, String>>(), context,
getClass().getClassLoader());
}
}
return instanceManager;
}
开发者ID:how2j,项目名称:lazycat,代码行数:12,代码来源:ApplicationFilterConfig.java
示例15: fireEndpointOnClose
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
private void fireEndpointOnClose(CloseReason closeReason) {
// Fire the onClose event
Throwable throwable = null;
InstanceManager instanceManager = webSocketContainer.getInstanceManager();
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
t.setContextClassLoader(applicationClassLoader);
try {
localEndpoint.onClose(this, closeReason);
} catch (Throwable t1) {
ExceptionUtils.handleThrowable(t1);
throwable = t1;
} finally {
if (instanceManager != null) {
try {
instanceManager.destroyInstance(localEndpoint);
} catch (Throwable t2) {
ExceptionUtils.handleThrowable(t2);
if (throwable == null) {
throwable = t2;
}
}
}
t.setContextClassLoader(cl);
}
if (throwable != null) {
fireEndpointOnError(throwable);
}
}
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:WsSession.java
示例16: getInstanceManager
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
public static InstanceManager getInstanceManager(ServletConfig config) {
InstanceManager instanceManager = (InstanceManager) config.getServletContext()
.getAttribute(InstanceManager.class.getName());
if (instanceManager == null) {
throw new IllegalStateException("No org.apache.tomcat.InstanceManager set in ServletContext");
}
return instanceManager;
}
开发者ID:how2j,项目名称:lazycat,代码行数:9,代码来源:InstanceManagerFactory.java
示例17: onStartup
import org.apache.tomcat.InstanceManager; //导入依赖的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
示例18: getServlet
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
public Servlet getServlet() throws ServletException {
// DCL on 'reload' requires that 'reload' be volatile
// (this also forces a read memory barrier, ensuring the
// new servlet object is read consistently)
if (reload) {
synchronized (this) {
// Synchronizing on jsw enables simultaneous loading
// of different pages, but not the same page.
if (reload) {
// This is to maintain the original protocol.
destroy();
final Servlet servlet;
try {
InstanceManager instanceManager = InstanceManagerFactory.getInstanceManager(config);
servlet = (Servlet) instanceManager.newInstance(ctxt.getFQCN(), ctxt.getJspLoader());
} catch (Exception e) {
Throwable t = ExceptionUtils
.unwrapInvocationTargetException(e);
ExceptionUtils.handleThrowable(t);
throw new JasperException(t);
}
servlet.init(config);
if (!firstTime) {
ctxt.getRuntimeContext().incrementJspReloadCount();
}
theServlet = servlet;
reload = false;
// Volatile 'reload' forces in order write of 'theServlet' and new servlet object
}
}
}
return theServlet;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:39,代码来源:JspServletWrapper.java
示例19: destroy
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
public void destroy() {
if (theServlet != null) {
theServlet.destroy();
InstanceManager instanceManager = InstanceManagerFactory.getInstanceManager(config);
try {
instanceManager.destroyInstance(theServlet);
} catch (Exception e) {
Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
ExceptionUtils.handleThrowable(t);
// Log any exception, since it can't be passed along
log.error(Localizer.getMessage("jsp.error.file.not.found",
e.getMessage()), t);
}
}
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:16,代码来源:JspServletWrapper.java
示例20: getInstanceManager
import org.apache.tomcat.InstanceManager; //导入依赖的package包/类
public static InstanceManager getInstanceManager(ServletConfig config) {
InstanceManager instanceManager =
(InstanceManager) config.getServletContext().getAttribute(InstanceManager.class.getName());
if (instanceManager == null) {
throw new IllegalStateException("No org.apache.tomcat.InstanceManager set in ServletContext");
}
return instanceManager;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:9,代码来源:InstanceManagerFactory.java
注:本文中的org.apache.tomcat.InstanceManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论