You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Lionel Cons <li...@cern.ch> on 2011/06/08 14:20:02 UTC

Error with Apollo REST API

Hiram,

Using apollo-1.0-20110607.125153-128, I got an error with the REST API.

I can run:

$ curl -u "guest:guest" 'http://localhost:8080/broker/connections.json'

and the resulting objects contain both an id and a subscription_count
fields:

{"id":"1557","state":"STARTED",[...],"subscription_count":1}

I can filter the fields and get only the id:

$ curl -u "guest:guest" 'http://localhost:8080/broker/connections.json?f=id'

However, If I want only the subscription_count, I get an error:

$ curl -u "guest:guest" 'http://localhost:8080/broker/connections.json?f=subscription_count'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /WEB-INF/scalate/errors/500.scaml. Reason:
<pre>    Not Found</pre></p><h3>Caused by:</h3><pre>org.josql.QueryParseException: Unable to create getter: subscription_count
	at org.josql.expressions.Accessor.init(Accessor.java:64)
	at org.josql.expressions.SelectItemExpression.init(SelectItemExpression.java:71)
	at org.josql.Query.init(Query.java:2127)
	at org.josql.Query.parse(Query.java:2048)
[...]

Also, I'm surprised to get an HTML result when I asked for
JSON. Shouldn't the error be returned as a JSON object?

Cheers,

Lionel

Re: Error with Apollo REST API

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Yeah. That's because that field is not part of the base class of the
ConnectionStatusDTO:

http://activemq.apache.org/apollo/versions/1.0-beta3/website/documentation/api/apollo-dto/org/apache/activemq/apollo/dto/ConnectionStatusDTO.html

The StompConnectionStatusDTO extends the class and adds that field in.
 Unfortunately, the JOSQL library which we are using to query/filter
the fields only work against the base classes and the the sub classes.

I'll have to move the field to the base class.

Regards,
Hiram

FuseSource
Web: http://fusesource.com/




On Wed, Jun 8, 2011 at 8:20 AM, Lionel Cons <li...@cern.ch> wrote:
> Hiram,
>
> Using apollo-1.0-20110607.125153-128, I got an error with the REST API.
>
> I can run:
>
> $ curl -u "guest:guest" 'http://localhost:8080/broker/connections.json'
>
> and the resulting objects contain both an id and a subscription_count
> fields:
>
> {"id":"1557","state":"STARTED",[...],"subscription_count":1}
>
> I can filter the fields and get only the id:
>
> $ curl -u "guest:guest" 'http://localhost:8080/broker/connections.json?f=id'
>
> However, If I want only the subscription_count, I get an error:
>
> $ curl -u "guest:guest" 'http://localhost:8080/broker/connections.json?f=subscription_count'
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
> <title>Error 404 Not Found</title>
> </head>
> <body><h2>HTTP ERROR 404</h2>
> <p>Problem accessing /WEB-INF/scalate/errors/500.scaml. Reason:
> <pre>    Not Found</pre></p><h3>Caused by:</h3><pre>org.josql.QueryParseException: Unable to create getter: subscription_count
>        at org.josql.expressions.Accessor.init(Accessor.java:64)
>        at org.josql.expressions.SelectItemExpression.init(SelectItemExpression.java:71)
>        at org.josql.Query.init(Query.java:2127)
>        at org.josql.Query.parse(Query.java:2048)
> [...]
>
> Also, I'm surprised to get an HTML result when I asked for
> JSON. Shouldn't the error be returned as a JSON object?
>
> Cheers,
>
> Lionel
>