Package org.apache.hadoop.hbase.http
Class HttpServer
java.lang.Object
org.apache.hadoop.hbase.http.HttpServer
- All Implemented Interfaces:
FilterContainer
Create a Jetty embedded server to answer http requests. The primary goal is to serve up status
information for the server. There are three contexts: "/logs/" -> points to the log directory
"/static/" -> points to common static files (src/webapps/static) "/" -> the jsp server code
from (src/webapps/<name>)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class to construct instances of HTTP server with specific options.private static final class
static class
A Servlet input filter that quotes all HTML active characters in the parameter names and values.static class
A very simple servlet to serve up a text representation of the current stack traces. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
private final org.apache.hadoop.security.authorize.AccessControlList
static final String
protected String
protected final boolean
static final String
static final String
private static final long
private static final int
protected final Map<org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler,
Boolean> private static final String
(package private) static final String
protected final boolean
(package private) static final String
static final String
(package private) static final String
private static final String
(package private) static final String
static final boolean
static final String
static final String
static final String
static final String
(package private) static final String
static final String
(package private) static final String
(package private) static final String
static final String
(package private) static final String
static final boolean
static final String
(package private) static final String
static final String
static final String
static final String
private final List<HttpServer.ListenerInfo>
private static final org.slf4j.Logger
protected String
private static final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<String,
ServletConfig> static final String
static final String[]
static final String
static final String
static final String
(package private) static final String
(package private) static final String
protected final org.apache.hbase.thirdparty.org.eclipse.jetty.webapp.WebAppContext
protected final org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server
-
Constructor Summary
ModifierConstructorDescriptionHttpServer
(String name, String bindAddress, int port, boolean findPort) Deprecated.Since 0.99.0HttpServer
(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf) Deprecated.Since 0.99.0HttpServer
(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf, String[] pathSpecs) Deprecated.Since 0.99.0HttpServer
(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl) Deprecated.Since 0.99.0HttpServer
(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl, String[] pathSpecs) Deprecated.Since 0.99.0private
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDefaultApps
(org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.ContextHandlerCollection parent, String appDir, org.apache.hadoop.conf.Configuration conf) Add default apps.protected void
addDefaultServlets
(org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.ContextHandlerCollection contexts, org.apache.hadoop.conf.Configuration conf) Add default servlets.void
Add a filter to the container.protected void
addFilterPathMapping
(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.webapp.WebAppContext webAppCtx) Add the path spec to the filter path mapping.void
Add a global filter to the container - This global filter will be applied to all available web contexts.(package private) void
addInternalServlet
(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz, boolean requireAuthz) Add an internal servlet in the server, specifying whether or not to protect with Kerberos authentication.(package private) void
addInternalServlet
(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder, boolean requireAuthz) 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.private void
addManagedListener
(org.apache.hbase.thirdparty.org.eclipse.jetty.server.ServerConnector connector) private org.apache.hbase.thirdparty.org.eclipse.jetty.util.MultiException
addMultiException
(org.apache.hbase.thirdparty.org.eclipse.jetty.util.MultiException exception, Exception e) private static void
addNoCacheFilter
(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler ctxt, org.apache.hadoop.conf.Configuration conf) void
addPrivilegedServlet
(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz) Adds a servlet in the server that only administrators can access.void
addPrivilegedServlet
(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder) Adds a servlet in the server that only administrators can access.(package private) void
addServletWithAuth
(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz, boolean requireAuthz) Internal method to add a servlet to the HTTP server.(package private) void
addServletWithAuth
(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder, boolean requireAuthz) Internal method to add a servlet to the HTTP server.void
addUnprivilegedServlet
(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz) Adds a servlet in the server that any user can access.void
addUnprivilegedServlet
(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder) Adds a servlet in the server that any user can access.static org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.gzip.GzipHandler
buildGzipHandler
(org.apache.hbase.thirdparty.org.eclipse.jetty.server.Handler wrapped) Construct and configure an instance ofGzipHandler
.private void
configureAliasChecks
(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler context, boolean shouldServeAlias) This method configures the alias checks for the given ServletContextHandler based on the provided value of shouldServeAlias.
If shouldServeAlias is set to true, it checks if SymlinkAllowedResourceAliasChecker is already a part of the alias check list.private static org.apache.hbase.thirdparty.org.eclipse.jetty.webapp.WebAppContext
createWebAppContext
(String name, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl, String appDir) static void
defineFilter
(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler handler, String name, String classname, Map<String, String> parameters, String[] urls) Define a filter for a context and set up default url mappings.getAttribute
(String name) Get the value in the webapp context.getConnectorAddress
(int index) Get the address that corresponds to a particular connector.private static FilterInitializer[]
getFilterInitializers
(org.apache.hadoop.conf.Configuration conf) Get an array of FilterConfiguration specified in the confprivate String
getOrEmptyString
(org.apache.hadoop.conf.Configuration conf, String key) Extracts the value for the given key from the configuration of returns a string of zero length.int
getPort()
Deprecated.Since 0.99.0List<org.apache.hbase.thirdparty.org.eclipse.jetty.server.ServerConnector>
org.apache.hbase.thirdparty.org.eclipse.jetty.webapp.WebAppContext
getWebAppsPath
(String appName) protected String
getWebAppsPath
(String webapps, String appName) 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? If it isn't the case, response will be modified to send an error to the user.static boolean
hasAdministratorAccess
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList acl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) private void
initializeWebServer
(String name, String hostName, org.apache.hadoop.conf.Configuration conf, String[] pathSpecs, HttpServer.Builder b) private void
initSpnego
(org.apache.hadoop.conf.Configuration conf, String hostName, String usernameConfKey, String keytabConfKey, String kerberosNameRuleKey, String signatureSecretKeyFileKey) boolean
isAlive()
Test for the availability of the web serverstatic 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.private boolean
Returns true if the argument is non-null and not whitespacevoid
join()
private void
(package private) void
Open the main listener for the servervoid
setAttribute
(String name, Object value) Set a value in the webapp context.private void
setContextAttributes
(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler context, org.apache.hadoop.conf.Configuration conf) 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 servertoString()
Return the host and port of the HttpServer, if livestatic boolean
userHasAdministratorAccess
(javax.servlet.ServletContext servletContext, String remoteUser) Get the admin ACLs from the given ServletContext and check if the given user is in the ACL.static boolean
userHasAdministratorAccess
(org.apache.hadoop.security.authorize.AccessControlList acl, String remoteUser)
-
Field Details
-
LOG
-
EMPTY_STRING
- See Also:
-
DEFAULT_MAX_HEADER_SIZE
- See Also:
-
HTTP_JETTY_IDLE_TIMEOUT
- See Also:
-
DEFAULT_HTTP_JETTY_IDLE_TIMEOUT
- See Also:
-
FILTER_INITIALIZERS_PROPERTY
- See Also:
-
HTTP_MAX_THREADS
- See Also:
-
HTTP_UI_AUTHENTICATION
- See Also:
-
HTTP_AUTHENTICATION_PREFIX
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_PREFIX
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_PRINCIPAL_SUFFIX
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_PRINCIPAL_KEY
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_KEYTAB_SUFFIX
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_KEYTAB_KEY
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_KRB_NAME_SUFFIX
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_KRB_NAME_KEY
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_PROXYUSER_ENABLE_SUFFIX
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_PROXYUSER_ENABLE_KEY
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_PROXYUSER_ENABLE_DEFAULT
- See Also:
-
HTTP_AUTHENTICATION_SIGNATURE_SECRET_FILE_SUFFIX
- See Also:
-
HTTP_AUTHENTICATION_SIGNATURE_SECRET_FILE_KEY
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_ADMIN_USERS_KEY
- See Also:
-
HTTP_SPNEGO_AUTHENTICATION_ADMIN_GROUPS_KEY
- See Also:
-
HTTP_PRIVILEGED_CONF_KEY
- See Also:
-
HTTP_UI_NO_CACHE_ENABLE_KEY
- See Also:
-
HTTP_PRIVILEGED_CONF_DEFAULT
- See Also:
-
CONF_CONTEXT_ATTRIBUTE
- See Also:
-
ADMINS_ACL
- See Also:
-
BIND_ADDRESS
- See Also:
-
SPNEGO_FILTER
- See Also:
-
SPNEGO_PROXYUSER_FILTER
- See Also:
-
NO_CACHE_FILTER
- See Also:
-
APP_DIR
- See Also:
-
HTTP_UI_SHOW_STACKTRACE_KEY
- See Also:
-
METRIC_SERVLETS_CONF_KEY
- See Also:
-
METRICS_SERVLETS_DEFAULT
-
METRIC_SERVLETS
private static final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<String,ServletConfig> METRIC_SERVLETS -
adminsAcl
-
webServer
-
appDir
-
logDir
-
listeners
-
webAppContext
-
findPort
-
defaultContexts
protected final Map<org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler,Boolean> defaultContexts -
filterNames
-
authenticationEnabled
-
STATE_DESCRIPTION_ALIVE
- See Also:
-
STATE_DESCRIPTION_NOT_LIVE
- See Also:
-
-
Constructor Details
-
HttpServer
@Deprecated public HttpServer(String name, String bindAddress, int port, boolean findPort) throws IOException Deprecated.Since 0.99.0- Throws:
IOException
- See Also:
-
HttpServer
@Deprecated public HttpServer(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf, String[] pathSpecs) throws IOException Deprecated.Since 0.99.0Create a status server on the given port. Allows you to specify the path specifications that this server will be serving so that they will be added to the filters properly.- Parameters:
name
- The name of the serverbindAddress
- The address for this 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
- ConfigurationpathSpecs
- Path specifications that this httpserver will be serving. These will be added to any filters.- Throws:
IOException
-
HttpServer
@Deprecated public HttpServer(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf) throws IOException Deprecated.Since 0.99.0Create a status server on the given port. The jsp scripts are taken from src/webapps/<name>.- Parameters:
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
- Configuration- Throws:
IOException
-
HttpServer
@Deprecated public HttpServer(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl) throws IOException Deprecated.Since 0.99.0Creates a status server on the given port. The JSP scripts are taken from src/webapp<name>.- Parameters:
name
- the name of the serverbindAddress
- the address for this 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 portconf
- the configuration to useadminsAcl
-AccessControlList
of the admins- Throws:
IOException
- when creating the server fails
-
HttpServer
@Deprecated public HttpServer(String name, String bindAddress, int port, boolean findPort, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl, String[] pathSpecs) throws IOException Deprecated.Since 0.99.0Create a status server on the given port. The jsp scripts are taken from src/webapps/<name>.- Parameters:
name
- The name of the serverbindAddress
- The address for this 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 adminspathSpecs
- Path specifications that this httpserver will be serving. These will be added to any filters.- Throws:
IOException
-
HttpServer
- Throws:
IOException
-
-
Method Details
-
getServerConnectors
public List<org.apache.hbase.thirdparty.org.eclipse.jetty.server.ServerConnector> getServerConnectors() -
initializeWebServer
private void initializeWebServer(String name, String hostName, org.apache.hadoop.conf.Configuration conf, String[] pathSpecs, HttpServer.Builder b) throws FileNotFoundException, IOException - Throws:
FileNotFoundException
IOException
-
addManagedListener
private void addManagedListener(org.apache.hbase.thirdparty.org.eclipse.jetty.server.ServerConnector connector) -
createWebAppContext
private static org.apache.hbase.thirdparty.org.eclipse.jetty.webapp.WebAppContext createWebAppContext(String name, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl, String appDir) -
buildGzipHandler
public static org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.gzip.GzipHandler buildGzipHandler(org.apache.hbase.thirdparty.org.eclipse.jetty.server.Handler wrapped) Construct and configure an instance ofGzipHandler
. With complex multi-WebAppContext
configurations, it's easiest to apply this handler directly to the instance ofServer
near the end of its configuration, something likeServer server = new Server(); // ... server.setHandler(buildGzipHandler(server.getHandler())); server.start();
-
addNoCacheFilter
private static void addNoCacheFilter(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler ctxt, org.apache.hadoop.conf.Configuration conf) -
getFilterInitializers
Get an array of FilterConfiguration specified in the conf -
addDefaultApps
protected void addDefaultApps(org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.ContextHandlerCollection parent, String appDir, org.apache.hadoop.conf.Configuration conf) Add default apps.- Parameters:
appDir
- The application directory
-
configureAliasChecks
private void configureAliasChecks(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler context, boolean shouldServeAlias) This method configures the alias checks for the given ServletContextHandler based on the provided value of shouldServeAlias.
If shouldServeAlias is set to true, it checks if SymlinkAllowedResourceAliasChecker is already a part of the alias check list. If it is already a part of the list, no changes are made, else, it adds it to the list.
If shouldServeAlias is set to false, it clears all alias checks from the ServletContextHandler.
.- Parameters:
context
- The ServletContextHandler whose alias checks are to be configuredshouldServeAlias
- Whether aliases should be allowed or not
-
setContextAttributes
private void setContextAttributes(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler context, org.apache.hadoop.conf.Configuration conf) -
addDefaultServlets
protected void addDefaultServlets(org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.ContextHandlerCollection contexts, org.apache.hadoop.conf.Configuration conf) throws IOException Add default servlets.- Throws:
IOException
-
setAttribute
Set a value in the webapp context. These values are available to the jsp pages as "application.getAttribute(name)".- Parameters:
name
- The name of the attributevalue
- The value of the attribute
-
addJerseyResourcePackage
Add a Jersey resource package.- Parameters:
packageName
- The Java package name containing the Jersey resource.pathSpec
- The path spec for the servlet
-
addUnprivilegedServlet
public void addUnprivilegedServlet(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz) Adds a servlet in the server that any user can access. This method differs fromaddPrivilegedServlet(String, String, Class)
in that any authenticated user can interact with the servlet added by this method.- Parameters:
name
- The name of the servlet (can be passed as null)pathSpec
- The path spec for the servletclazz
- The servlet class
-
addUnprivilegedServlet
public void addUnprivilegedServlet(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder) Adds a servlet in the server that any user can access. This method differs fromaddPrivilegedServlet(String, ServletHolder)
in that any authenticated user can interact with the servlet added by this method.- Parameters:
pathSpec
- The path spec for the servletholder
- The servlet holder
-
addPrivilegedServlet
public void addPrivilegedServlet(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz) Adds a servlet in the server that only administrators can access. This method differs fromaddUnprivilegedServlet(String, String, Class)
in that only those authenticated user who are identified as administrators can interact with the servlet added by this method. -
addPrivilegedServlet
public void addPrivilegedServlet(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder) Adds a servlet in the server that only administrators can access. This method differs fromaddUnprivilegedServlet(String, ServletHolder)
in that only those authenticated user who are identified as administrators can interact with the servlet added by this method. -
addServletWithAuth
void addServletWithAuth(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz, boolean requireAuthz) Internal method to add a servlet to the HTTP server. Developers should not call this method directly, but invoke it viaaddUnprivilegedServlet(String, String, Class)
oraddPrivilegedServlet(String, String, Class)
. -
addServletWithAuth
void addServletWithAuth(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder, boolean requireAuthz) Internal method to add a servlet to the HTTP server. Developers should not call this method directly, but invoke it viaaddUnprivilegedServlet(String, ServletHolder)
oraddPrivilegedServlet(String, ServletHolder)
. -
addInternalServlet
void addInternalServlet(String name, String pathSpec, Class<? extends javax.servlet.http.HttpServlet> clazz, boolean requireAuthz) Add an internal servlet in the server, specifying whether or not to protect with Kerberos authentication. Note: This method is to be used for adding servlets that facilitate internal communication and not for user facing functionality. For servlets added using this method, filters (except internal Kerberos filters) are not enabled.- Parameters:
name
- The name of theServlet
(can be passed as null)pathSpec
- The path spec for theServlet
clazz
- TheServlet
classrequireAuthz
- Require Kerberos authenticate to access servlet
-
addInternalServlet
void addInternalServlet(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder holder, boolean requireAuthz) Add an internal servlet in the server, specifying whether or not to protect with Kerberos authentication. Note: This method is to be used for adding servlets that facilitate internal communication and not for user facing functionality. For servlets added using this method, filters (except internal Kerberos filters) are not enabled.- Parameters:
pathSpec
- The path spec for theServlet
holder
- The object providing theServlet
instancerequireAuthz
- Require Kerberos authenticate to access servlet
-
addFilter
Description copied from interface:FilterContainer
Add a filter to the container.- Specified by:
addFilter
in interfaceFilterContainer
- Parameters:
name
- Filter nameclassname
- Filter class nameparameters
- a map from parameter names to initial values
-
addGlobalFilter
Description copied from interface:FilterContainer
Add a global filter to the container - This global filter will be applied to all available web contexts.- Specified by:
addGlobalFilter
in interfaceFilterContainer
- Parameters:
name
- filter nameclassname
- filter class nameparameters
- a map from parameter names to initial values
-
defineFilter
public static void defineFilter(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler handler, String name, String classname, Map<String, String> parameters, String[] urls) Define a filter for a context and set up default url mappings. -
addFilterPathMapping
protected void addFilterPathMapping(String pathSpec, org.apache.hbase.thirdparty.org.eclipse.jetty.webapp.WebAppContext webAppCtx) Add the path spec to the filter path mapping.- Parameters:
pathSpec
- The path specwebAppCtx
- The WebApplicationContext to add to
-
getAttribute
Get the value in the webapp context.- Parameters:
name
- The name of the attribute- Returns:
- The value of the attribute
-
getWebAppContext
-
getWebAppsPath
- Throws:
FileNotFoundException
-
getWebAppsPath
Get the pathname to the webapps files.- Parameters:
appName
- eg "secondary" or "datanode"- Returns:
- the pathname as a URL
- Throws:
FileNotFoundException
- if 'webapps' directory cannot be found on CLASSPATH.
-
getPort
Deprecated.Since 0.99.0Get the port that the server is on- Returns:
- the port
-
getConnectorAddress
Get the address that corresponds to a particular connector.- Returns:
- the corresponding address for the connector, or null if there's no such connector or the connector is not bounded.
-
setThreads
Set the min, max number of worker threads (simultaneous connections). -
initSpnego
private void initSpnego(org.apache.hadoop.conf.Configuration conf, String hostName, String usernameConfKey, String keytabConfKey, String kerberosNameRuleKey, String signatureSecretKeyFileKey) throws IOException - Throws:
IOException
-
isMissing
Returns true if the argument is non-null and not whitespace -
getOrEmptyString
Extracts the value for the given key from the configuration of returns a string of zero length. -
start
Start the server. Does not wait for the server to start.- Throws:
IOException
-
loadListeners
-
openListeners
Open the main listener for the server- Throws:
Exception
- if the listener cannot be opened or the appropriate port is already in use
-
stop
stop the server- Throws:
Exception
-
addMultiException
private org.apache.hbase.thirdparty.org.eclipse.jetty.util.MultiException addMultiException(org.apache.hbase.thirdparty.org.eclipse.jetty.util.MultiException exception, Exception e) -
join
- Throws:
InterruptedException
-
isAlive
Test for the availability of the web server- Returns:
- true if the web server is started, false otherwise
-
toString
Return the host and port of the HttpServer, if live -
isInstrumentationAccessAllowed
public static boolean isInstrumentationAccessAllowed(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Checks the user has privileges to access to instrumentation servlets.If
hadoop.security.instrumentation.requires.admin
is set to FALSE (default value) it 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.- Parameters:
servletContext
- the servlet context.request
- the servlet request.response
- the servlet response.- Returns:
- TRUE/FALSE based on the logic decribed above.
- Throws:
IOException
-
hasAdministratorAccess
public static boolean hasAdministratorAccess(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Does the user sending the HttpServletRequest has the administrator ACLs? If it isn't the case, response will be modified to send an error to the user.- Parameters:
servletContext
- theServletContext
to userequest
- theHttpServletRequest
to checkresponse
- used to send the error response if user does not have admin access.- Returns:
- true if admin-authorized, false otherwise
- Throws:
IOException
- if an unauthenticated or unauthorized user tries to access the page
-
hasAdministratorAccess
public static boolean hasAdministratorAccess(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList acl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
userHasAdministratorAccess
public static boolean userHasAdministratorAccess(javax.servlet.ServletContext servletContext, String remoteUser) Get the admin ACLs from the given ServletContext and check if the given user is in the ACL.- Parameters:
servletContext
- the context containing the admin ACL.remoteUser
- the remote user to check for.- Returns:
- true if the user is present in the ACL, false if no ACL is set or the user is not present
-
userHasAdministratorAccess
public static boolean userHasAdministratorAccess(org.apache.hadoop.security.authorize.AccessControlList acl, String remoteUser)
-