Class JettyAdminServer
java.lang.Object
org.apache.zookeeper.server.admin.JettyAdminServer
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.zookeeper.server.admin.AdminServer
AdminServer.AdminServerException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionJettyAdminServer(String address, int port, int timeout, String commandUrl, int httpVersion, boolean portUnification, boolean forceHttps) -
Method Summary
Modifier and TypeMethodDescriptionvoidsetZooKeeperServer(ZooKeeperServer zkServer) Set the ZooKeeperServer that will be used to run Commands.voidshutdown()Stop the embedded Jetty server.voidstart()Start the embedded Jetty server.
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_IDLE_TIMEOUT
public static final int DEFAULT_IDLE_TIMEOUT- See Also:
-
DEFAULT_COMMAND_URL
- See Also:
-
DEFAULT_STS_MAX_AGE
public static final int DEFAULT_STS_MAX_AGE- See Also:
-
DEFAULT_HTTP_VERSION
public static final int DEFAULT_HTTP_VERSION- See Also:
-
-
Constructor Details
-
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) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
-
Method Details
-
start
Start the embedded Jetty server.- Specified by:
startin interfaceAdminServer- Throws:
AdminServer.AdminServerException
-
shutdown
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:
shutdownin interfaceAdminServer- Throws:
AdminServer.AdminServerException
-
setZooKeeperServer
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:
setZooKeeperServerin interfaceAdminServer
-