You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Carlos Rovira <ca...@apache.org> on 2020/08/24 10:10:10 UTC

URLRequest - BrowserWindow - HttpService

Hi,

just responded to this question in SOF:

https://stackoverflow.com/questions/63546819/recode-flex-urlrequest-and-navigatetourl-form-emulation-to-royale-js/63558866#63558866

since I really don't use URLRequest, I got the info from various emails and
urls, so hope others can ensure all is ok.

I think we have a problem with no POST support in BrowserWindow? Although
is done in HTTPService I think is confusing for users and most of the time
unusable. We had many threads over the years with similar problem ( I think
I saw 3 or 4)

@Andrew Wetmore <co...@gmail.com> you can have this info (if rest think
is accurate) and add it to royale-docs?

----- My Response in SOF is this:

equivalente code for `URLRequest`:

```actionscript
var u:URLRequest = new URLRequest("http://domain.foo");
navigateToURL(u,"_blank");
```

in Apache Royale is `BrowserWindow`:

```actionscript
import org.apache.royale.core.BrowserWindow;

var u:String = "http://domain.foo";
BrowserWindow.open(u, "_blank");
```

To pass variables you need to do via `GET`method: `"
http://domain.foo?variable=" + key`.

To use `POST` method use `HTTPService` class from `Network` SWC instead:

```actionscript
import org.apache.royale.net.HTTPConstants;
import org.apache.royale.net.HTTPService;
import org.apache.royale.net.URLVariables;

// add the variables to send
var urlVars:URLVariables = new URLVariables();
urlVars.set("variable", key);

// create the httpservice instance
var service:HTTPService = new HTTPService();
service.url = "http://domain.foo";
service.method = HTTPConstants.POST;
service.addEventListener("complete", resultCallback);
service.addEventListener("ioError", faultCallback);

// add the variables
service.contentData = urlVars;

// trigger the service
service.send();
```

Optionally in case you need to deal with CORS you can add
`CORSCredentialsBead` bead to the `HTTPService`:

```actionscript
service.addBead(new CORSCredentialsBead(true));
```

(Note: code is untested, please report if all is ok so we can improve this
response and code snippet, thanks)

-- 
Carlos Rovira
http://about.me/carlosrovira

Re: URLRequest - BrowserWindow - HttpService

Posted by Carlos Rovira <ca...@apache.org>.
Hi, ok all is now more clear with your confirmations. I think after many
email threads, I was confused by Andrew's comment and also by SOF question.
So I think response is ok and covers all cases.
Thanks!

El lun., 24 ago. 2020 a las 13:01, Harbs (<ha...@gmail.com>) escribió:

> I’m not following here.
> BrowserWindow is to open a brwoser window. That is by definition GEt and
> not POST. I don’t understand how POST got associated with that.
>
> > On Aug 24, 2020, at 1:54 PM, Piotr Zarzycki <pi...@gmail.com>
> wrote:
> >
> > Carlos,
> >
> > We are using POST HTTPService from day 1 of our MyAccount application in
> > Prominic wich was June 2019. In fact it was the very first requirements
> > which was checked before we have decided port Flex app to Royale. I
> > remember there was maybe 2 issues over that time, but everything was
> fixed
> > and working perfectly.
> >
> > I don't know if BrowserWindows usage with GET is the only way. I don't
> > truly understand why BrowserWindow is even in play instead HTTPService.
> >
> > pon., 24 sie 2020 o 12:48 Carlos Rovira <ca...@apache.org>
> > napisał(a):
> >
> >> Hi Piotr,
> >>
> >> I think I read some post in another thread from Andrew Frost about
> support
> >> POST, so I suppose that was still missing far beyond HTTPService. Since
> I
> >> used to go with HTTPService/RemoteObject and don't use other formats, I
> >> guess others like you know about the limitations. In other words, if you
> >> think it is all ok and GET is the only way to go with BrowserWindow, I
> >> think we're ok.
> >>
> >> El lun., 24 ago. 2020 a las 12:30, Piotr Zarzycki (<
> >> piotrzarzycki21@gmail.com>) escribió:
> >>
> >>> Hi Carlos,
> >>>
> >>> Actually I'm not sure what he is trying to achieve. You have responded
> to
> >>> him correctly in case of Post, but in case of GET he can also use
> >>> HTTPService, instead do stuff in his way.
> >>>
> >>> In the moment when you do BrowserWindow.open(u, "_blank"); it is the
> >> moment
> >>> where we are loosing control - it is on the browser/server sight what
> is
> >>> happening next.
> >>>
> >>> Thanks,
> >>> Piotr
> >>>
> >>> pon., 24 sie 2020 o 12:10 Carlos Rovira <ca...@apache.org>
> >>> napisał(a):
> >>>
> >>>> Hi,
> >>>>
> >>>> just responded to this question in SOF:
> >>>>
> >>>>
> >>>>
> >>>
> >>
> https://stackoverflow.com/questions/63546819/recode-flex-urlrequest-and-navigatetourl-form-emulation-to-royale-js/63558866#63558866
> >>>>
> >>>> since I really don't use URLRequest, I got the info from various
> emails
> >>> and
> >>>> urls, so hope others can ensure all is ok.
> >>>>
> >>>> I think we have a problem with no POST support in BrowserWindow?
> >> Although
> >>>> is done in HTTPService I think is confusing for users and most of the
> >>> time
> >>>> unusable. We had many threads over the years with similar problem ( I
> >>> think
> >>>> I saw 3 or 4)
> >>>>
> >>>> @Andrew Wetmore <co...@gmail.com> you can have this info (if rest
> >>>> think
> >>>> is accurate) and add it to royale-docs?
> >>>>
> >>>> ----- My Response in SOF is this:
> >>>>
> >>>> equivalente code for `URLRequest`:
> >>>>
> >>>> ```actionscript
> >>>> var u:URLRequest = new URLRequest("http://domain.foo");
> >>>> navigateToURL(u,"_blank");
> >>>> ```
> >>>>
> >>>> in Apache Royale is `BrowserWindow`:
> >>>>
> >>>> ```actionscript
> >>>> import org.apache.royale.core.BrowserWindow;
> >>>>
> >>>> var u:String = "http://domain.foo";
> >>>> BrowserWindow.open(u, "_blank");
> >>>> ```
> >>>>
> >>>> To pass variables you need to do via `GET`method: `"
> >>>> http://domain.foo?variable=" + key`.
> >>>>
> >>>> To use `POST` method use `HTTPService` class from `Network` SWC
> >> instead:
> >>>>
> >>>> ```actionscript
> >>>> import org.apache.royale.net.HTTPConstants;
> >>>> import org.apache.royale.net.HTTPService;
> >>>> import org.apache.royale.net.URLVariables;
> >>>>
> >>>> // add the variables to send
> >>>> var urlVars:URLVariables = new URLVariables();
> >>>> urlVars.set("variable", key);
> >>>>
> >>>> // create the httpservice instance
> >>>> var service:HTTPService = new HTTPService();
> >>>> service.url = "http://domain.foo";
> >>>> service.method = HTTPConstants.POST;
> >>>> service.addEventListener("complete", resultCallback);
> >>>> service.addEventListener("ioError", faultCallback);
> >>>>
> >>>> // add the variables
> >>>> service.contentData = urlVars;
> >>>>
> >>>> // trigger the service
> >>>> service.send();
> >>>> ```
> >>>>
> >>>> Optionally in case you need to deal with CORS you can add
> >>>> `CORSCredentialsBead` bead to the `HTTPService`:
> >>>>
> >>>> ```actionscript
> >>>> service.addBead(new CORSCredentialsBead(true));
> >>>> ```
> >>>>
> >>>> (Note: code is untested, please report if all is ok so we can improve
> >>> this
> >>>> response and code snippet, thanks)
> >>>>
> >>>> --
> >>>> Carlos Rovira
> >>>> http://about.me/carlosrovira
> >>>>
> >>>
> >>>
> >>> --
> >>>
> >>> Piotr Zarzycki
> >>>
> >>
> >>
> >> --
> >> Carlos Rovira
> >> http://about.me/carlosrovira
> >>
> >
> >
> > --
> >
> > Piotr Zarzycki
>
>

-- 
Carlos Rovira
http://about.me/carlosrovira

Re: URLRequest - BrowserWindow - HttpService

Posted by Harbs <ha...@gmail.com>.
I’m not following here.
BrowserWindow is to open a brwoser window. That is by definition GEt and not POST. I don’t understand how POST got associated with that.

> On Aug 24, 2020, at 1:54 PM, Piotr Zarzycki <pi...@gmail.com> wrote:
> 
> Carlos,
> 
> We are using POST HTTPService from day 1 of our MyAccount application in
> Prominic wich was June 2019. In fact it was the very first requirements
> which was checked before we have decided port Flex app to Royale. I
> remember there was maybe 2 issues over that time, but everything was fixed
> and working perfectly.
> 
> I don't know if BrowserWindows usage with GET is the only way. I don't
> truly understand why BrowserWindow is even in play instead HTTPService.
> 
> pon., 24 sie 2020 o 12:48 Carlos Rovira <ca...@apache.org>
> napisał(a):
> 
>> Hi Piotr,
>> 
>> I think I read some post in another thread from Andrew Frost about support
>> POST, so I suppose that was still missing far beyond HTTPService. Since I
>> used to go with HTTPService/RemoteObject and don't use other formats, I
>> guess others like you know about the limitations. In other words, if you
>> think it is all ok and GET is the only way to go with BrowserWindow, I
>> think we're ok.
>> 
>> El lun., 24 ago. 2020 a las 12:30, Piotr Zarzycki (<
>> piotrzarzycki21@gmail.com>) escribió:
>> 
>>> Hi Carlos,
>>> 
>>> Actually I'm not sure what he is trying to achieve. You have responded to
>>> him correctly in case of Post, but in case of GET he can also use
>>> HTTPService, instead do stuff in his way.
>>> 
>>> In the moment when you do BrowserWindow.open(u, "_blank"); it is the
>> moment
>>> where we are loosing control - it is on the browser/server sight what is
>>> happening next.
>>> 
>>> Thanks,
>>> Piotr
>>> 
>>> pon., 24 sie 2020 o 12:10 Carlos Rovira <ca...@apache.org>
>>> napisał(a):
>>> 
>>>> Hi,
>>>> 
>>>> just responded to this question in SOF:
>>>> 
>>>> 
>>>> 
>>> 
>> https://stackoverflow.com/questions/63546819/recode-flex-urlrequest-and-navigatetourl-form-emulation-to-royale-js/63558866#63558866
>>>> 
>>>> since I really don't use URLRequest, I got the info from various emails
>>> and
>>>> urls, so hope others can ensure all is ok.
>>>> 
>>>> I think we have a problem with no POST support in BrowserWindow?
>> Although
>>>> is done in HTTPService I think is confusing for users and most of the
>>> time
>>>> unusable. We had many threads over the years with similar problem ( I
>>> think
>>>> I saw 3 or 4)
>>>> 
>>>> @Andrew Wetmore <co...@gmail.com> you can have this info (if rest
>>>> think
>>>> is accurate) and add it to royale-docs?
>>>> 
>>>> ----- My Response in SOF is this:
>>>> 
>>>> equivalente code for `URLRequest`:
>>>> 
>>>> ```actionscript
>>>> var u:URLRequest = new URLRequest("http://domain.foo");
>>>> navigateToURL(u,"_blank");
>>>> ```
>>>> 
>>>> in Apache Royale is `BrowserWindow`:
>>>> 
>>>> ```actionscript
>>>> import org.apache.royale.core.BrowserWindow;
>>>> 
>>>> var u:String = "http://domain.foo";
>>>> BrowserWindow.open(u, "_blank");
>>>> ```
>>>> 
>>>> To pass variables you need to do via `GET`method: `"
>>>> http://domain.foo?variable=" + key`.
>>>> 
>>>> To use `POST` method use `HTTPService` class from `Network` SWC
>> instead:
>>>> 
>>>> ```actionscript
>>>> import org.apache.royale.net.HTTPConstants;
>>>> import org.apache.royale.net.HTTPService;
>>>> import org.apache.royale.net.URLVariables;
>>>> 
>>>> // add the variables to send
>>>> var urlVars:URLVariables = new URLVariables();
>>>> urlVars.set("variable", key);
>>>> 
>>>> // create the httpservice instance
>>>> var service:HTTPService = new HTTPService();
>>>> service.url = "http://domain.foo";
>>>> service.method = HTTPConstants.POST;
>>>> service.addEventListener("complete", resultCallback);
>>>> service.addEventListener("ioError", faultCallback);
>>>> 
>>>> // add the variables
>>>> service.contentData = urlVars;
>>>> 
>>>> // trigger the service
>>>> service.send();
>>>> ```
>>>> 
>>>> Optionally in case you need to deal with CORS you can add
>>>> `CORSCredentialsBead` bead to the `HTTPService`:
>>>> 
>>>> ```actionscript
>>>> service.addBead(new CORSCredentialsBead(true));
>>>> ```
>>>> 
>>>> (Note: code is untested, please report if all is ok so we can improve
>>> this
>>>> response and code snippet, thanks)
>>>> 
>>>> --
>>>> Carlos Rovira
>>>> http://about.me/carlosrovira
>>>> 
>>> 
>>> 
>>> --
>>> 
>>> Piotr Zarzycki
>>> 
>> 
>> 
>> --
>> Carlos Rovira
>> http://about.me/carlosrovira
>> 
> 
> 
> -- 
> 
> Piotr Zarzycki


Re: URLRequest - BrowserWindow - HttpService

Posted by Piotr Zarzycki <pi...@gmail.com>.
Carlos,

We are using POST HTTPService from day 1 of our MyAccount application in
Prominic wich was June 2019. In fact it was the very first requirements
which was checked before we have decided port Flex app to Royale. I
remember there was maybe 2 issues over that time, but everything was fixed
and working perfectly.

I don't know if BrowserWindows usage with GET is the only way. I don't
truly understand why BrowserWindow is even in play instead HTTPService.

pon., 24 sie 2020 o 12:48 Carlos Rovira <ca...@apache.org>
napisał(a):

> Hi Piotr,
>
> I think I read some post in another thread from Andrew Frost about support
> POST, so I suppose that was still missing far beyond HTTPService. Since I
> used to go with HTTPService/RemoteObject and don't use other formats, I
> guess others like you know about the limitations. In other words, if you
> think it is all ok and GET is the only way to go with BrowserWindow, I
> think we're ok.
>
> El lun., 24 ago. 2020 a las 12:30, Piotr Zarzycki (<
> piotrzarzycki21@gmail.com>) escribió:
>
> > Hi Carlos,
> >
> > Actually I'm not sure what he is trying to achieve. You have responded to
> > him correctly in case of Post, but in case of GET he can also use
> > HTTPService, instead do stuff in his way.
> >
> > In the moment when you do BrowserWindow.open(u, "_blank"); it is the
> moment
> > where we are loosing control - it is on the browser/server sight what is
> > happening next.
> >
> > Thanks,
> > Piotr
> >
> > pon., 24 sie 2020 o 12:10 Carlos Rovira <ca...@apache.org>
> > napisał(a):
> >
> > > Hi,
> > >
> > > just responded to this question in SOF:
> > >
> > >
> > >
> >
> https://stackoverflow.com/questions/63546819/recode-flex-urlrequest-and-navigatetourl-form-emulation-to-royale-js/63558866#63558866
> > >
> > > since I really don't use URLRequest, I got the info from various emails
> > and
> > > urls, so hope others can ensure all is ok.
> > >
> > > I think we have a problem with no POST support in BrowserWindow?
> Although
> > > is done in HTTPService I think is confusing for users and most of the
> > time
> > > unusable. We had many threads over the years with similar problem ( I
> > think
> > > I saw 3 or 4)
> > >
> > > @Andrew Wetmore <co...@gmail.com> you can have this info (if rest
> > > think
> > > is accurate) and add it to royale-docs?
> > >
> > > ----- My Response in SOF is this:
> > >
> > > equivalente code for `URLRequest`:
> > >
> > > ```actionscript
> > > var u:URLRequest = new URLRequest("http://domain.foo");
> > > navigateToURL(u,"_blank");
> > > ```
> > >
> > > in Apache Royale is `BrowserWindow`:
> > >
> > > ```actionscript
> > > import org.apache.royale.core.BrowserWindow;
> > >
> > > var u:String = "http://domain.foo";
> > > BrowserWindow.open(u, "_blank");
> > > ```
> > >
> > > To pass variables you need to do via `GET`method: `"
> > > http://domain.foo?variable=" + key`.
> > >
> > > To use `POST` method use `HTTPService` class from `Network` SWC
> instead:
> > >
> > > ```actionscript
> > > import org.apache.royale.net.HTTPConstants;
> > > import org.apache.royale.net.HTTPService;
> > > import org.apache.royale.net.URLVariables;
> > >
> > > // add the variables to send
> > > var urlVars:URLVariables = new URLVariables();
> > > urlVars.set("variable", key);
> > >
> > > // create the httpservice instance
> > > var service:HTTPService = new HTTPService();
> > > service.url = "http://domain.foo";
> > > service.method = HTTPConstants.POST;
> > > service.addEventListener("complete", resultCallback);
> > > service.addEventListener("ioError", faultCallback);
> > >
> > > // add the variables
> > > service.contentData = urlVars;
> > >
> > > // trigger the service
> > > service.send();
> > > ```
> > >
> > > Optionally in case you need to deal with CORS you can add
> > > `CORSCredentialsBead` bead to the `HTTPService`:
> > >
> > > ```actionscript
> > > service.addBead(new CORSCredentialsBead(true));
> > > ```
> > >
> > > (Note: code is untested, please report if all is ok so we can improve
> > this
> > > response and code snippet, thanks)
> > >
> > > --
> > > Carlos Rovira
> > > http://about.me/carlosrovira
> > >
> >
> >
> > --
> >
> > Piotr Zarzycki
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>


-- 

Piotr Zarzycki

Re: URLRequest - BrowserWindow - HttpService

Posted by Carlos Rovira <ca...@apache.org>.
Hi Piotr,

I think I read some post in another thread from Andrew Frost about support
POST, so I suppose that was still missing far beyond HTTPService. Since I
used to go with HTTPService/RemoteObject and don't use other formats, I
guess others like you know about the limitations. In other words, if you
think it is all ok and GET is the only way to go with BrowserWindow, I
think we're ok.

El lun., 24 ago. 2020 a las 12:30, Piotr Zarzycki (<
piotrzarzycki21@gmail.com>) escribió:

> Hi Carlos,
>
> Actually I'm not sure what he is trying to achieve. You have responded to
> him correctly in case of Post, but in case of GET he can also use
> HTTPService, instead do stuff in his way.
>
> In the moment when you do BrowserWindow.open(u, "_blank"); it is the moment
> where we are loosing control - it is on the browser/server sight what is
> happening next.
>
> Thanks,
> Piotr
>
> pon., 24 sie 2020 o 12:10 Carlos Rovira <ca...@apache.org>
> napisał(a):
>
> > Hi,
> >
> > just responded to this question in SOF:
> >
> >
> >
> https://stackoverflow.com/questions/63546819/recode-flex-urlrequest-and-navigatetourl-form-emulation-to-royale-js/63558866#63558866
> >
> > since I really don't use URLRequest, I got the info from various emails
> and
> > urls, so hope others can ensure all is ok.
> >
> > I think we have a problem with no POST support in BrowserWindow? Although
> > is done in HTTPService I think is confusing for users and most of the
> time
> > unusable. We had many threads over the years with similar problem ( I
> think
> > I saw 3 or 4)
> >
> > @Andrew Wetmore <co...@gmail.com> you can have this info (if rest
> > think
> > is accurate) and add it to royale-docs?
> >
> > ----- My Response in SOF is this:
> >
> > equivalente code for `URLRequest`:
> >
> > ```actionscript
> > var u:URLRequest = new URLRequest("http://domain.foo");
> > navigateToURL(u,"_blank");
> > ```
> >
> > in Apache Royale is `BrowserWindow`:
> >
> > ```actionscript
> > import org.apache.royale.core.BrowserWindow;
> >
> > var u:String = "http://domain.foo";
> > BrowserWindow.open(u, "_blank");
> > ```
> >
> > To pass variables you need to do via `GET`method: `"
> > http://domain.foo?variable=" + key`.
> >
> > To use `POST` method use `HTTPService` class from `Network` SWC instead:
> >
> > ```actionscript
> > import org.apache.royale.net.HTTPConstants;
> > import org.apache.royale.net.HTTPService;
> > import org.apache.royale.net.URLVariables;
> >
> > // add the variables to send
> > var urlVars:URLVariables = new URLVariables();
> > urlVars.set("variable", key);
> >
> > // create the httpservice instance
> > var service:HTTPService = new HTTPService();
> > service.url = "http://domain.foo";
> > service.method = HTTPConstants.POST;
> > service.addEventListener("complete", resultCallback);
> > service.addEventListener("ioError", faultCallback);
> >
> > // add the variables
> > service.contentData = urlVars;
> >
> > // trigger the service
> > service.send();
> > ```
> >
> > Optionally in case you need to deal with CORS you can add
> > `CORSCredentialsBead` bead to the `HTTPService`:
> >
> > ```actionscript
> > service.addBead(new CORSCredentialsBead(true));
> > ```
> >
> > (Note: code is untested, please report if all is ok so we can improve
> this
> > response and code snippet, thanks)
> >
> > --
> > Carlos Rovira
> > http://about.me/carlosrovira
> >
>
>
> --
>
> Piotr Zarzycki
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Re: URLRequest - BrowserWindow - HttpService

Posted by Piotr Zarzycki <pi...@gmail.com>.
Hi Carlos,

Actually I'm not sure what he is trying to achieve. You have responded to
him correctly in case of Post, but in case of GET he can also use
HTTPService, instead do stuff in his way.

In the moment when you do BrowserWindow.open(u, "_blank"); it is the moment
where we are loosing control - it is on the browser/server sight what is
happening next.

Thanks,
Piotr

pon., 24 sie 2020 o 12:10 Carlos Rovira <ca...@apache.org>
napisał(a):

> Hi,
>
> just responded to this question in SOF:
>
>
> https://stackoverflow.com/questions/63546819/recode-flex-urlrequest-and-navigatetourl-form-emulation-to-royale-js/63558866#63558866
>
> since I really don't use URLRequest, I got the info from various emails and
> urls, so hope others can ensure all is ok.
>
> I think we have a problem with no POST support in BrowserWindow? Although
> is done in HTTPService I think is confusing for users and most of the time
> unusable. We had many threads over the years with similar problem ( I think
> I saw 3 or 4)
>
> @Andrew Wetmore <co...@gmail.com> you can have this info (if rest
> think
> is accurate) and add it to royale-docs?
>
> ----- My Response in SOF is this:
>
> equivalente code for `URLRequest`:
>
> ```actionscript
> var u:URLRequest = new URLRequest("http://domain.foo");
> navigateToURL(u,"_blank");
> ```
>
> in Apache Royale is `BrowserWindow`:
>
> ```actionscript
> import org.apache.royale.core.BrowserWindow;
>
> var u:String = "http://domain.foo";
> BrowserWindow.open(u, "_blank");
> ```
>
> To pass variables you need to do via `GET`method: `"
> http://domain.foo?variable=" + key`.
>
> To use `POST` method use `HTTPService` class from `Network` SWC instead:
>
> ```actionscript
> import org.apache.royale.net.HTTPConstants;
> import org.apache.royale.net.HTTPService;
> import org.apache.royale.net.URLVariables;
>
> // add the variables to send
> var urlVars:URLVariables = new URLVariables();
> urlVars.set("variable", key);
>
> // create the httpservice instance
> var service:HTTPService = new HTTPService();
> service.url = "http://domain.foo";
> service.method = HTTPConstants.POST;
> service.addEventListener("complete", resultCallback);
> service.addEventListener("ioError", faultCallback);
>
> // add the variables
> service.contentData = urlVars;
>
> // trigger the service
> service.send();
> ```
>
> Optionally in case you need to deal with CORS you can add
> `CORSCredentialsBead` bead to the `HTTPService`:
>
> ```actionscript
> service.addBead(new CORSCredentialsBead(true));
> ```
>
> (Note: code is untested, please report if all is ok so we can improve this
> response and code snippet, thanks)
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>


-- 

Piotr Zarzycki