本文整理了Java中org.mortbay.jetty.webapp.WebAppContext.setClassLoader()
方法的一些代码示例,展示了WebAppContext.setClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.setClassLoader()
方法的具体详情如下:
包路径:org.mortbay.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:setClassLoader
暂无
代码示例来源:origin: org.sonatype.plexus/plexus-jetty6
public WebAppContext getWebAppContext( Context context, ContextHandlerCollection parent )
throws Exception
{
WebAppContext webapp = new WebAppContext( parent, getWarPath(), getContextPath() );
// Put all our custom attribute into the servlet context
if ( getContextAttributes() != null )
{
for ( Iterator<Object> i = getContextAttributes().keySet().iterator(); i.hasNext(); )
{
String attributeKey = (String) i.next();
webapp.setAttribute( attributeKey, getContextAttributes().getProperty( attributeKey ) );
}
}
// Put the container for the application into the servlet context
PlexusContainer container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
webapp.setAttribute( PlexusConstants.PLEXUS_KEY, container );
webapp.setClassLoader( container.getContainerRealm() );
return webapp;
}
}
代码示例来源:origin: org.sonatype.plexus/plexus-jetty6
webAppContext.setClassLoader( container.getContainerRealm() );
webAppContext.setClassLoader( classLoader );
webAppContext.setParentLoaderPriority( false );
代码示例来源:origin: org.sonatype.plexus/plexus-jetty6
public void lifeCycleStarting( LifeCycle lifecycle )
{
if ( lifecycle instanceof ContextHandlerCollection )
{
Logger logger = Log.getLogger( getClass().getName() );
Handler[] childHandlers = ((ContextHandlerCollection) lifecycle).getChildHandlers();
if ( childHandlers != null && childHandlers.length > 0 )
{
for ( Handler child : childHandlers )
{
if ( child instanceof WebAppContext )
{
WebAppContext webapp = (WebAppContext) child;
if ( logger != null )
{
logger.info( "Injecting Plexus container for: {} (context path: {})", webapp.getDisplayName(),
webapp.getContextPath() );
}
PlexusContainer container = PlexusContainerHolder.get();
webapp.setAttribute( PlexusConstants.PLEXUS_KEY, container );
webapp.setClassLoader( container.getContainerRealm() );
}
}
}
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-kms
context.setClassLoader(cl);
代码示例来源:origin: org.eclipse.hudson/hudson-test-framework
/**
* Prepares a webapp hosting environment to get {@link ServletContext}
* implementation that we need for testing.
*/
protected ServletContext createWebServer() throws Exception {
server = new Server();
WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration(), new NoListenerConfiguration()});
server.setHandler(context);
context.setMimeTypes(MIME_TYPES);
SocketConnector connector = new SocketConnector();
server.addConnector(connector);
server.addUserRealm(configureUserRealm());
server.start();
localPort = connector.getLocalPort();
return context.getServletContext();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework
/**
* Prepares a webapp hosting environment to get {@link ServletContext} implementation
* that we need for testing.
*/
protected ServletContext createWebServer() throws Exception {
server = new Server();
WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration(),new NoListenerConfiguration()});
server.setHandler(context);
context.setMimeTypes(MIME_TYPES);
SocketConnector connector = new SocketConnector();
server.addConnector(connector);
server.addUserRealm(configureUserRealm());
server.start();
localPort = connector.getLocalPort();
return context.getServletContext();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness
/**
* Prepares a webapp hosting environment to get {@link ServletContext} implementation
* that we need for testing.
*/
protected ServletContext createWebServer() throws Exception {
server = new Server();
WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration(),new NoListenerConfiguration()});
server.setHandler(context);
context.setMimeTypes(MIME_TYPES);
SocketConnector connector = new SocketConnector();
server.addConnector(connector);
server.addUserRealm(configureUserRealm());
server.start();
localPort = connector.getLocalPort();
return context.getServletContext();
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
setClassLoader(null);
代码示例来源:origin: com.github.albfernandez.test-jsf/jsf-test-jetty
private void createContext() {
webAppContext = new WebAppContext();
webAppContext.setContextPath("/");
webAppContext.setBaseResource(serverRoot);
webAppContext.setClassLoader(getClassLoader());
org.mortbay.jetty.servlet.ServletHolder defaultServletHolder =
new org.mortbay.jetty.servlet.ServletHolder(new DefaultServlet());
//defaultServletHolder.setInitParameter("aliases", Boolean.FALSE.toString());
webAppContext.addServlet(defaultServletHolder, "/");
webAppContext.addEventListener(new HttpSessionListener() {
public void sessionDestroyed(HttpSessionEvent se) {
session = null;
}
public void sessionCreated(HttpSessionEvent se) {
session = se.getSession();
}
});
}
代码示例来源:origin: org.apache.commons/commons-vfs2
private void prepareWebapp(final File file, final File repository, final File tmp) {
webapp.setContextPath("/");
webapp.setWar(file.getPath());
webapp.setClassLoader(JackrabbitMain.class.getClassLoader());
// we use a modified web.xml which has some servlets remove (which produce random empty directories)
final URL res = getResource("/jcrweb.xml");
if (res != null) {
webapp.setDescriptor(res.toString());
}
webapp.setExtractWAR(false);
webapp.setTempDirectory(tmp);
final ServletHolder servlet = new ServletHolder(JackrabbitRepositoryServlet.class);
servlet.setInitOrder(1);
servlet.setInitParameter("repository.home", repository.getAbsolutePath());
final String conf = command.getOptionValue("conf");
if (conf != null) {
servlet.setInitParameter("repository.config", conf);
}
webapp.addServlet(servlet, "/repository.properties");
}
代码示例来源:origin: apache/commons-vfs
private void prepareWebapp(final File file, final File repository, final File tmp) {
webapp.setContextPath("/");
webapp.setWar(file.getPath());
webapp.setClassLoader(JackrabbitMain.class.getClassLoader());
// we use a modified web.xml which has some servlets remove (which produce random empty directories)
final URL res = getResource("/jcrweb.xml");
if (res != null) {
webapp.setDescriptor(res.toString());
}
webapp.setExtractWAR(false);
webapp.setTempDirectory(tmp);
final ServletHolder servlet = new ServletHolder(JackrabbitRepositoryServlet.class);
servlet.setInitOrder(1);
servlet.setInitParameter("repository.home", repository.getAbsolutePath());
final String conf = command.getOptionValue("conf");
if (conf != null) {
servlet.setInitParameter("repository.config", conf);
}
webapp.addServlet(servlet, "/repository.properties");
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
setClassLoader(classLoader);
_ownClassLoader=true;
代码示例来源:origin: org.springframework.osgi/org.springframework.osgi.web
wac.setClassLoader(Utils.createWebAppClassLoader(bundle, Server.class));
代码示例来源:origin: org.springframework.osgi/spring-osgi-web
wac.setClassLoader(Utils.createWebAppClassLoader(bundle, Server.class));
内容来源于网络,如有侵权,请联系作者删除!