You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2012/07/04 03:29:00 UTC

Get-and-set with JMXProxyServlet

All,

I have a slight interest in implementing either a get-and-set or
get-and-invoke (or both) in JMXProxyServlet. While it is easy to script
get-then-set (or get-then-invoke), I'd like to be able to, with a single
URL, get one value and (for example) reset the value to zero (or call
something like resetCounters).

The current implementation of JMXProxyServlet's doGet method is
something like this:

String qry=request.getParameter("get");
if(qry != null) {
    // do the "get"
    return;
}

I was thinking that I could just let the "if" case fall-through after
the (partial) response has been written: the client would then receive
*two* "responses" in the same HTTP response: one from the "get" and
another from the "invoke".

Presumably, the client will understand the nature of the two responses
and will be able to tell which is which.

Are there any objections or alternatives anyone would like to raise? If
necessary, I certainly *can* script these two operations but I thought
it might be a nice feature to have.

On a related note, I was thinking it might be nice to allow multiple
"get" (or any other) operations in a single request, but there are pairs
of request parameters (get + att + key) that must be matched-up for
certain requests and so that is problematic (unless we allow
"?get0=x&att0=y&key=z&get1=x1&att1=..."). If anyone has any suggestions,
I'd be happy to implement something like that.

Thanks,
-chris