Top Description Fields Constructors Methods
org.apache.catalina.manager

public Class JMXProxyServlet

extends HttpServlet
Class Inheritance
Imports
java.io.IOException, .PrintWriter, java.util.Set, javax.management.Attribute, .InstanceNotFoundException, .MBeanException, .MBeanInfo, .MBeanOperationInfo, .MBeanParameterInfo, .MBeanServer, .ObjectName, .OperationsException, .ReflectionException, javax.management.openmbean.CompositeData, jakarta.servlet.ServletException, jakarta.servlet.http.HttpServlet, .HttpServletRequest, .HttpServletResponse, org.apache.catalina.mbeans.MBeanDumper, org.apache.tomcat.util.modeler.Registry, org.apache.tomcat.util.res.StringManager

This servlet will dump JMX attributes in a simple format and implement proxy services for modeler.
Author
Costin Manolache

Field Summary

Modifier and TypeField and Description
protected transient MBeanServer
mBeanServer

MBean server.

private static final String[]
protected transient Registry
private static final long
private static final StringManager
Inherited from jakarta.servlet.http.HttpServlet:
LEGACY_DO_HEAD

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
doGet(HttpServletRequest
The servlet request we are processing
request
,
HttpServletResponse
The servlet response we are creating
response
)

Overrides jakarta.servlet.http.HttpServlet.doGet.

Process a GET request for the specified resource.

public void
getAttribute(PrintWriter writer, String onameStr, String att, String key)

private String[]

Returns:

An array of String parameters (empty array if paramString was null).
getInvokeParameters
(String
The string containing comma-separated operation-invocation parameters, or null if there are no parameters.
paramString
)

Parses parameter values from a parameter string.

public void
init()

Overrides jakarta.servlet.GenericServlet.init.

Initialize this servlet.

private void
invokeOperation(PrintWriter writer, String onameStr, String op, String[] valuesStr)

private Object

Returns:

The value returned by the requested operation.
invokeOperationInternal
(String
The name of the MBean.
onameStr
,
String
The name of the operation to invoke.
operation
,
String[]
An array of Strings containing the parameters to the operation. They will be converted to the appropriate types to call the requested operation.
parameters
)

Invokes an operation on an MBean.

public boolean

Returns:

Always returns true
isSupported
(String
The type to check
type
)

Determines if a type is supported by the JMXProxyServlet.

public void
private void
output(String indent, PrintWriter writer, Object result)

public void
setAttribute(PrintWriter writer, String onameStr, String att, String val)

private void
setAttributeInternal(String onameStr, String attributeName, String value)

Sets an MBean attribute's value.

Inherited from jakarta.servlet.http.HttpServlet:
doDeletedoHeaddoOptionsdoPostdoPutdoTracegetLastModifiedinitserviceservice

Field Detail

mBeanServerback to summary
protected transient MBeanServer mBeanServer

MBean server.

NO_PARAMETERSback to summary
private static final String[] NO_PARAMETERS
registryback to summary
protected transient Registry registry
serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.servlet.http.HttpServlet.serialVersionUID.

smback to summary
private static final StringManager sm

Constructor Detail

JMXProxyServletback to summary
public JMXProxyServlet()

Method Detail

doGetback to summary
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException

Overrides jakarta.servlet.http.HttpServlet.doGet.

Process a GET request for the specified resource.

Parameters
request:HttpServletRequest

The servlet request we are processing

response:HttpServletResponse

The servlet response we are creating

Annotations
@Override
Exceptions
IOException:
if an input/output error occurs
ServletException:
if a servlet-specified error occurs
getAttributeback to summary
public void getAttribute(PrintWriter writer, String onameStr, String att, String key)
getInvokeParametersback to summary
private String[] getInvokeParameters(String paramString)

Parses parameter values from a parameter string.

Parameters
paramString:String

The string containing comma-separated operation-invocation parameters, or null if there are no parameters.

Returns:String[]

An array of String parameters (empty array if paramString was null).

initback to summary
public void init() throws ServletException

Overrides jakarta.servlet.GenericServlet.init.

Initialize this servlet.

Annotations
@Override
Exceptions
ServletException:

Doc from jakarta.servlet.GenericServlet.init.

if an exception occurs that interrupts the servlet's normal operation

invokeOperationback to summary
private void invokeOperation(PrintWriter writer, String onameStr, String op, String[] valuesStr)
invokeOperationInternalback to summary
private Object invokeOperationInternal(String onameStr, String operation, String[] parameters) throws OperationsException, MBeanException, ReflectionException

Invokes an operation on an MBean.

Parameters
onameStr:String

The name of the MBean.

operation:String

The name of the operation to invoke.

parameters:String[]

An array of Strings containing the parameters to the operation. They will be converted to the appropriate types to call the requested operation.

Returns:Object

The value returned by the requested operation.

Annotations
@SuppressWarnings:null
isSupportedback to summary
public boolean isSupported(String type)

Determines if a type is supported by the JMXProxyServlet.

Parameters
type:String

The type to check

Returns:boolean

Always returns true

listBeansback to summary
public void listBeans(PrintWriter writer, String qry)
outputback to summary
private void output(String indent, PrintWriter writer, Object result)
setAttributeback to summary
public void setAttribute(PrintWriter writer, String onameStr, String att, String val)
setAttributeInternalback to summary
private void setAttributeInternal(String onameStr, String attributeName, String value) throws OperationsException, MBeanException, ReflectionException

Sets an MBean attribute's value.