You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sc...@apache.org on 2012/10/02 18:29:15 UTC
svn commit: r1393014 - in /tomcat/tc7.0.x/trunk: ./
java/org/apache/catalina/manager/JMXProxyServlet.java
webapps/docs/changelog.xml webapps/docs/manager-howto.xml
Author: schultz
Date: Tue Oct 2 16:29:15 2012
New Revision: 1393014
URL: http://svn.apache.org/viewvc?rev=1393014&view=rev
Log:
Reverted r1381635 for further discussion.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/manager-howto.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Reverse-merged /tomcat/trunk:r1381633
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java?rev=1393014&r1=1393013&r2=1393014&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java Tue Oct 2 16:29:15 2012
@@ -93,98 +93,33 @@ public class JMXProxyServlet extends Htt
return;
}
- // Invoke an operation, then execute a "get"
- if(null != request.getParameter("invokeAndGet")) {
- try {
- invokeOperationInternal(request.getParameter("invoke"),
- request.getParameter("op"),
- getInvokeParameters(request.getParameter("ps")));
-
- getAttribute(writer,
- request.getParameter("get"),
- request.getParameter("att"),
- request.getParameter("key"));
- } catch (Exception e) {
- writer.println("Error - " + e.toString());
- e.printStackTrace(writer);
- }
+ String qry=request.getParameter("set");
+ if( qry!= null ) {
+ String name=request.getParameter("att");
+ String val=request.getParameter("val");
+
+ setAttribute( writer, qry, name, val );
+ return;
}
- // Get a value first, then invoke an operation
- else if(null != request.getParameter("getAndInvoke")) {
- try {
- getAttribute(writer,
- request.getParameter("get"),
- request.getParameter("att"),
- request.getParameter("key"));
-
- invokeOperationInternal(request.getParameter("invoke"),
- request.getParameter("op"),
- getInvokeParameters(request.getParameter("ps")));
- } catch (Exception e) {
- writer.println("Error - " + e.toString());
- e.printStackTrace(writer);
- }
+ qry=request.getParameter("get");
+ if( qry!= null ) {
+ String name=request.getParameter("att");
+ getAttribute( writer, qry, name, request.getParameter("key") );
+ return;
}
- // Invoke an operation, then set a value
- else if(null != request.getParameter("invokeAndSet")) {
- try {
- invokeOperationInternal(request.getParameter("invoke"),
- request.getParameter("op"),
- getInvokeParameters(request.getParameter("ps")));
-
- setAttribute(writer,
- request.getParameter("set"),
- request.getParameter("att"),
- request.getParameter("val"));
- } catch (Exception e) {
- writer.println("Error - " + e.toString());
- e.printStackTrace(writer);
- }
+ qry = request.getParameter("invoke");
+ if(qry != null) {
+ String opName=request.getParameter("op");
+ String[] params = getInvokeParameters(request.getParameter("ps"));
+ invokeOperation(writer, qry, opName, params);
+ return;
}
- // Get a value, then set its value
- else if(null != request.getParameter("getAndSet")) {
- try {
- getAttribute(writer,
- request.getParameter("get"),
- request.getParameter("att"),
- request.getParameter("key"));
-
- setAttributeInternal(request.getParameter("set"),
- request.getParameter("att"),
- request.getParameter("val"));
- } catch (Exception e) {
- writer.println("Error - " + e.toString());
- e.printStackTrace(writer);
- }
- } else {
- String qry=request.getParameter("set");
- if( qry!= null ) {
- String name=request.getParameter("att");
- String val=request.getParameter("val");
-
- setAttribute( writer, qry, name, val );
- return;
- }
- qry=request.getParameter("get");
- if( qry!= null ) {
- String name=request.getParameter("att");
- getAttribute( writer, qry, name, request.getParameter("key") );
- return;
- }
- qry = request.getParameter("invoke");
- if(qry != null) {
- String opName=request.getParameter("op");
- String[] params = getInvokeParameters(request.getParameter("ps"));
- invokeOperation(writer, qry, opName, params);
- return;
- }
- qry=request.getParameter("qry");
- if( qry == null ) {
- qry = "*:*";
- }
-
- listBeans( writer, qry );
+ qry=request.getParameter("qry");
+ if( qry == null ) {
+ qry = "*:*";
}
+
+ listBeans( writer, qry );
}
public void getAttribute(PrintWriter writer, String onameStr, String att, String key) {
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1393014&r1=1393013&r2=1393014&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Oct 2 16:29:15 2012
@@ -69,11 +69,6 @@
<bug>53828</bug>: Use correct status code when closing a WebSocket
connection normally in response to a close frame from a client. (markt)
</fix>
- <update>
- <code>JMXProxyServlet</code> now allows multi-op commands like
- <code>invokeAndSet</code>, <code>invokeAndGet</code>,
- etc. (schultz)
- </update>
<fix>
<bug>53843</bug>: <code>request.isAsyncStarted()</code> must continue to
return true until the dispatch actually happens (which at the earliest
Modified: tomcat/tc7.0.x/trunk/webapps/docs/manager-howto.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/manager-howto.xml?rev=1393014&r1=1393013&r2=1393014&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/manager-howto.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/manager-howto.xml Tue Oct 2 16:29:15 2012
@@ -1346,98 +1346,7 @@ http://webserver/manager/jmxproxy/?invok
http://localhost:8080/manager/jmxproxy/?invoke=Catalina%3Atype%3DService&op=findConnectors&ps=
</source>
</subsection>
- <subsection name="Multiple operations" anchor="multiOp">
- <p>
- The JMXProxyServlet can also perform certain combinations of
- operations with a single HTTP request:
- </p>
- <ul>
- <li><code>invoke</code> and <code>set</code></li>
- <li><code>invoke</code> and <code>get</code></li>
- <li><code>get</code> and <code>invoke</code></li>
- <li><code>get</code> and <code>set</code></li>
- </ul>
- <subsection name="Invoke and set" anchor="invokeAndSet">
- <p>
- If you want to invoke an operation and then set a value, add an
- <code>invokeAndSet</code> parameter to the request and make sure you
- have all the required parameters for both the <code>invoke</code>
- and <code>set</code> commands:
- </p>
- <source>
-http://webserver/manager/jmxproxy/?invokeAndSet&invoke=BEANNAME&op=METHODNAME&ps=COMMASEPARATEDPARAMETERS&set=BEANNAME&att=MYATTRIBUTE&val=NEWVALUE
- </source>
- <p>
- Note that you can use different target MBeans if you want to, because
- the <code>invoke</code> and <code>set</code> parameters can obviously
- have different values.
- </p>
- </subsection>
- <subsection name="Invoke and get" anchor="invokeAndGet">
- <p>
- If you want to invoke an operation and then get a value, add an
- <code>invokeAndGet</code> parameter to the request and make sure you
- have all the required parameters for both the <code>invoke</code>
- and <code>get</code> commands:
- </p>
- <source>
-http://webserver/manager/jmxproxy/?invokeAndGet&invoke=BEANNAME&op=METHODNAME&ps=COMMASEPARATEDPARAMETERS&get=BEANNAME&att=MYATTRIBUTE[&key=MYKEY (optional)]
- </source>
- <p>
- Note that you can use different target MBeans if you want to, because
- the <code>invoke</code> and <code>get</code> parameters can obviously
- have different values.
- </p>
- </subsection>
- <subsection name="Get and invoke" anchor="getAndInvoke">
- <p>
- If you want to get a value and then invoke an operation, add a
- <code>getAndInvoke</code> parameter to the request and make sure you
- have all the required parameters for both the <code>invoke</code>
- and <code>get</code> commands:
- </p>
- <source>
-http://webserver/manager/jmxproxy/?getAndInvoke&invoke=BEANNAME&op=METHODNAME&ps=COMMASEPARATEDPARAMETERS&get=BEANNAME&att=MYATTRIBUTE[&key=MYKEY (optional)]
- </source>
- <p>
- Here is an example of how to get the current value of a request
- processor's "maxTime" metric and then reset all the metrics counters:
- </p>
- <source>
-http://webserver/manager/jmxproxy?getAndInvoke&invoke=Catalina:type=GlobalRequestProcessor,name="http-nio-127.0.0.1-8080"&op=resetCounters&get=Catalina:type=GlobalRequestProcessor,name="http-nio-127.0.0.1-8080"&att=maxTime
- </source>
- <p>
- Note that you can use different target MBeans if you want to, because
- the <code>invoke</code> and <code>get</code> parameters can obviously
- have different values.
- </p>
- </subsection>
- <subsection name="Get and set" anchor="getAndSet">
- <p>
- If you want to get a value and then set a value, add a
- <code>getAndSet</code> parameter to the request and make sure you
- have all the required parameters for both the <code>get</code>
- and <code>set</code> commands:
- </p>
- <source>
-http://webserver/manager/jmxproxy/?getAndSet&get=BEANNAME&att=MYATTRIBUTE[&key=MYKEY (optional)]&set=BEANNAME&val=NEWVALUE
- </source>
- <p>
- Here is an example of how to get the current value of a request
- processor's "maxTime" metric and then set that value to 0:
- </p>
- <source>
-http://webserver/manager/jmxproxy?getAndSet&get=Catalina:type=GlobalRequestProcessor,name="http-nio-127.0.0.1-8080"&att=maxTime&set=Catalina:type=GlobalRequestProcessor,name="http-nio-127.0.0.1-8080"&val=0
- </source>
- <p>
- Note that you can use different target MBeans if you want to, because
- the <code>invoke</code> and <code>get</code> parameters can obviously
- have different values, <b>but you must use the same attribtue name for
- both</b> because both the <code>get</code> and <code>set</code> commands
- both use the <code>att</code> parameter to identify the MBean attribute.
- </p>
- </subsection>
- </subsection>
+
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org