Q about http management api

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Q about http management api

Heiko W.Rupp
>From time to time I see

405 errors

11:16:10,103 DEBUG [ASConnection] We got a 405 for url http://127.0.0.1:49990/management and operation Operation{operation='read-attribute', address=Address{path: }, additionalProperties={name=launch-type, include-defaults=true}}, method=POST

            conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("POST");
            conn.addRequestProperty("Content-Type", "application/json");
            conn.addRequestProperty("Accept", "application/json");

My understanding is that those only should show when content type is wrong. Looking at the sources I see that they
may happen
- on OPTIONS method (which we don't do)
- for other contexts that only support GET ( like / )

Any idea what may go wrong here?


And then for requests for stuff that is e.g. not deployed , the API returns "internal server error" 500,

11:16:15,370 ERROR [ASConnection] Operation{operation='read-resource', address=Address{path: subsystem=connector}, additionalProperties={include-defaults=true}} failed with 500 (Internal Server Error) - response body was [{"outcome" : "failed", "failure-description" : "JBAS014739: No handler for read-resource at address [(\"subsystem\" => \"connector\")]", "rolled-back" : true}].

I think a 404 not found would be much more correct. Especially as it looks like URLConnections throw exceptions on 500 errors.

   Heiko

--
Reg. Adresse: Red Hat GmbH, Technopark II, Haus C,
Werner-von-Siemens-Ring 14, D-85630 Grasbrunn
Handelsregister: Amtsgericht München HRB 153243
Geschaeftsführer:  Mark Hegarty, Charlie Peters, Michael Cunningham, Charles Cachera


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Q about http management api

Jason T. Greene


Sent from my iPhone

On Apr 2, 2012, at 4:37 AM, "Heiko W.Rupp" <[hidden email]> wrote:

>> From time to time I see
>
> 405 errors
>
> 11:16:10,103 DEBUG [ASConnection] We got a 405 for url http://127.0.0.1:49990/management and operation Operation{operation='read-attribute', address=Address{path: }, additionalProperties={name=launch-type, include-defaults=true}}, method=POST
>
>            conn = (HttpURLConnection) url.openConnection();
>            conn.setDoOutput(true);
>            conn.setRequestMethod("POST");
>            conn.addRequestProperty("Content-Type", "application/json");
>            conn.addRequestProperty("Accept", "application/json");
>
> My understanding is that those only should show when content type is wrong. Looking at the sources I see that they
> may happen
> - on OPTIONS method (which we don't do)
> - for other contexts that only support GET ( like / )
>
> Any idea what may go wrong here?

It could also be cross-site restrictions were violated (Origin header).



>
> And then for requests for stuff that is e.g. not deployed , the API returns "internal server error" 500,
>
> 11:16:15,370 ERROR [ASConnection] Operation{operation='read-resource', address=Address{path: subsystem=connector}, additionalProperties={include-defaults=true}} failed with 500 (Internal Server Error) - response body was [{"outcome" : "failed", "failure-description" : "JBAS014739: No handler for read-resource at address [(\"subsystem\" => \"connector\")]", "rolled-back" : true}].
>
> I think a 404 not found would be much more correct. Especially as it looks like URLConnections throw exceptions on 500
>   Heiko
>

404 means the URL isn't there, but it is there. This is the only way to indicate a post failure.

> --
> Reg. Adresse: Red Hat GmbH, Technopark II, Haus C,
> Werner-von-Siemens-Ring 14, D-85630 Grasbrunn
> Handelsregister: Amtsgericht München HRB 153243
> Geschaeftsführer:  Mark Hegarty, Charlie Peters, Michael Cunningham, Charles Cachera
>
>
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Q about http management api

Heiko W.Rupp

Am 02.04.2012 um 14:46 schrieb Jason Greene:
>> 11:16:10,103 DEBUG [ASConnection] We got a 405 for url http://127.0.0.1:49990/management and operation Operation{operation='read-attribute', address=Address{path: }, additionalProperties={name=launch-type, include-defaults=true}}, method=POST

I tracked it down to

This is actually this is a 307 while the domain call back handler is not ready.  So it sends a redirect to
/error/index.html where the url connection is then a POST to, which is forbidden by AS (only GET supported)
and thus I get the 405 on /error/index.html

Darran said that the 307 should only happen with no management user installed at all.

--
Reg. Adresse: Red Hat GmbH, Technopark II, Haus C,
Werner-von-Siemens-Ring 14, D-85630 Grasbrunn
Handelsregister: Amtsgericht München HRB 153243
Geschaeftsführer:  Mark Hegarty, Charlie Peters, Michael Cunningham, Charles Cachera


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev