Oracle Blog

Blog for aquatic

Thursday Dec 10, 2009

GlassFishRESTInterfaceforManagementandMonitoringGlassFish has
added yet another tool to its arsenal - REST Interface, a new feature
introduced in GlassFish v3. I would like to summarize this feature. In
addition to Command Line Interface, Java Management API for GlassFish
(AMX) & GlassFish Administration UI, you can now use GlassFish
REST Interface to manage and monitor GlassFish. GlassFish REST
Interface exposes GlassFish configuration and runtime models as REST
URLs. This support is provided/implemented using JSR 311/Jersey.
GlassFish
REST Interface is available in full
and web
distributions.
To use this interface -
1. Install GlassFish using any of the following distributionsCommunity
full profileCommunity
web profileJava
EE 6 SDKGlassFish
Enterprise Server v3
2. Start GlassFish
<GlassFish Intall Root>/bin/asadmin start-dmain
3. Access the following URL(s) using any http client
http://localhost:4848/managment/domainhttp://localhost:4848/monitoring/domain

Where {host} identifies the server host and {port} is the server
administration
port.

Using management root URL1 you
can traverse and discover
the entire GlassFish
configuration model whereas using monitoring root URL2
you can
traverse and discover
the entire GlassFish runtime model.

GlassFish REST Interface supports JSON,
XML and HTML formats. Based of the client/client request, appropriate
format representation is sent to the client. Metadata for given
URL(resource), such as methods
supported, input parameters for supported methods and their type, can
be obtained through GET request on that URL. You can also use OPTIONS
method to get
the metadata. For more on formats, metadata and other details please
refer to REST
Interface section of GlassFish
Administration guide.