You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2017/03/19 05:58:42 UTC

[FlexJS] HTTP status text

Hi,

Using HTTPServer on the JS side it’s quite difficult to diagnose issues when you do get responses other than  200 OKs. The io errors and security errors are only supported on the AS side in that class.

One of Adobe’s server side products likes returning 500 errors for just about everything, iincluding user authentication issues which is a little less than helpful.

One way to work around this is to get access to the HTTP status text so you have some context to what the error was. Any other suggestions?

Thanks,
Justin


Re: [FlexJS] HTTP status text

Posted by Harbs <ha...@gmail.com>.
Welcome to the joys of JS development… ;-)

> On Mar 19, 2017, at 11:37 AM, Justin Mclean <ju...@classsoftware.com> wrote:
> 
> HI,
> 
>> If there’s something in the body of the response, you should be able to get it from the hxr.
> 
> Sadly there’s no content in the body that's useful - it just contains generic “An error has occurred” information.
> 
> Thanks,
> Justin


Re: [FlexJS] HTTP status text

Posted by Justin Mclean <ju...@classsoftware.com>.
HI,

> If there’s something in the body of the response, you should be able to get it from the hxr.

Sadly there’s no content in the body that's useful - it just contains generic “An error has occurred” information.

Thanks,
Justin

Re: [FlexJS] HTTP status text

Posted by Harbs <ha...@gmail.com>.
If there’s something in the body of the response, you should be able to get it from the hxr.

> On Mar 19, 2017, at 11:32 AM, Justin Mclean <ju...@classsoftware.com> wrote:
> 
> Hi,
> 
> Perhaps an example will help showing this better. The server I’m talking to gives:
> Status Code:500 The current user is not authorized to invoke this method.
> 
> But you can also get errors like this:
> Status Code:500 The PROFILEID parameter to the logout function is required but was not passed in.
> 
> Trying to distinguish the "user is not authorized” issue vs the other errors isn’t easy without access to the status text.
> 
> For a valid request you normally get:
> Status Code:200 OK
> 
> Thanks,
> Justin


Re: [FlexJS] HTTP status text

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> Sounds useful.  What is the SWF equivalent?  Would the same text show up
> in IOError or SecurityError?

As far as I can see there no easy way to get at the status text on AS only the status code.

There may be a way [1] use web sockets but then again it looks like this bug [2] may stop you from getting useful information. Not sure if that been fixed or not.

Thanks,
Justin

1. http://www.robsondesign.com/blog/index.php/2009/04/16/flex-flash-and-http-status-codes/ <http://www.robsondesign.com/blog/index.php/2009/04/16/flex-flash-and-http-status-codes/>
2. https://web.archive.org/web/20090222144905/http://bugs.adobe.com/jira/browse/SDK-11841 <http://bugs.adobe.com/jira/browse/SDK-11841>

Re: [FlexJS] HTTP status text

Posted by Alex Harui <ah...@adobe.com>.
Sounds useful.  What is the SWF equivalent?  Would the same text show up
in IOError or SecurityError?

-Alex

On 3/19/17, 2:32 AM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>Perhaps an example will help showing this better. The server I’m talking
>to gives:
>Status Code:500 The current user is not authorized to invoke this method.
>
>But you can also get errors like this:
>Status Code:500 The PROFILEID parameter to the logout function is
>required but was not passed in.
>
>Trying to distinguish the "user is not authorized” issue vs the other
>errors isn’t easy without access to the status text.
>
>For a valid request you normally get:
>Status Code:200 OK
>
>Thanks,
>Justin


Re: [FlexJS] HTTP status text

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

Perhaps an example will help showing this better. The server I’m talking to gives:
Status Code:500 The current user is not authorized to invoke this method.

But you can also get errors like this:
Status Code:500 The PROFILEID parameter to the logout function is required but was not passed in.

Trying to distinguish the "user is not authorized” issue vs the other errors isn’t easy without access to the status text.

For a valid request you normally get:
Status Code:200 OK

Thanks,
Justin

Re: [FlexJS] HTTP status text

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> I don’t know what you mean. It has error events with the status code on the JS side. I use it all the time.

The status code come through fine just not the status text. The AS side has additional events ie IOErrorEvent.IO_ERROR and SecurityErrorEvent.SECURITY_ERROR for instance that may give you a little more info.

Some servers don’t provide the correct status codes (like 401, 403 etc) and just return 500. There’s additional information in the status text that can help work out what’s going on if you can get at it.

Thanks,
Justin


Re: [FlexJS] HTTP status text

Posted by Harbs <ha...@gmail.com>.
I don’t know what you mean. It has error events with the status code on the JS side. I use it all the time.

> On Mar 19, 2017, at 9:31 AM, Justin Mclean <ju...@classsoftware.com> wrote:
> 
> Hi,
> 
>> Take a look at URLBinaryLoader (which is the network class I’m using pretty much exclusively). The main logic is in URLStream which handles all kinds of responses. HTTPService can probably be improved using similar logic.
> 
> I looked ta that it seem it can only do on the AS side not on the JS side which is what I need.
> 
> Thanks,
> Justin


Re: [FlexJS] HTTP status text

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> Take a look at URLBinaryLoader (which is the network class I’m using pretty much exclusively). The main logic is in URLStream which handles all kinds of responses. HTTPService can probably be improved using similar logic.

I looked ta that it seem it can only do on the AS side not on the JS side which is what I need.

Thanks,
Justin

Re: [FlexJS] HTTP status text

Posted by Harbs <ha...@gmail.com>.
Take a look at URLBinaryLoader (which is the network class I’m using pretty much exclusively). The main logic is in URLStream which handles all kinds of responses. HTTPService can probably be improved using similar logic.

Harbs

> On Mar 19, 2017, at 7:58 AM, Justin Mclean <ju...@classsoftware.com> wrote:
> 
> Hi,
> 
> Using HTTPServer on the JS side it’s quite difficult to diagnose issues when you do get responses other than  200 OKs. The io errors and security errors are only supported on the AS side in that class.
> 
> One of Adobe’s server side products likes returning 500 errors for just about everything, iincluding user authentication issues which is a little less than helpful.
> 
> One way to work around this is to get access to the HTTP status text so you have some context to what the error was. Any other suggestions?
> 
> Thanks,
> Justin
>