320073
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2173 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
3ca0c6806a
commit
30996d5446
|
@ -19,9 +19,6 @@ import javax.naming.Context;
|
|||
import javax.naming.InitialContext;
|
||||
import javax.naming.NameNotFoundException;
|
||||
|
||||
import org.eclipse.jetty.plus.annotation.InjectionCollection;
|
||||
import org.eclipse.jetty.plus.annotation.LifeCycleCallbackCollection;
|
||||
import org.eclipse.jetty.plus.annotation.RunAsCollection;
|
||||
import org.eclipse.jetty.plus.jndi.Transaction;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
@ -40,16 +37,7 @@ public class Configuration implements org.eclipse.jetty.webapp.Configuration
|
|||
public void preConfigure (WebAppContext context)
|
||||
throws Exception
|
||||
{
|
||||
WebAppDecorator decorator = new WebAppDecorator();
|
||||
InjectionCollection injections = new InjectionCollection();
|
||||
context.setAttribute(InjectionCollection.INJECTION_COLLECTION, injections);
|
||||
decorator.setInjections(injections);
|
||||
LifeCycleCallbackCollection callbacks = new LifeCycleCallbackCollection();
|
||||
context.setAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION, callbacks);
|
||||
decorator.setLifecycleCallbacks(callbacks);
|
||||
RunAsCollection runAsCollection = new RunAsCollection();
|
||||
context.setAttribute(RunAsCollection.RUNAS_COLLECTION, runAsCollection);
|
||||
decorator.setRunAses(runAsCollection);
|
||||
WebAppDecorator decorator = new WebAppDecorator(context);
|
||||
context.setDecorator(decorator);
|
||||
}
|
||||
|
||||
|
@ -67,10 +55,6 @@ public class Configuration implements org.eclipse.jetty.webapp.Configuration
|
|||
{
|
||||
//lock this webapp's java:comp namespace as per J2EE spec
|
||||
lockCompEnv(context);
|
||||
context.setAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION, null);
|
||||
context.setAttribute(InjectionCollection.INJECTION_COLLECTION, null);
|
||||
context.setAttribute(RunAsCollection.RUNAS_COLLECTION, null);
|
||||
|
||||
}
|
||||
|
||||
public void deconfigure (WebAppContext context)
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.jetty.plus.annotation.LifeCycleCallback;
|
|||
import org.eclipse.jetty.plus.annotation.LifeCycleCallbackCollection;
|
||||
import org.eclipse.jetty.plus.annotation.PostConstructCallback;
|
||||
import org.eclipse.jetty.plus.annotation.PreDestroyCallback;
|
||||
import org.eclipse.jetty.plus.annotation.RunAsCollection;
|
||||
import org.eclipse.jetty.plus.jndi.EnvEntry;
|
||||
import org.eclipse.jetty.plus.jndi.Link;
|
||||
import org.eclipse.jetty.plus.jndi.NamingEntry;
|
||||
|
@ -69,7 +70,13 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
* @see org.eclipse.jetty.webapp.IterativeDescriptorProcessor#start(WebAppContext, org.eclipse.jetty.webapp.Descriptor)
|
||||
*/
|
||||
public void start(WebAppContext context, Descriptor descriptor)
|
||||
{
|
||||
{
|
||||
InjectionCollection injections = new InjectionCollection();
|
||||
context.setAttribute(InjectionCollection.INJECTION_COLLECTION, injections);
|
||||
LifeCycleCallbackCollection callbacks = new LifeCycleCallbackCollection();
|
||||
context.setAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION, callbacks);
|
||||
RunAsCollection runAsCollection = new RunAsCollection();
|
||||
context.setAttribute(RunAsCollection.RUNAS_COLLECTION, runAsCollection);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,12 +36,11 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
*/
|
||||
public class WebAppDecorator implements Decorator
|
||||
{
|
||||
private InjectionCollection _injections;
|
||||
private LifeCycleCallbackCollection _callbacks;
|
||||
private RunAsCollection _runAses;
|
||||
protected WebAppContext _context;
|
||||
|
||||
public WebAppDecorator ()
|
||||
public WebAppDecorator (WebAppContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -50,52 +49,11 @@ public class WebAppDecorator implements Decorator
|
|||
*/
|
||||
public Decorator cloneFor(ContextHandler context)
|
||||
{
|
||||
// TODO maybe need to check for non-shared classloader???
|
||||
return this;
|
||||
return new WebAppDecorator((WebAppContext)context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public InjectionCollection getInjections()
|
||||
{
|
||||
return _injections;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setInjections(InjectionCollection injections)
|
||||
{
|
||||
_injections = injections;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public LifeCycleCallbackCollection getLifecycleCallbacks()
|
||||
{
|
||||
return _callbacks;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setLifecycleCallbacks(LifeCycleCallbackCollection lifecycleCallbacks)
|
||||
{
|
||||
_callbacks = lifecycleCallbacks;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public RunAsCollection getRunAses()
|
||||
{
|
||||
return _runAses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setRunAses(RunAsCollection runAses)
|
||||
{
|
||||
_runAses = runAses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -179,18 +137,20 @@ public class WebAppDecorator implements Decorator
|
|||
throws ServletException
|
||||
{
|
||||
|
||||
RunAsCollection runAses = (RunAsCollection)_context.getAttribute(RunAsCollection.RUNAS_COLLECTION);
|
||||
if (runAses != null)
|
||||
runAses.setRunAs(o);
|
||||
|
||||
InjectionCollection injections = (InjectionCollection)_context.getAttribute(InjectionCollection.INJECTION_COLLECTION);
|
||||
if (injections != null)
|
||||
injections.inject(o);
|
||||
|
||||
if (_runAses != null)
|
||||
_runAses.setRunAs(o);
|
||||
|
||||
if (_injections != null)
|
||||
_injections.inject(o);
|
||||
|
||||
if (_callbacks != null)
|
||||
LifeCycleCallbackCollection callbacks = (LifeCycleCallbackCollection)_context.getAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION);
|
||||
if (callbacks != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_callbacks.callPostConstructCallback(o);
|
||||
callbacks.callPostConstructCallback(o);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -201,11 +161,12 @@ public class WebAppDecorator implements Decorator
|
|||
|
||||
protected void destroy (Object o)
|
||||
{
|
||||
if (_callbacks != null)
|
||||
LifeCycleCallbackCollection callbacks = (LifeCycleCallbackCollection)_context.getAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION);
|
||||
if (callbacks != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_callbacks.callPreDestroyCallback(o);
|
||||
callbacks.callPreDestroyCallback(o);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MetaData
|
|||
|
||||
public enum Origin {NotSet, WebXml, WebDefaults, WebOverride, WebFragment, Annotation};
|
||||
|
||||
protected Map<String, OriginInfo> _origins = new HashMap<String,OriginInfo>();
|
||||
protected Map<String, OriginInfo> _origins;
|
||||
protected Descriptor _webDefaultsRoot;
|
||||
protected Descriptor _webXmlRoot;
|
||||
protected Descriptor _webOverrideRoot;
|
||||
|
@ -259,6 +259,9 @@ public class MetaData
|
|||
public void resolve (WebAppContext context)
|
||||
throws Exception
|
||||
{
|
||||
//Ensure origins is fresh
|
||||
_origins = new HashMap<String,OriginInfo>();
|
||||
|
||||
// Set the ordered lib attribute
|
||||
List<String> orderedLibs = new ArrayList<String>();
|
||||
for (Resource webInfJar:_orderedWebInfJars)
|
||||
|
|
Loading…
Reference in New Issue