dev@glassfish.java.net

REST API and slashes in resource names

From: Jason Lee <jason.d.lee_at_oracle.com>
Date: Thu, 27 May 2010 14:40:11 -0500

I've run into an issue with REST API. Take this URL:
http://localhost:4848/management/domain/resources/admin-object-resource/jndi-foo

The resource name is identified by the last...segment of the URI, in
this case jndi-foo. The system then takes that name and passes it to
the CLI. The problem is that the actual ID in the system is jndi/foo,
not jndi-foo We have to, then, convert that - to a /, but we can't do
it every time, as my-connection-pool is a valid name. We could use, I
guess, a query string param :

     
http://localhost:4848/management/domain/resources/admin-object-resource/jndi-foo?convertDash=true

But jndi/my-connection is a valid resource name as well, and that
resource would be identified by

     
http://localhost:4848/management/domain/resources/admin-object-resource/jndi-my-connection

Just replacing the first dash won't be sufficient either, as "foo/" (be
it jdbc, jms, etc) is not required in the JNDI/resource name, so
my-jms-destination is valid.

Anyone have any great ideas on how best to convert the resource name in
the URI to the actual resource name in domain.xml?

-- 
Jason Lee
Senior Member of Technical Staff
GlassFish Administration Console
Oracle Corporation
Phone x31197/+1 405-343-1964
Blog http://blogs.steeplesoft.com