Class JettyAdminServer
- java.lang.Object
-
- org.apache.zookeeper.server.admin.JettyAdminServer
-
- All Implemented Interfaces:
AdminServer
public class JettyAdminServer extends Object implements AdminServer
This class encapsulates a Jetty server for running Commands. Given the default settings, start a ZooKeeper server and visit http://hostname:8080/commands for links to all registered commands. Visiting http://hostname:8080/commands/commandname will execute the associated Command and return the result in the body of the response. Any keyword arguments to the command are specified with URL parameters (e.g., http://localhost:8080/commands/set_trace_mask?traceMask=306).- See Also:
Commands
,CommandOutputter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.zookeeper.server.admin.AdminServer
AdminServer.AdminServerException
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_COMMAND_URL
static int
DEFAULT_HTTP_VERSION
static int
DEFAULT_IDLE_TIMEOUT
static int
DEFAULT_PORT
static int
DEFAULT_STS_MAX_AGE
-
Constructor Summary
Constructors Constructor Description JettyAdminServer()
JettyAdminServer(String address, int port, int timeout, String commandUrl, int httpVersion, boolean portUnification, boolean forceHttps, boolean needClientAuth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setZooKeeperServer(ZooKeeperServer zkServer)
Set the ZooKeeperServer that will be used to run Commands.void
shutdown()
Stop the embedded Jetty server.void
start()
Start the embedded Jetty server.
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
DEFAULT_IDLE_TIMEOUT
public static final int DEFAULT_IDLE_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_COMMAND_URL
public static final String DEFAULT_COMMAND_URL
- See Also:
- Constant Field Values
-
DEFAULT_STS_MAX_AGE
public static final int DEFAULT_STS_MAX_AGE
- See Also:
- Constant Field Values
-
DEFAULT_HTTP_VERSION
public static final int DEFAULT_HTTP_VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JettyAdminServer
public JettyAdminServer() throws AdminServer.AdminServerException, IOException, GeneralSecurityException
-
JettyAdminServer
public JettyAdminServer(String address, int port, int timeout, String commandUrl, int httpVersion, boolean portUnification, boolean forceHttps, boolean needClientAuth) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
-
Method Detail
-
start
public void start() throws AdminServer.AdminServerException
Start the embedded Jetty server.- Specified by:
start
in interfaceAdminServer
- Throws:
AdminServer.AdminServerException
-
shutdown
public void shutdown() throws AdminServer.AdminServerException
Stop the embedded Jetty server. This is not very important except for tests where multiple JettyAdminServers are started and may try to bind to the same ports if previous servers aren't shut down.- Specified by:
shutdown
in interfaceAdminServer
- Throws:
AdminServer.AdminServerException
-
setZooKeeperServer
public void setZooKeeperServer(ZooKeeperServer zkServer)
Set the ZooKeeperServer that will be used to run Commands. It is not necessary to set the ZK server before calling AdminServer.start(), and the ZK server can be set to null when, e.g., that server is being shut down. If the ZK server is not set or set to null, the AdminServer will still be able to issue Commands, but they will return an error until a ZK server is set.- Specified by:
setZooKeeperServer
in interfaceAdminServer
-
-