Allowing JSON result in JMX invocation

88 views
Skip to first unread message

Antonio Petrelli

unread,
Jan 20, 2010, 8:37:34 AM1/20/10
to jminix-users
Hi all
I posted a patch to allow JSON result when requested in JMX method
invocation:
http://code.google.com/p/jminix/issues/detail?id=1

Let me know if it is ok.

Antonio

Laurent Bovet

unread,
Jan 22, 2010, 9:42:31 AM1/22/10
to jminix...@googlegroups.com
Hello Antonio,
 
Thanks alot for contributing. I will check this out when I am back from Holiday, in February.
 
Cheers,
 
Laurent

2010/1/20 Antonio Petrelli <antonio....@gmail.com>

jaikit savla

unread,
Jul 24, 2012, 5:09:41 PM7/24/12
to jminix...@googlegroups.com, lbo...@windmaster.ch
Hi Laurent,

It was very easy integrating JMiniX with my webapp. I would like to get JSON result instead of HTML. Has this patch being integrated ?

Thanks,
Jaikit

Laurent Bovet

unread,
Jul 25, 2012, 10:59:22 AM7/25/12
to jminix...@googlegroups.com
Yes, since version 1.0.0

You have to specify the HTTP Accept header to get JSON result. E.g. from javascript using a XMLHttpRequest object:

xhr.setRequestHeader("Accept", "application/json");
Cheers,

Laurent

2012/7/24 jaikit savla <jkts...@gmail.com>

jaikit savla

unread,
Jul 25, 2012, 3:35:00 PM7/25/12
to jminix...@googlegroups.com, lbo...@windmaster.ch
  1. I added the header but still getting html response. Is there any other header I need to add ?
  2. Version which I am using:
  3. <dependency> <groupId>org.jminix</groupId> <artifactId>jminix</artifactId> <version>1.0.0</version> </dependency>

  1. Request URL:
  2. Request Method:
    GET
  3. Status Code:
    200 OK
  4. Request Headersview source
    1. Accept:
      application/json
    2. Accept-Charset:
      ISO-8859-1,utf-8;q=0.7,*;q=0.3
    3. Accept-Encoding:
      gzip,deflate,sdch
    4. Accept-Language:
      en-US,en;q=0.8
    5. Connection:
      keep-alive
Response Header:
  1. Accept-Ranges:
    bytes
  2. Connection:
    close
  3. Content-Encoding:
    gzip
  4. Content-Type:
    text/html
  5. Date:
    Wed, 25 Jul 2012 19:29:40 GMT
  6. Server:
    Apache
  7. Transfer-Encoding:
    chunked

Laurent Bovet

unread,
Jul 25, 2012, 3:46:44 PM7/25/12
to jminix...@googlegroups.com
You try to get the root path (jmx/). This is the entry point to the graphical console which has no json representation.

Try with a path under the url jmx/servers, e.g. the url of an attribute.

2012/7/25 jaikit savla <jkts...@gmail.com>
Reply all
Reply to author
Forward
0 new messages