public class HttpServer extends Object implements FilterContainer
限定符和类型 | 类和说明 |
---|---|
static class |
HttpServer.QuotingInputFilter
A Servlet input filter that quotes all HTML active characters in the
parameter names and values.
|
static class |
HttpServer.StackServlet
A very simple servlet to serve up a text representation of the current
stack traces.
|
限定符和类型 | 字段和说明 |
---|---|
static String |
CONF_CONTEXT_ATTRIBUTE |
protected Map<org.mortbay.jetty.servlet.Context,Boolean> |
defaultContexts |
protected List<String> |
filterNames |
protected boolean |
findPort |
static String |
KRB5_FILTER |
protected org.mortbay.jetty.Connector |
listener |
static org.apache.commons.logging.Log |
LOG |
static String |
SPNEGO_FILTER |
protected org.mortbay.jetty.webapp.WebAppContext |
webAppContext |
protected org.mortbay.jetty.Server |
webServer |
构造器和说明 |
---|
HttpServer(String name,
String bindAddress,
int port,
boolean findPort)
Same as this(name, bindAddress, port, findPort, null);
|
HttpServer(String name,
String bindAddress,
int port,
boolean findPort,
Configuration conf) |
HttpServer(String name,
String bindAddress,
int port,
boolean findPort,
Configuration conf,
AccessControlList adminsAcl)
Create a status server on the given port.
|
HttpServer(String name,
String bindAddress,
int port,
boolean findPort,
Configuration conf,
AccessControlList adminsAcl,
org.mortbay.jetty.Connector connector) |
HttpServer(String name,
String bindAddress,
int port,
boolean findPort,
Configuration conf,
org.mortbay.jetty.Connector connector) |
限定符和类型 | 方法和说明 |
---|---|
void |
addContext(org.mortbay.jetty.servlet.Context ctxt,
boolean isFiltered) |
protected void |
addContext(String pathSpec,
String dir,
boolean isFiltered)
Add a context
|
protected void |
addDefaultApps(org.mortbay.jetty.handler.ContextHandlerCollection parent,
String appDir)
Add default apps.
|
protected void |
addDefaultServlets()
Add default servlets.
|
void |
addFilter(String name,
String classname,
Map<String,String> parameters)
Add a filter to the container.
|
protected void |
addFilterPathMapping(String pathSpec,
org.mortbay.jetty.servlet.Context webAppCtx)
Add the path spec to the filter path mapping.
|
void |
addGlobalFilter(String name,
String classname,
Map<String,String> parameters)
Add a global filter to the container.
|
void |
addInternalServlet(String name,
String pathSpec,
Class<? extends javax.servlet.http.HttpServlet> clazz)
已过时。
this is a temporary method
|
void |
addInternalServlet(String name,
String pathSpec,
Class<? extends javax.servlet.http.HttpServlet> clazz,
boolean requireAuth,
boolean useKsslForAuth)
Add an internal servlet in the server, specifying whether or not to
protect with Kerberos authentication.
|
void |
addJerseyResourcePackage(String packageName,
String pathSpec)
Add a Jersey resource package.
|
void |
addServlet(String name,
String pathSpec,
Class<? extends javax.servlet.http.HttpServlet> clazz)
Add a servlet in the server.
|
void |
addSslListener(InetSocketAddress addr,
Configuration sslConf,
boolean needClientAuth)
Configure an ssl listener on the server.
|
void |
addSslListener(InetSocketAddress addr,
Configuration sslConf,
boolean needCertsAuth,
boolean needKrbAuth)
Configure an ssl listener on the server.
|
void |
addSslListener(InetSocketAddress addr,
String keystore,
String storPass,
String keyPass)
|
org.mortbay.jetty.Connector |
createBaseListener(Configuration conf)
Create a required listener for the Jetty instance listening on the port
provided.
|
static org.mortbay.jetty.Connector |
createDefaultChannelConnector() |
protected void |
defineFilter(org.mortbay.jetty.servlet.Context ctx,
String name,
String classname,
Map<String,String> parameters,
String[] urls)
Define a filter for a context and set up default url mappings.
|
Object |
getAttribute(String name)
Get the value in the webapp context.
|
int |
getPort()
Get the port that the server is on
|
protected String |
getWebAppsPath()
Get the pathname to the webapps files.
|
static boolean |
hasAdministratorAccess(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Does the user sending the HttpServletRequest has the administrator ACLs?
|
static boolean |
isInstrumentationAccessAllowed(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Checks the user has privileges to access to instrumentation servlets.
|
void |
join() |
void |
setAttribute(org.mortbay.jetty.servlet.Context context,
String name,
Object value)
Set a value in the webapp context.
|
void |
setAttribute(String name,
Object value)
Set a value in the webapp context.
|
void |
setThreads(int min,
int max)
Set the min, max number of worker threads (simultaneous connections).
|
void |
start()
Start the server.
|
void |
stop()
stop the server
|
public static final org.apache.commons.logging.Log LOG
protected final org.mortbay.jetty.Server webServer
protected final org.mortbay.jetty.Connector listener
protected final org.mortbay.jetty.webapp.WebAppContext webAppContext
protected final boolean findPort
public HttpServer(String name, String bindAddress, int port, boolean findPort) throws IOException
IOException
public HttpServer(String name, String bindAddress, int port, boolean findPort, Configuration conf) throws IOException
IOException
public HttpServer(String name, String bindAddress, int port, boolean findPort, Configuration conf, org.mortbay.jetty.Connector connector) throws IOException
IOException
public HttpServer(String name, String bindAddress, int port, boolean findPort, Configuration conf, AccessControlList adminsAcl) throws IOException
name
- The name of the serverport
- The port to use on the serverfindPort
- whether the server should start at the given port and
increment by 1 until it finds a free port.conf
- ConfigurationadminsAcl
- AccessControlList
of the adminsIOException
public HttpServer(String name, String bindAddress, int port, boolean findPort, Configuration conf, AccessControlList adminsAcl, org.mortbay.jetty.Connector connector) throws IOException
IOException
public org.mortbay.jetty.Connector createBaseListener(Configuration conf) throws IOException
IOException
public static org.mortbay.jetty.Connector createDefaultChannelConnector()
protected void addDefaultApps(org.mortbay.jetty.handler.ContextHandlerCollection parent, String appDir) throws IOException
appDir
- The application directoryIOException
protected void addDefaultServlets()
public void addContext(org.mortbay.jetty.servlet.Context ctxt, boolean isFiltered) throws IOException
IOException
protected void addContext(String pathSpec, String dir, boolean isFiltered) throws IOException
pathSpec
- The path spec for the contextdir
- The directory containing the contextisFiltered
- if true, the servlet is added to the filter path mappingIOException
public void setAttribute(String name, Object value)
name
- The name of the attributevalue
- The value of the attributepublic void setAttribute(org.mortbay.jetty.servlet.Context context, String name, Object value)
context
- Context to add attributename
- The name of the attributevalue
- The value of the attributepublic void addJerseyResourcePackage(String packageName, String pathSpec)
packageName
- The Java package name containing the Jersey resource.pathSpec
- The path spec for the servletpublic void addServlet(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz)
name
- The name of the servlet (can be passed as null)pathSpec
- The path spec for the servletclazz
- The servlet class@Deprecated public void addInternalServlet(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz)
name
- The name of the servlet (can be passed as null)pathSpec
- The path spec for the servletclazz
- The servlet classpublic void addInternalServlet(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz, boolean requireAuth, boolean useKsslForAuth)
name
- The name of the servlet (can be passed as null)pathSpec
- The path spec for the servletclazz
- The servlet classrequireAuth
- Require Kerberos authenticate to access servletuseKsslForAuth
- true to use KSSL for auth, false to use SPNEGOpublic void addFilter(String name, String classname, Map<String,String> parameters)
addFilter
在接口中 FilterContainer
name
- Filter nameclassname
- Filter class nameparameters
- a map from parameter names to initial valuespublic void addGlobalFilter(String name, String classname, Map<String,String> parameters)
addGlobalFilter
在接口中 FilterContainer
name
- filter nameclassname
- filter class nameparameters
- a map from parameter names to initial valuesprotected void defineFilter(org.mortbay.jetty.servlet.Context ctx, String name, String classname, Map<String,String> parameters, String[] urls)
protected void addFilterPathMapping(String pathSpec, org.mortbay.jetty.servlet.Context webAppCtx)
pathSpec
- The path specwebAppCtx
- The WebApplicationContext to add topublic Object getAttribute(String name)
name
- The name of the attributeprotected String getWebAppsPath() throws IOException
IOException
- if 'webapps' directory cannot be found on CLASSPATH.public int getPort()
public void setThreads(int min, int max)
@Deprecated public void addSslListener(InetSocketAddress addr, String keystore, String storPass, String keyPass) throws IOException
addr
- address to listen onkeystore
- location of the keystorestorPass
- password for the keystorekeyPass
- password for the keyIOException
public void addSslListener(InetSocketAddress addr, Configuration sslConf, boolean needClientAuth) throws IOException
addr
- address to listen onsslConf
- conf to retrieve ssl optionsneedClientAuth
- whether client authentication is requiredIOException
public void addSslListener(InetSocketAddress addr, Configuration sslConf, boolean needCertsAuth, boolean needKrbAuth) throws IOException
addr
- address to listen onsslConf
- conf to retrieve ssl optionsneedCertsAuth
- whether x509 certificate authentication is requiredneedKrbAuth
- whether to allow kerberos authIOException
public void start() throws IOException
IOException
public void join() throws InterruptedException
public static boolean isInstrumentationAccessAllowed(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
hadoop.security.instrumentation.requires.admin
is set to
FALSE (default value) it returns always returns TRUE.
If hadoop.security.instrumentation.requires.admin
is set to
TRUE it will check that if the current user is in the admin ACLS. If the
user is in the admin ACLs it returns TRUE, otherwise it returns FALSE.servletContext
- the servlet context.request
- the servlet request.response
- the servlet response.IOException
public static boolean hasAdministratorAccess(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
servletContext
- request
- response
- IOException
Copyright © 2009 The Apache Software Foundation