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 (<
[email protected]>) 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 <[email protected]>
> 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 <[email protected]> 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

Reply via email to