Merge branch 'jetty-9' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project into jetty-9

This commit is contained in:
Joakim Erdfelt 2012-08-15 09:32:32 -07:00
commit ffd86fd21b
32 changed files with 151 additions and 925 deletions

View File

@ -17,6 +17,9 @@ package org.eclipse.jetty.embedded;
import java.lang.management.ManagementFactory;
import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.deploy.providers.ContextProvider;
import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
@ -48,6 +51,16 @@ public class ManyServletContexts
other.addServlet(DefaultServlet.class.getCanonicalName(),"/");
other.addServlet(new ServletHolder(new HelloServlet("YO!")),"*.yo");
DeploymentManager dm = new DeploymentManager();
WebAppProvider wp = new WebAppProvider();
dm.addAppProvider(wp);
ContextProvider cp = new ContextProvider();
dm.addAppProvider(cp);
server.addBean(dm);
server.addBean(wp);
server.addBean(cp);
server.start();
System.err.println(server.dump());
server.join();

View File

@ -1,468 +0,0 @@
// ========================================================================
// Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.deploy;
import java.io.File;
import java.io.FilenameFilter;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jetty.deploy.providers.ContextProvider;
import org.eclipse.jetty.deploy.providers.ScanningAppProvider;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.util.AttributesMap;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.xml.XmlConfiguration;
/**
* Legacy Context Deployer.
*
* <p>
* Note: The WebAppDeployer is being phased out of Jetty in favor of the {@link DeploymentManager} and
* {@link org.eclipse.jetty.deploy.providers.ContextProvider} implementation.
*
* <p>
* This deployer scans a designated directory by {@link #setConfigurationDir(String)} for the appearance/disappearance
* or changes to xml configuration files. The scan is performed at startup and at an optional hot deployment frequency
* specified by {@link #setScanInterval(int)}. By default, the scanning is NOT recursive, but can be made so by
* {@link #setRecursive(boolean)}.
*
* <p>
* Each configuration file is in {@link XmlConfiguration} format and represents the configuration of a instance of
* {@link ContextHandler} (or a subclass specified by the XML <code>Configure</code> element).
*
* <p>
* The xml should configure the context and the instance is deployed to the {@link ContextHandlerCollection} specified
* by {@link Server#setHandler(org.eclipse.jetty.server.Handler)}.
*
* <p>
* Similarly, when one of these existing files is removed, the corresponding context is undeployed; when one of these
* files is changed, the corresponding context is undeployed, the (changed) xml config file reapplied to it, and then
* (re)deployed.
*
* <p>
* Note that the context itself is NOT copied into the hot deploy directory. The webapp directory or war file can exist
* anywhere. It is the xml config file that points to it's location and deploys it from there.
*
* <p>
* It means, for example, that you can keep a "read-only" copy of your webapp somewhere, and apply different
* configurations to it simply by dropping different xml configuration files into the configuration directory.
*
* @see DeploymentManager
* @see ScanningAppProvider
*
* @org.apache.xbean.XBean element="hotDeployer" description="Creates a hot deployer to watch a directory for changes at
* a configurable interval."
* @deprecated replaced with {@link ContextProvider} from the {@link DeploymentManager}
*/
@SuppressWarnings("unchecked")
@Deprecated
public class ContextDeployer extends AbstractLifeCycle
{
private static final Logger LOG = Log.getLogger(ContextDeployer.class);
private int _scanInterval=10;
private Scanner _scanner;
private ScannerListener _scannerListener;
private Resource _contextsDir;
private Map _currentDeployments = new HashMap();
private ContextHandlerCollection _contexts;
private ConfigurationManager _configMgr;
private boolean _recursive = false;
private AttributesMap _contextAttributes = new AttributesMap();
/* ------------------------------------------------------------ */
protected class ScannerListener implements Scanner.DiscreteListener
{
/**
* Handle a new deployment
*
* @see org.eclipse.jetty.util.Scanner.DiscreteListener#fileAdded(java.lang.String)
*/
public void fileAdded(String filename) throws Exception
{
deploy(filename);
}
/**
* Handle a change to an existing deployment. Undeploy then redeploy.
*
* @see org.eclipse.jetty.util.Scanner.DiscreteListener#fileChanged(java.lang.String)
*/
public void fileChanged(String filename) throws Exception
{
redeploy(filename);
}
/**
* Handle an undeploy.
*
* @see org.eclipse.jetty.util.Scanner.DiscreteListener#fileRemoved(java.lang.String)
*/
public void fileRemoved(String filename) throws Exception
{
undeploy(filename);
}
@Override
public String toString()
{
return "ContextDeployer$Scanner";
}
}
/**
* Constructor
*/
public ContextDeployer()
{
LOG.warn("ContextDeployer is deprecated. Use ContextProvider");
_scanner=new Scanner();
}
/* ------------------------------------------------------------ */
/**
* @return the ContextHandlerColletion to which to deploy the contexts
*/
public ContextHandlerCollection getContexts()
{
return _contexts;
}
/* ------------------------------------------------------------ */
/**
* Associate with a {@link ContextHandlerCollection}.
*
* @param contexts
* the ContextHandlerColletion to which to deploy the contexts
*/
public void setContexts(ContextHandlerCollection contexts)
{
if (isStarted()||isStarting())
throw new IllegalStateException("Cannot set Contexts after deployer start");
_contexts=contexts;
}
/* ------------------------------------------------------------ */
/**
* @param seconds
* The period in second between scans for changed configuration
* files. A zero or negative interval disables hot deployment
*/
public void setScanInterval(int seconds)
{
if (isStarted()||isStarting())
throw new IllegalStateException("Cannot change scan interval after deployer start");
_scanInterval=seconds;
}
/* ------------------------------------------------------------ */
public int getScanInterval()
{
return _scanInterval;
}
/* ------------------------------------------------------------ */
/**
* @param dir Directory to scan for context descriptors
*/
public void setContextsDir(String dir)
{
try
{
_contextsDir=Resource.newResource(dir);
}
catch(Exception e)
{
throw new IllegalArgumentException(e);
}
}
/* ------------------------------------------------------------ */
public String getContextsDir()
{
return _contextsDir==null?null:_contextsDir.toString();
}
/* ------------------------------------------------------------ */
/**
* @param dir
* @throws Exception
* @deprecated use {@link #setContextsDir(String)}
*/
@Deprecated
public void setConfigurationDir(String dir) throws Exception
{
setConfigurationDir(Resource.newResource(dir));
}
/* ------------------------------------------------------------ */
/**
* @param file
* @throws Exception
* @deprecated use {@link #setContextsDir(String)}
*/
@Deprecated
public void setConfigurationDir(File file) throws Exception
{
setConfigurationDir(Resource.newResource(Resource.toURL(file)));
}
/* ------------------------------------------------------------ */
/**
* @param resource
* @deprecated use {@link #setContextsDir(String)}
*/
@Deprecated
public void setConfigurationDir(Resource resource)
{
if (isStarted()||isStarting())
throw new IllegalStateException("Cannot change hot deploy dir after deployer start");
_contextsDir=resource;
}
/* ------------------------------------------------------------ */
/**
* @param directory
* @deprecated use {@link #setContextsDir(String)}
*/
@Deprecated
public void setDirectory(String directory) throws Exception
{
setConfigurationDir(directory);
}
/* ------------------------------------------------------------ */
/**
* @return the directory
* @deprecated use {@link #setContextsDir(String)}
*/
@Deprecated
public String getDirectory()
{
return getConfigurationDir().getName();
}
/* ------------------------------------------------------------ */
/**
* @return the configuration directory
* @deprecated use {@link #setContextsDir(String)}
*/
@Deprecated
public Resource getConfigurationDir()
{
return _contextsDir;
}
/* ------------------------------------------------------------ */
/**
* @param configMgr
*/
public void setConfigurationManager(ConfigurationManager configMgr)
{
_configMgr=configMgr;
}
/* ------------------------------------------------------------ */
/**
* @return the configuration manager
*/
public ConfigurationManager getConfigurationManager()
{
return _configMgr;
}
/* ------------------------------------------------------------ */
public void setRecursive (boolean recursive)
{
_recursive=recursive;
}
/* ------------------------------------------------------------ */
public boolean getRecursive ()
{
return _recursive;
}
/* ------------------------------------------------------------ */
public boolean isRecursive()
{
return _recursive;
}
/* ------------------------------------------------------------ */
/**
* Set a contextAttribute that will be set for every Context deployed by this deployer.
* @param name
* @param value
*/
public void setAttribute (String name, Object value)
{
_contextAttributes.setAttribute(name,value);
}
/* ------------------------------------------------------------ */
/**
* Get a contextAttribute that will be set for every Context deployed by this deployer.
* @param name
* @return the attribute value
*/
public Object getAttribute (String name)
{
return _contextAttributes.getAttribute(name);
}
/* ------------------------------------------------------------ */
/**
* Remove a contextAttribute that will be set for every Context deployed by this deployer.
* @param name
*/
public void removeAttribute(String name)
{
_contextAttributes.removeAttribute(name);
}
/* ------------------------------------------------------------ */
private void deploy(String filename) throws Exception
{
ContextHandler context=createContext(filename);
LOG.info("Deploy "+filename+" -> "+ context);
_contexts.addHandler(context);
_currentDeployments.put(filename,context);
if (_contexts.isStarted())
context.start();
}
/* ------------------------------------------------------------ */
private void undeploy(String filename) throws Exception
{
ContextHandler context=(ContextHandler)_currentDeployments.get(filename);
LOG.info("Undeploy "+filename+" -> "+context);
if (context==null)
return;
context.stop();
_contexts.removeHandler(context);
_currentDeployments.remove(filename);
}
/* ------------------------------------------------------------ */
private void redeploy(String filename) throws Exception
{
undeploy(filename);
deploy(filename);
}
/* ------------------------------------------------------------ */
/**
* Start the hot deployer looking for webapps to deploy/undeploy
*
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
*/
@SuppressWarnings("deprecation")
@Override
protected void doStart() throws Exception
{
if (_contextsDir==null)
throw new IllegalStateException("No configuration dir specified");
if (_contexts==null)
throw new IllegalStateException("No context handler collection specified for deployer");
_scanner.setScanDir(_contextsDir.getFile());
_scanner.setScanInterval(getScanInterval());
_scanner.setRecursive(_recursive); //only look in the top level for deployment files?
// Accept changes only in files that could be a deployment descriptor
_scanner.setFilenameFilter(new FilenameFilter()
{
public boolean accept(File dir, String name)
{
try
{
if (name.endsWith(".xml"))
return true;
return false;
}
catch (Exception e)
{
LOG.warn(e);
return false;
}
}
});
_scannerListener=new ScannerListener();
_scanner.addListener(_scannerListener);
_scanner.scan();
_scanner.start();
_contexts.getServer().getContainer().addBean(_scanner);
}
/* ------------------------------------------------------------ */
/**
* Stop the hot deployer.
*
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStop()
*/
@Override
protected void doStop() throws Exception
{
_scanner.removeListener(_scannerListener);
_scanner.stop();
}
/* ------------------------------------------------------------ */
/**
* Create a WebAppContext for the webapp being hot deployed, then apply the
* xml config file to it to configure it.
*
* @param filename
* the config file found in the hot deploy directory
* @return
* @throws Exception
*/
private ContextHandler createContext(String filename) throws Exception
{
// The config file can call any method on WebAppContext to configure
// the webapp being deployed.
Resource resource = Resource.newResource(filename);
if (!resource.exists())
return null;
XmlConfiguration xmlConfiguration=new XmlConfiguration(resource.getURL());
xmlConfiguration.getIdMap().put("Server", _contexts.getServer());
if (_configMgr!=null)
xmlConfiguration.getProperties().putAll(_configMgr.getProperties());
ContextHandler context=(ContextHandler)xmlConfiguration.configure();
// merge attributes
if (_contextAttributes!=null && _contextAttributes.size()>0)
{
AttributesMap attributes = new AttributesMap(_contextAttributes);
attributes.addAll(context.getAttributes());
context.setAttributes(attributes);
}
return context;
}
}

View File

@ -35,6 +35,10 @@ import org.eclipse.jetty.deploy.graph.Path;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.util.AttributesMap;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.annotation.ManagedOperation;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -53,6 +57,7 @@ import org.eclipse.jetty.util.log.Logger;
* <p>
* <img src="doc-files/DeploymentManager.png">
*/
@ManagedObject("Deployment Manager")
public class DeploymentManager extends AggregateLifeCycle
{
private static final Logger LOG = Log.getLogger(DeploymentManager.class);
@ -157,6 +162,7 @@ public class DeploymentManager extends AggregateLifeCycle
addBean(provider);
}
@ManagedAttribute("Application Providers")
public Collection<AppProvider> getAppProviders()
{
return Collections.unmodifiableList(_providers);
@ -279,6 +285,7 @@ public class DeploymentManager extends AggregateLifeCycle
return _apps;
}
@ManagedAttribute("Deployed Apps")
public Collection<App> getApps()
{
List<App> ret = new ArrayList<App>();
@ -357,6 +364,7 @@ public class DeploymentManager extends AggregateLifeCycle
return _contextAttributes;
}
@ManagedAttribute("Deployed Contexts")
public ContextHandlerCollection getContexts()
{
return _contexts;
@ -508,7 +516,8 @@ public class DeploymentManager extends AggregateLifeCycle
* @param nodeName
* the name of the node to attain
*/
public void requestAppGoal(String appId, String nodeName)
@ManagedOperation(value="request the app to be moved to the specified lifecycle node", impact="ACTION")
public void requestAppGoal(@Name("appId") String appId, @Name("nodeName") String nodeName)
{
AppEntry appentry = findAppByOriginId(appId);
if (appentry == null)
@ -581,7 +590,8 @@ public class DeploymentManager extends AggregateLifeCycle
return _lifecycle.getNodes();
}
public Collection<App> getApps(String nodeName)
@ManagedOperation(value="list apps that are located at specified App LifeCycle nodes", impact="ACTION")
public Collection<App> getApps(@Name("nodeName") String nodeName)
{
return getApps(_lifecycle.getNodeByName(nodeName));
}

View File

@ -1,322 +0,0 @@
// ========================================================================
// Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.deploy;
import java.util.ArrayList;
import org.eclipse.jetty.deploy.providers.ScanningAppProvider;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.util.AttributesMap;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* Legacy Web Application Deployer.
*
* <p>
* Note: The WebAppDeployer is being phased out of Jetty in favor of the {@link DeploymentManager} and
* {@link org.eclipse.jetty.deploy.providers.WebAppProvider} implementation.
*
* <p>
* The class searches a directory for and deploys standard web application. At startup, the directory specified by
* {@link #setWebAppDir(String)} is searched for subdirectories (excluding hidden and CVS) or files ending with ".zip"
* or "*.war". For each webapp discovered is passed to a new instance of {@link WebAppContext} (or a subclass specified
* by {@link #getContexts()}. {@link ContextHandlerCollection#getContextClass()}
*
* <p>
* This deployer does not do hot deployment or undeployment. Nor does it support per web application configuration. For
* these features see {@link ContextDeployer}.
*
* @deprecated
* @see DeploymentManager
* @see ScanningAppProvider
* @see ContextDeployer
*/
@SuppressWarnings("unchecked")
public class WebAppDeployer extends AbstractLifeCycle
{
private static final Logger LOG = Log.getLogger(WebAppDeployer.class);
private HandlerCollection _contexts;
private String _webAppDir;
private String _defaultsDescriptor;
private String[] _configurationClasses;
private boolean _extract;
private boolean _parentLoaderPriority;
private boolean _allowDuplicates;
private ArrayList _deployed;
private AttributesMap _contextAttributes = new AttributesMap();
public WebAppDeployer()
{
LOG.warn("WebAppDeployer is deprecated. Use WebAppProvider");
}
public String[] getConfigurationClasses()
{
return _configurationClasses;
}
public void setConfigurationClasses(String[] configurationClasses)
{
_configurationClasses=configurationClasses;
}
public HandlerCollection getContexts()
{
return _contexts;
}
public void setContexts(HandlerCollection contexts)
{
_contexts=contexts;
}
public String getDefaultsDescriptor()
{
return _defaultsDescriptor;
}
public void setDefaultsDescriptor(String defaultsDescriptor)
{
_defaultsDescriptor=defaultsDescriptor;
}
public boolean isExtract()
{
return _extract;
}
public void setExtract(boolean extract)
{
_extract=extract;
}
public boolean isParentLoaderPriority()
{
return _parentLoaderPriority;
}
public void setParentLoaderPriority(boolean parentPriorityClassLoading)
{
_parentLoaderPriority=parentPriorityClassLoading;
}
public String getWebAppDir()
{
return _webAppDir;
}
public void setWebAppDir(String dir)
{
_webAppDir=dir;
}
public boolean getAllowDuplicates()
{
return _allowDuplicates;
}
/* ------------------------------------------------------------ */
/**
* @param allowDuplicates If false, do not deploy webapps that have already been deployed or duplicate context path
*/
public void setAllowDuplicates(boolean allowDuplicates)
{
_allowDuplicates=allowDuplicates;
}
/**
* Set a contextAttribute that will be set for every Context deployed by this deployer.
* @param name
* @param value
*/
public void setAttribute (String name, Object value)
{
_contextAttributes.setAttribute(name,value);
}
/**
* Get a contextAttribute that will be set for every Context deployed by this deployer.
* @param name
* @return the attribute value
*/
public Object getAttribute (String name)
{
return _contextAttributes.getAttribute(name);
}
/**
* Remove a contextAttribute that will be set for every Context deployed by this deployer.
* @param name
*/
public void removeAttribute(String name)
{
_contextAttributes.removeAttribute(name);
}
/* ------------------------------------------------------------ */
/**
* @throws Exception
*/
@Override
public void doStart() throws Exception
{
_deployed=new ArrayList();
scan();
}
/* ------------------------------------------------------------ */
/** Scan for webapplications.
*
* @throws Exception
*/
public void scan() throws Exception
{
if (_contexts==null)
throw new IllegalArgumentException("No HandlerContainer");
Resource r=Resource.newResource(_webAppDir);
if (!r.exists())
throw new IllegalArgumentException("No such webapps resource "+r);
if (!r.isDirectory())
throw new IllegalArgumentException("Not directory webapps resource "+r);
String[] files=r.list();
files: for (int f=0; files!=null&&f<files.length; f++)
{
String context=files[f];
if (context.equalsIgnoreCase("CVS/")||context.equalsIgnoreCase("CVS")||context.startsWith("."))
continue;
Resource app=r.addPath(r.encode(context));
if (context.toLowerCase().endsWith(".war")||context.toLowerCase().endsWith(".jar"))
{
context=context.substring(0,context.length()-4);
Resource unpacked=r.addPath(context);
if (unpacked!=null&&unpacked.exists()&&unpacked.isDirectory())
continue;
}
else if (!app.isDirectory())
continue;
if (context.equalsIgnoreCase("root")||context.equalsIgnoreCase("root/"))
context=URIUtil.SLASH;
else
context="/"+context;
if (context.endsWith("/")&&context.length()>0)
context=context.substring(0,context.length()-1);
// Check the context path has not already been added or the webapp itself is not already deployed
if (!_allowDuplicates)
{
Handler[] installed=_contexts.getChildHandlersByClass(ContextHandler.class);
for (int i=0; i<installed.length; i++)
{
ContextHandler c = (ContextHandler)installed[i];
if (context.equals(c.getContextPath()))
continue files;
try
{
String path = null;
if (c instanceof WebAppContext)
path = Resource.newResource(((WebAppContext)c).getWar()).getFile().getCanonicalPath();
else if (c.getBaseResource() != null)
path = c.getBaseResource().getFile().getCanonicalPath();
if (path != null && path.equals(app.getFile().getCanonicalPath()))
{
LOG.debug("Already deployed: {}",path);
continue files;
}
}
catch (Exception e)
{
LOG.ignore(e);
}
}
}
// create a webapp
WebAppContext wah=null;
if (_contexts instanceof ContextHandlerCollection &&
WebAppContext.class.isAssignableFrom(((ContextHandlerCollection)_contexts).getContextClass()))
{
try
{
wah=(WebAppContext)((ContextHandlerCollection)_contexts).getContextClass().newInstance();
}
catch (Exception e)
{
throw new Error(e);
}
}
else
{
wah=new WebAppContext();
}
// configure it
wah.setContextPath(context);
if (_configurationClasses!=null)
wah.setConfigurationClasses(_configurationClasses);
if (_defaultsDescriptor!=null)
wah.setDefaultsDescriptor(_defaultsDescriptor);
wah.setExtractWAR(_extract);
wah.setWar(app.toString());
wah.setParentLoaderPriority(_parentLoaderPriority);
//set up any contextAttributes
wah.setAttributes(new AttributesMap(_contextAttributes));
// add it
_contexts.addHandler(wah);
_deployed.add(wah);
if (_contexts.isStarted())
wah.start(); // TODO Multi exception
}
}
@Override
public void doStop() throws Exception
{
for (int i=_deployed.size();i-->0;)
{
ContextHandler wac = (ContextHandler)_deployed.get(i);
wac.stop();// TODO Multi exception
}
}
}

View File

@ -19,6 +19,7 @@ import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.ConfigurationManager;
import org.eclipse.jetty.deploy.util.FileID;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.xml.XmlConfiguration;
@ -27,6 +28,7 @@ import org.eclipse.jetty.xml.XmlConfiguration;
* replacement for the old (and deprecated) <code>org.eclipse.jetty.deploy.ContextDeployer</code> and it will scan a directory
* only for context.xml files.
*/
@ManagedObject("Provider for starting webapps originating from context.xml files")
public class ContextProvider extends ScanningAppProvider
{
private ConfigurationManager _configurationManager;

View File

@ -25,6 +25,8 @@ import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.AppProvider;
import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -32,6 +34,7 @@ import org.eclipse.jetty.util.resource.Resource;
/**
*/
@ManagedObject("Abstract Provider for loading webapps")
public abstract class ScanningAppProvider extends AbstractLifeCycle implements AppProvider
{
private static final Logger LOG = Log.getLogger(ScanningAppProvider.class);
@ -196,12 +199,14 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
}
/* ------------------------------------------------------------ */
@ManagedAttribute("scanning interval to detect changes which need reloaded")
public int getScanInterval()
{
return _scanInterval;
}
/* ------------------------------------------------------------ */
@ManagedAttribute("recursive scanning supported")
public boolean isRecursive()
{
return _recursive;

View File

@ -21,6 +21,8 @@ import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.util.FileID;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppContext;
@ -34,6 +36,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
* If the name is in the format root-hostname, then the webapp is deployed
* at / in the virtual host hostname.
*/
@ManagedObject("Provider for start-up deployement of webapps based on presence in directory")
public class WebAppProvider extends ScanningAppProvider
{
private boolean _extractWars = false;
@ -110,6 +113,7 @@ public class WebAppProvider extends ScanningAppProvider
/** Get the extractWars.
* @return the extractWars
*/
@ManagedAttribute("extract war files")
public boolean isExtractWars()
{
return _extractWars;
@ -128,6 +132,7 @@ public class WebAppProvider extends ScanningAppProvider
/** Get the parentLoaderPriority.
* @return the parentLoaderPriority
*/
@ManagedAttribute("parent classloader has priority")
public boolean isParentLoaderPriority()
{
return _parentLoaderPriority;
@ -146,6 +151,7 @@ public class WebAppProvider extends ScanningAppProvider
/** Get the defaultsDescriptor.
* @return the defaultsDescriptor
*/
@ManagedAttribute("default descriptor for webapps")
public String getDefaultsDescriptor()
{
return _defaultsDescriptor;
@ -161,6 +167,7 @@ public class WebAppProvider extends ScanningAppProvider
}
/* ------------------------------------------------------------ */
@ManagedAttribute("directory to scan for context.xml files")
public String getContextXmlDir()
{
return _filter._contexts==null?null:_filter._contexts.toString();
@ -207,6 +214,7 @@ public class WebAppProvider extends ScanningAppProvider
/**
*
*/
@ManagedAttribute("configuration classes for webapps to be processed through")
public String[] getConfigurationClasses()
{
return _configurationClasses;
@ -229,6 +237,7 @@ public class WebAppProvider extends ScanningAppProvider
*
* @return the user supplied work directory (null if user has not set Temp Directory yet)
*/
@ManagedAttribute("temp directory for use, null if no user set temp directory")
public File getTempDir()
{
return _tempDirectory;

View File

@ -1,9 +0,0 @@
ContextDeployer: Deployer for runtime deploy/undeploy of webapps
contexts: MObject: The ContextHandlerCollection to which the deployer deploys
scanInterval: Object: The interval in seconds between scans of the deploy directory
configurationDir: Object:RO: The deploy directory
setConfigurationDir(java.lang.String):ACTION:Set the deploy directory
setConfigurationDir(java.lang.String)[0]:dir:The directory
setConfigurationDir(java.io.File):ACTION:Set the deploy directory
setConfigurationDir(java.io.File)[0]:file:The directory
configurationManager: MObject:Source of property values for property name resolution in deployed config file

View File

@ -1,10 +0,0 @@
DeploymentManager: Deployment Manager
nodes:MBean: App LifeCycle Nodes
apps:MBean: Deployed Apps
contexts:MMBean: Deployed Contexts
appProviders:MMBean: Application Providers
getApps(java.lang.String):MBean:ACTION: List apps that are located at specified App LifeCycle node
getApps(java.lang.String)[0]:nodeName: Name of the App LifeCycle node
requestAppGoal(java.lang.String,java.lang.String):ACTION: Request the app to be moved to the specified App LifeCycle node
requestAppGoal(java.lang.String,java.lang.String)[0]:appId:App identifier
requestAppGoal(java.lang.String,java.lang.String)[1]:nodeName:Name of the App LifeCycle node

View File

@ -1,14 +0,0 @@
WebAppDeployer: Deployer for startup deployment of webapps
contexts: MObject: The ContextHandlerCollection to which the deployer deploys
allowDuplicates: Object:RO: Whether or not duplicate deployments are allowed
setAllowDuplicates(boolean):ACTION: Whether or not duplicate deployments are allowed
setAllowDuplicates(boolean)[0]:allowDuplicates: True allows duplicate webapps to be deployed while false does not
defaultsDescriptor: Object: The webdefault.xml descriptor to use for all webapps deployed by the deployer
configurationClasses: Object: The set of configuration classes to apply to the deployment of each webapp
webAppDir: Object: The directory where the webapps are to be found to deploy
extract: Object:RO: Whether or not to extract war files on deployment
setExtract(boolean):ACTION:Set whether or not to extract war files
setExtract(boolean)[0]:extract: True will extract war files while false will not
parentLoaderPriority: Object:RO: Whether to use j2se classloading order or servlet spec classloading order
setParentLoaderPriority(boolean):ACTION: Set which classloading paradigm to use
setParentLoaderPriority(boolean)[0]:parentPriorityClassLoading: True uses j2se classloading order while false uses servlet spec order

View File

@ -1 +0,0 @@
ContextProvider: Context AppProvider for Deployment manager

View File

@ -1,4 +0,0 @@
ScanningAppProvider: Scanning AppProvider for Deployment manager
monitoredDirName: The directory to monitor for new Apps
scanInterval: The scan interval in seconds
recursive: Look in subdirectories

View File

@ -1,7 +0,0 @@
WebAppProvider: Web application AppProvider for Deployment manager
extractWars: Extract WAR files to temporary directory
parentLoaderPriority: ClassLoaders give priority to classes from parent loader
defaultsDescriptor: The default descriptor applied before any web.xml
contextXmlDir: The directory of context.xml files
configurationClasses: The configuration classes to apply
tempDir: The temporary directory to use

View File

@ -0,0 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
org.eclipse.jetty.deploy.LEVEL=WARN

View File

@ -43,7 +43,6 @@ import javax.management.MBeanParameterInfo;
import javax.management.ObjectName;
import javax.management.ReflectionException;
import javax.management.modelmbean.ModelMBean;
import javax.xml.crypto.dsig.keyinfo.RetrievalMethod;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.TypeUtil;
@ -117,15 +116,12 @@ public class ObjectMBean implements DynamicMBean
Class<?> oClass = o.getClass();
Object mbean = null;
while (mbean == null && oClass != null)
while ( mbean == null && oClass != null )
{
ManagedObject mo = oClass.getAnnotation(ManagedObject.class);
String mName = "";
if ( mo != null )
{
mName = mo.wrapper();
}
String pName = oClass.getPackage().getName();
String cName = oClass.getName().substring(pName.length() + 1);
String mName = pName + ".jmx." + cName + "MBean";
try
{
Class<?> mClass = (Object.class.equals(oClass))?oClass=ObjectMBean.class:Loader.loadClass(oClass,mName,true);
@ -180,6 +176,7 @@ public class ObjectMBean implements DynamicMBean
{
LOG.ignore(e);
}
return null;
}
@ -238,7 +235,7 @@ public class ObjectMBean implements DynamicMBean
Class<?> o_class=_managed.getClass();
List<Class<?>> influences = findInfluences(new ArrayList<Class<?>>(), _managed.getClass());
LOG.debug("Influence Count: " + influences.size() );
LOG.debug("Influence Count: {}", influences.size() );
// Process Type Annotations
ManagedObject primary = o_class.getAnnotation( ManagedObject.class);
@ -258,12 +255,12 @@ public class ObjectMBean implements DynamicMBean
{
Class<?> oClass = influences.get(i);
ManagedObject typeAnnotation = oClass.getAnnotation( ManagedObject.class);
ManagedObject typeAnnotation = oClass.getAnnotation( ManagedObject.class );
LOG.debug("Influenced by: " + oClass.getCanonicalName() );
if ( typeAnnotation == null )
{
LOG.debug("Annotations not found for: " + oClass.getCanonicalName() );
LOG.debug("Annotations not found for: {}", oClass.getCanonicalName() );
continue;
}
@ -276,7 +273,7 @@ public class ObjectMBean implements DynamicMBean
if (methodAttributeAnnotation != null)
{
// TODO sort out how a proper name could get here, its a method name as an attribute at this point.
LOG.debug("Attribute Annotation found for: " + method.getName());
LOG.debug("Attribute Annotation found for: {}", method.getName());
MBeanAttributeInfo mai = defineAttribute(method,methodAttributeAnnotation);
if ( mai != null )
{
@ -288,7 +285,7 @@ public class ObjectMBean implements DynamicMBean
if (methodOperationAnnotation != null)
{
LOG.debug("Method Annotation found for: " + method.getName());
LOG.debug("Method Annotation found for: {}", method.getName());
MBeanOperationInfo oi = defineOperation(method,methodOperationAnnotation);
if (oi != null)
@ -335,34 +332,51 @@ public class ObjectMBean implements DynamicMBean
// get the attribute
Object r=getter.invoke(o, (java.lang.Object[]) null);
// convert to ObjectName if need be.
if (r!=null && _convert.contains(name))
{
// convert to ObjectName if the type has the @ManagedObject annotation
if (r!=null )
{
if (r.getClass().isArray())
{
ObjectName[] on = new ObjectName[Array.getLength(r)];
for (int i=0;i<on.length;i++)
on[i]=_mbeanContainer.findMBean(Array.get(r, i));
r=on;
if (r.getClass().getComponentType().isAnnotationPresent(ManagedObject.class))
{
ObjectName[] on = new ObjectName[Array.getLength(r)];
for (int i = 0; i < on.length; i++)
{
on[i] = _mbeanContainer.findMBean(Array.get(r,i));
}
r = on;
}
}
else if (r instanceof Collection<?>)
{
@SuppressWarnings("unchecked")
Collection<Object> c = (Collection<Object>)r;
ObjectName[] on = new ObjectName[c.size()];
int i=0;
for (Object obj :c)
on[i++]=_mbeanContainer.findMBean(obj);
r=on;
if (!c.isEmpty() && c.iterator().next().getClass().isAnnotationPresent(ManagedObject.class))
{
// check the first thing out
ObjectName[] on = new ObjectName[c.size()];
int i = 0;
for (Object obj : c)
{
on[i++] = _mbeanContainer.findMBean(obj);
}
r = on;
}
}
else
{
ObjectName mbean = _mbeanContainer.findMBean(r);
if (mbean==null)
return null;
r=mbean;
if ( r.getClass().isAnnotationPresent(ManagedObject.class))
{
ObjectName mbean = _mbeanContainer.findMBean(r);
if (mbean == null)
return null;
r = mbean;
}
}
}
return r;
@ -525,24 +539,19 @@ public class ObjectMBean implements DynamicMBean
// This class is an influence
influences.add(aClass);
// check for mbean influence
ManagedObject mo = aClass.getAnnotation(ManagedObject.class);
String pName = aClass.getPackage().getName();
String cName = aClass.getName().substring(pName.length() + 1);
String mName = pName + ".jmx." + cName + "MBean";
if ( mo != null && !"".equals(mo.wrapper()))
try
{
String clazz = mo.wrapper();
try
{
Class<?> mbean = Class.forName(clazz);
LOG.debug("MBean Influence found for " + aClass.getSimpleName() );
influences.add(mbean);
}
catch ( ClassNotFoundException cnfe )
{
LOG.debug("No MBean Influence for " + aClass.getSimpleName() );
}
Class<?> mbeanClazz = Class.forName(mName);
LOG.debug("MBean Influence found for " + aClass.getSimpleName());
influences.add(mbeanClazz);
}
catch (ClassNotFoundException cnfe)
{
LOG.debug("No MBean Influence for " + aClass.getSimpleName());
}
// So are the super classes
@ -625,7 +634,7 @@ public class ObjectMBean implements DynamicMBean
{
String declaredSetter = attributeAnnotation.setter();
LOG.debug("DeclaredSetter:" + declaredSetter);
LOG.debug("DeclaredSetter: {}", declaredSetter);
Method[] methods = oClass.getMethods();
for (int m = 0; m < methods.length; m++)
{
@ -640,13 +649,13 @@ public class ObjectMBean implements DynamicMBean
{
if (setter != null)
{
LOG.warn("Multiple setters for mbean attr " + name + " in " + oClass);
LOG.warn("Multiple setters for mbean attr {} in {}", name, oClass);
continue;
}
setter = methods[m];
if ( !type.equals(methods[m].getParameterTypes()[0]))
{
LOG.warn("Type conflict for mbean attr " + name + " in " + oClass);
LOG.warn("Type conflict for mbean attr {} in {}", name, oClass);
continue;
}
LOG.debug("Declared Setter: " + declaredSetter);
@ -658,13 +667,13 @@ public class ObjectMBean implements DynamicMBean
{
if (setter != null)
{
LOG.warn("Multiple setters for mbean attr " + name + " in " + oClass);
LOG.warn("Multiple setters for mbean attr {} in {}", name, oClass);
continue;
}
setter = methods[m];
if ( !type.equals(methods[m].getParameterTypes()[0]))
{
LOG.warn("Type conflict for mbean attr " + name + " in " + oClass);
LOG.warn("Type conflict for mbean attr {} in {}", name, oClass);
continue;
}
}
@ -751,6 +760,7 @@ public class ObjectMBean implements DynamicMBean
if ( returnType.isArray() )
{
LOG.debug("returnType is array, get component type");
returnType = returnType.getComponentType();
}
@ -758,11 +768,11 @@ public class ObjectMBean implements DynamicMBean
{
convert = true;
}
String impactName = methodAnnotation.impact();
LOG.debug("defineOperation "+method.getName()+" "+onMBean+":"+impactName+":"+description);
LOG.debug("defineOperation {} {}:{}:{}", method.getName(), onMBean, impactName, description);
String signature = method.getName();
@ -833,8 +843,7 @@ public class ObjectMBean implements DynamicMBean
throw new IllegalArgumentException(e.toString());
}
}
}
protected String toVariableName( String methodName )
{

View File

@ -18,7 +18,7 @@ import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.annotation.ManagedOperation;
import org.eclipse.jetty.util.annotation.Name;
@ManagedObject(value="Test the mbean stuff", wrapper="com.acme.jmx.DerivedMBean")
@ManagedObject(value="Test the mbean stuff")
public class Derived extends Base implements Signature
{
String fname="Full Name";

View File

@ -3,7 +3,7 @@ package com.acme;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
@ManagedObject(value="Managed Object", wrapper="com.acme.jmx.ManagedMBean")
@ManagedObject(value="Managed Object")
public class Managed
{
String managed = "foo";

View File

@ -52,7 +52,7 @@ import org.eclipse.jetty.util.thread.ThreadPool;
* The server is itself a handler and a ThreadPool. Connectors use the ThreadPool methods
* to run jobs that will eventually call the handle method.
*/
@ManagedObject(value="Jetty HTTP Servlet server", wrapper="org.eclipse.jetty.server.ServerMBean")
@ManagedObject(value="Jetty HTTP Servlet server")
public class Server extends HandlerWrapper implements Attributes
{
private static final Logger LOG = Log.getLogger(Server.class);

View File

@ -21,10 +21,12 @@ import javax.servlet.DispatcherType;
import org.eclipse.jetty.http.PathMap;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
@ManagedObject("Filter Mappings")
public class FilterMapping implements Dumpable
{
/** Dispatch types */
@ -126,6 +128,7 @@ public class FilterMapping implements Dumpable
/**
* @return Returns the filterName.
*/
@ManagedAttribute(value="filter name", readonly=true)
public String getFilterName()
{
return _filterName;
@ -144,6 +147,7 @@ public class FilterMapping implements Dumpable
/**
* @return Returns the pathSpec.
*/
@ManagedAttribute(value="url patterns", readonly=true)
public String[] getPathSpecs()
{
return _pathSpecs;
@ -223,6 +227,7 @@ public class FilterMapping implements Dumpable
/**
* @return Returns the servletName.
*/
@ManagedAttribute(value="servlet names", readonly=true)
public String[] getServletNames()
{
return _servletNames;

View File

@ -27,6 +27,8 @@ import javax.servlet.UnavailableException;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
@ -38,6 +40,7 @@ import org.eclipse.jetty.util.log.Logger;
/**
*
*/
@ManagedObject("Holder - a container for servlets and the like")
public class Holder<T> extends AbstractLifeCycle implements Dumpable
{
public enum Source { EMBEDDED, JAVAX_API, DESCRIPTOR, ANNOTATION };
@ -111,6 +114,7 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
}
/* ------------------------------------------------------------ */
@ManagedAttribute(value="Class Name", readonly=true)
public String getClassName()
{
return _className;
@ -123,6 +127,7 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
}
/* ------------------------------------------------------------ */
@ManagedAttribute(value="Display Name", readonly=true)
public String getDisplayName()
{
return _displayName;
@ -145,12 +150,14 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
}
/* ---------------------------------------------------------------- */
@ManagedAttribute(value="Initial Parameters", readonly=true)
public Map<String,String> getInitParameters()
{
return _initParams;
}
/* ------------------------------------------------------------ */
@ManagedAttribute(value="Name", readonly=true)
public String getName()
{
return _name;

View File

@ -53,6 +53,8 @@ import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
/* ------------------------------------------------------------ */
@ -66,6 +68,7 @@ import org.eclipse.jetty.server.session.SessionHandler;
* This class should have been called ServletContext, but this would have
* cause confusion with {@link ServletContext}.
*/
@ManagedObject("Servlet Context Handler")
public class ServletContextHandler extends ContextHandler
{
public final static int SESSIONS=1;
@ -262,6 +265,7 @@ public class ServletContextHandler extends ContextHandler
/**
* @return Returns the securityHandler.
*/
@ManagedAttribute(value="context security handler", readonly=true)
public SecurityHandler getSecurityHandler()
{
if (_securityHandler==null && (_options&SECURITY)!=0 && !isStarted())
@ -274,6 +278,7 @@ public class ServletContextHandler extends ContextHandler
/**
* @return Returns the servletHandler.
*/
@ManagedAttribute(value="context servlet handler", readonly=true)
public ServletHandler getServletHandler()
{
if (_servletHandler==null && !isStarted())
@ -285,6 +290,7 @@ public class ServletContextHandler extends ContextHandler
/**
* @return Returns the sessionHandler.
*/
@ManagedAttribute(value="context session handler", readonly=true)
public SessionHandler getSessionHandler()
{
if (_sessionHandler==null && (_options&SESSIONS)!=0 && !isStarted())

View File

@ -62,6 +62,8 @@ import org.eclipse.jetty.util.MultiException;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -77,6 +79,7 @@ import org.eclipse.jetty.util.log.Logger;
* Unless run as part of a {@link ServletContextHandler} or derivative, the {@link #initialize()}
* method must be called manually after start().
*/
@ManagedObject("Servlet Handler")
public class ServletHandler extends ScopedHandler
{
private static final Logger LOG = Log.getLogger(ServletHandler.class);
@ -230,6 +233,7 @@ public class ServletHandler extends ScopedHandler
/**
* @return Returns the filterMappings.
*/
@ManagedAttribute(value="filters", readonly=true)
public FilterMapping[] getFilterMappings()
{
return _filterMappings;
@ -239,6 +243,7 @@ public class ServletHandler extends ScopedHandler
/** Get Filters.
* @return Array of defined servlets
*/
@ManagedAttribute(value="filters", readonly=true)
public FilterHolder[] getFilters()
{
return _filters;
@ -266,6 +271,7 @@ public class ServletHandler extends ScopedHandler
/**
* @return Returns the servletMappings.
*/
@ManagedAttribute(value="mappings of servlets", readonly=true)
public ServletMapping[] getServletMappings()
{
return _servletMappings;
@ -300,6 +306,7 @@ public class ServletHandler extends ScopedHandler
/** Get Servlets.
* @return Array of defined servlets
*/
@ManagedAttribute(value="servlets", readonly=true)
public ServletHolder[] getServlets()
{
return _servlets;

View File

@ -43,6 +43,8 @@ import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -58,6 +60,7 @@ import org.eclipse.jetty.util.log.Logger;
*
*
*/
@ManagedObject("Servlet Holder")
public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope, Comparable
{
private static final Logger LOG = Log.getLogger(ServletHolder.class);
@ -157,6 +160,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
}
/* ------------------------------------------------------------ */
@ManagedAttribute(value="initialization order", readonly=true)
public int getInitOrder()
{
return _initOrder;
@ -254,6 +258,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
/**
* @return Returns the forcedPath.
*/
@ManagedAttribute(value="forced servlet path", readonly=true)
public String getForcedPath()
{
return _forcedPath;
@ -585,6 +590,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
}
/* ------------------------------------------------------------ */
@ManagedAttribute(value="role to run servlet as", readonly=true)
public String getRunAsRole()
{
return _runAsRole;

View File

@ -16,7 +16,10 @@ package org.eclipse.jetty.servlet;
import java.io.IOException;
import java.util.Arrays;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
@ManagedObject("Servlet Mapping")
public class ServletMapping
{
private String[] _pathSpecs;
@ -33,6 +36,7 @@ public class ServletMapping
/**
* @return Returns the pathSpecs.
*/
@ManagedAttribute(value="url patterns", readonly=true)
public String[] getPathSpecs()
{
return _pathSpecs;
@ -42,6 +46,7 @@ public class ServletMapping
/**
* @return Returns the servletName.
*/
@ManagedAttribute(value="servlet name", readonly=true)
public String getServletName()
{
return _servletName;
@ -79,6 +84,7 @@ public class ServletMapping
/**
* @return
*/
@ManagedAttribute(value="default", readonly=true)
public boolean isDefault()
{
return _default;

View File

@ -1,4 +0,0 @@
FilterMapping: Filter Mapping
filterName: RO:Filter Name
pathSpecs: RO:URL patterns
servletNames: RO:Servlet Names

View File

@ -1,5 +0,0 @@
Holder: Holder
name: RO:Name
displayName: RO:Display Name
className: RO:Class Name
initParameters: RO:Initial parameters

View File

@ -1,4 +0,0 @@
ServletContextHandler: Servlet Context Handler
securityHandler: MObject: The context's security handler
servletHandler: MObject: The context's servlet handler
sessionHandler: MObject: The context's session handler

View File

@ -1,5 +0,0 @@
ServletHandler: Servlet Handler
servlets: MObject:RO:Servlets
servletMappings: MObject:RO:Mappings of servlets
filters: MObject:RO:Filters
filterMappings: MObject:RO:Mappings of filters

View File

@ -1,4 +0,0 @@
ServletHolder: Servlet Holder
initOrder: Initialization order
runAsRole: Role to run servlet as
forcedPath: Forced servlet path

View File

@ -1,3 +0,0 @@
ServletMapping: Servlet Mapping
servletName: RO:Servlet Name
pathSpecs: RO:URL patterns

View File

@ -29,6 +29,4 @@ public @interface ManagedObject
* @return
*/
String value() default "Not Specified";
String wrapper() default "";
}

View File

@ -28,7 +28,7 @@ public @interface ManagedOperation
*
* @return
*/
String value() default "Not Specified";
String value() default "Not Specified";
/**
* The impact of an operation.