admin@glassfish.java.net

Re: how to use REST api in Java code

From: Lloyd Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 29 Aug 2008 12:54:13 -0700

Jason,

Keep in mind that right now, "localhost:4848" is hard-coded, using
HttpURLConnection to execute the command.

I would like to be able to use CommandRunner, which Jerome will move
out of core/kernel I hope.

I can change the current code to traipse through the config and try to
find out what URL to use, but I need to know all of the following to
form a URL:

- the scheme (http vs https)
- the host
- the port
- the prefix (__asadmin)


This might actually be useful for external clients.

Lloyd


On Aug 29, 2008, at 12:51 PM, Jason Lee wrote:

> On Aug 29, 2008, at 2:49 PM, Lloyd Chambers wrote:
>
>> Your API is now implemented and available.
>>
>> Use:
>>
>> DomainRoot domainRoot = ...;
>>
>> domainRoot.executeREST(DomainRoot.STOP_DOMAIN);
>>
>> Any REST command can be executed, this is already proving handy for
>> me using my jmxmcd client.
>
>
> Beautiful. Thanks!
>
> Jason Lee - x31197
> Senior Java Developer, Sun Microsystems
> GlassFish Admin Console Team
> Email: jasondlee_at_sun.com
>