[jboss-dev-forums] [JBoss AS 7 Development] - HTTP (JSON-like) API

Jason Greene do-not-reply at jboss.com
Wed Nov 16 10:09:08 EST 2011


Jason Greene [http://community.jboss.org/people/jason.greene] modified the document:

"HTTP (JSON-like) API"

To view the document, visit: http://community.jboss.org/docs/DOC-17344

--------------------------------------------------------------
This is a digest of  http://lists.jboss.org/pipermail/jboss-as7-dev/2011-February/000491.html http://lists.jboss.org/pipermail/jboss-as7-dev/2011-February/000491.html for easier finding.

In a nutshell this is another view on the management API available over the http connector installed in standalone.xml/host.xml, normally on port 9990.

    <management>
        <security-realms>
            <security-realm name=+"ManagementRealm"+>
<authentication>
                    <properties path=+"mgmt-users.properties"+ relative-to=+"jboss.server.config.dir"+ plain-text=+"true"+/>
</authentication>
            </security-realm>
        </security-realms>
        <management-interfaces>
            <native-interface interface=+"management"+ port=+"9999"+/>
*            <http-interface interface=+"management"+ port=+"9990"+/>*
        </management-interfaces>
    </management>

*GET requests*

The GET URL form is a mapping of operation addresses, with a few 
supported read operations, and support for mapping top level values via 
query parameters. The default operation is read-resource. So in 
other words you can dump the whole management tree like so:
 http://localhost:9990/management?recursive http://localhost:9990/management?recursive

To make the output of any GET operation easier to read you can append the "json.pretty" parameter to the end, e.g.:
http://localhost:9990/management?operation=resource&recursive&json.pretty


The lack of additional /'s defaults to the root node.
The lack of an "operation" defaults to the read-resource operation.
The "recursive" is mapped to the recursive as a boolean, a lack of an 
assignment defaults to "true"

The attributes of the http web connector can be retrieved with:
 http://localhost:9990/management/subsystem/web/connector/http http://localhost:9990/management/subsystem/web/connector/http

A single attribute can be retrieved by specifying the attribute 
operation and the attribute name:
 http://localhost:9990/management/subsystem/logging/console-handler/CONSOLE?operation=attribute&name=autoflush http://localhost:9990/management/subsystem/logging/console-handler/CONSOLE?operation=attribute&name=autoflush

The full description of the model can be retrieved using the 
read-resource-description operation like so:
 http://localhost:9990/management?operation=resource-description&recursive&operations http://localhost:9990/management?operation=resource-description&recursive&operations

*POST requests*

You can also do post support for both JSON and DMR Encoded:

curl -H Content-Type:\ application/json -d '{"operation":"read-resource","address":[],"json.pretty":1}' 
 http://localhost:9990/domain-api http://localhost:9990/management

curl -H Content-Type:\ application/dmr-encoded -d 
bwAAAAMACW9wZXJhdGlvbnMADXJlYWQtcmVzb3VyY2UAB2FkZHJlc3NsAAAAAAAHcmVjdXJzZVoB 
  http://localhost:9990/domain-api http://localhost:9990/management
--------------------------------------------------------------

Comment by going to Community
[http://community.jboss.org/docs/DOC-17344]

Create a new document in JBoss AS 7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20111116/089ab3fc/attachment.html 


More information about the jboss-dev-forums mailing list