Re: How to get non-HTML result from a MX4J based server

Simone Bordet <[email protected]> Fri, 9 Mar 2018 16:59:14 +0100
Newsgroups gmane.comp.java.mx4j.user
Message-ID <CAFWmRJ1LkZa1qPmmHghfN95Wm_qhk6xMt_hoocHy7HAFqRyRfw@mail.gmail.com>
Hi,

On Tue, Feb 6, 2018 at 3:50 AM, MyCoy Zhang <[email protected]> wrote:
> Hello, everyone:
>
> I'm trying to parse the JMX result from a MX4J-based server.
> Right now, I can only get HTML-based result from the web-page or curl.
>
> But HTML is hard to parse, and  it's necessary to further go into every link
> to pull information.
> JSON- or XML-based complete result is referable. But after some exploring, I
> cannot get neither JSON nor XML result.
>
> In the official document, I see that, http://host:port/serverbydomain can
> produce XML-based result. But for me, it's HTML result.
>
> I see there is some suggestion to use the "Jolokia" project.
> But for me this is not an alternative, because the company's environment is
> bundled with MX4J. It's highly automatic environment, hard to change and
> very likely I don't have the permission to change it.
>
> So, could anyone provide some suggestions to derive complete (not containing
> sub-links) JSON or XML result from a MX4J-based server?
> Or, could anyone confirm that, MX4J simply cannot do this.

MX4J is a dead project that is not updated since years.
JMX has been included in JDK 5 and you can now have better tools to
export JMX data even remotely.

Having said that, you should look at
mx4j.tools.adaptor.http.HttpAdaptor.setProcessor*() methods that set
what is the processor for the XML document that is produced by
HttpAdaptor.
There is class DefaultProcessor that just output the XML (what you
want) and XSLTProcessor that uses the XSL files to convert to HTML.
What you need to do is to make sure that you're using the DefaultProcessor.

-- 
Simone Bordet
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot