Hi,
I already switch to qx.io.request.Xhr. I need to use POST, PUT and DELETE
request.
Actualy, I added ResponseHeader to my server:
responseContext.getHeaders().putSingle("Access-Control-Allow-Origin",
origin);
responseContext.getHeaders().putSingle("Access-Control-Allow-Methods",
"DELETE, GET, HEAD, OPTIONS, POST, PUT");
responseContext.getHeaders().putSingle("Content-Type",
"application/json");
responseContext.getHeaders().putSingle("Access-Control-Allow-Headers",
"Application-Key, Session-Id");
I can make request but if I add Customs Headers I have error:
XMLHttpRequest cannot load
http://mail.lanauco.com:11162/services/secured/logout?nocache=136153859699
0. Origin http://mail.lanauco.com:8080 is not allowed by
Access-Control-Allow-Origin.
So, I have no other option to send custom data to header? It's the same
policy on mobile apps?
Thank you !
Marc-André Dubois
[email protected]
Programmeur-Analyste
-----Message d'origine-----
De : Richard Sternagel [mailto:[email protected]]
Envoyé : 22 février 2013 06:58
À : qooxdoo Development
Objet : Re: [qooxdoo-devel] Jsonp and Xhr request - Request Header
Hi Marc-André,
try switching to "qx.io.request.Xhr" [1]. But remember that your HTTP
Requests are then subject to the same-origin policy.
At first I thought you could use "CORS" aka "Cross-site HTTP requests"
but apparently you can't add custom headers there, too [2].
Unfortunately these restrictions are part of the underlying technologies
and not of qooxdoo.
So afaik you:
a) have to use XHR or
b) send your header values as GET params.
Regards
Richard
[1] http://manual.qooxdoo.org/devel/pages/communication/request_io.html
[2]
https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#Simple_r
equests
Am 21.02.13 20:14, schrieb Marc-André Dubois:
> Ok I undestand the problem:
>
> /**
> * Appends a query parameter to URL.
> *
> * This method exists for compatibility reasons. The script
transport
> * does not support request headers. However, many services parse
> query
> * parameters like request headers.
> *
> * Note: The request must be initialized before using this method.
> *
> * @param key {String}
> * The name of the header whose value is to be set.
> * @param value {String}
> * The value to set as the body of the header.
> * @return {qx.bom.request.Script} Self for chaining.
> */
>
> But my server try to read customs params in header. I need this param
> to process my request. How can I force this param in the request header?
>
> Marc-André Dubois
> [email protected]
> Programmeur-Analyste
>
>
> -----Message d'origine-----
> De : Richard Sternagel [mailto:[email protected]]
> Envoyé : 21 février 2013 08:14
> À : qooxdoo Development
> Objet : Re: [qooxdoo-devel] Jsonp and Xhr request - Request Header
>
> Hi Marc-André,
>
> after some digging I found the answer within the JSDoc commments of
> "setRequestHeader()" from "qx.bom.request.Script".
>
> https://github.com/qooxdoo/qooxdoo/blob/master/framework/source/class/
> qx/b
> om/request/Script.js#L193
>
> Regards
> Richard
>
> Am 20.02.13 19:14, schrieb Marc-André Dubois:
>> I try to add parameters to RequestHeader
>>
>> This is the part of my code where make my request :
>>
>> var req = new qx.io.request.Jsonp();
>>
>> req.setUrl(url);
>>
>> req.setCache(false);
>>
>> req.setCallbackName('callback');
>>
>> req.setCallbackParam('callback');
>>
>> console.log("URL : " + url);
>>
>> if(secured){
>>
>>
>> req.setRequestHeader("Application-Key",this.getApplicationKey());
>>
>>
>> req.setRequestHeader("Session-Id",this.getSessionId());
>>
>> }
>>
>> if(param){
>>
>> var buildedParam =
>> this.__buildRequestParam(param);
>>
>> console.log("builded Param = : " +
>> buildedParam);
>>
>> req.setRequestData(buildedParam);
>>
>> }
>>
>> req.addListener("success", success, this);
>>
>> req.addListener("error", error, this);
>>
>> req.send();
>>
>> I set parameters with « setRequestHeader » method but when I get my
>> RequestHeaderData on chrome I have this :
>>
>> *Request Header*
>>
>> GET
>> /services/secured/logout?nocache=1361383565534&callback=callback&Appl
>> i
>> cation-Key=88363a0d-81fe-48f5-9e9f-23b01cab118e&Session-Id=e4c6ce3c-e
>> 3
>> f3-40a9-95d4-36835a17e9a9
>> HTTP/1.1 Host: localhost:11162 Connection: keep-alive Accept: */*
>> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17
>> (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 Accept-Encoding:
>> gzip,deflate,sdch Accept-Language:
>> fr,fr-FR;q=0.8,en-US;q=0.6,en;q=0.4
>> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
>>
>> Query
>>
>> *Query String Parameters*
>>
>> nocache:1361383565534
>>
>> callback:callback
>>
>> Application-Key:88363a0d-81fe-48f5-9e9f-23b01cab118e
>>
>> Session-Id:e4c6ce3c-e3f3-40a9-95d4-36835a17e9a9
>>
>> Why my param is in QueryParam and not in RequestHeader
>>
>> *Marc-André Dubois*
>> [email protected]_
>> Programmeur-Analyste
>>
>> Description : Lanauco_logo_couleur_long Signature
>>
>> 1.877.881.5151 p.261 (sans frais).
>>
>> 450.831.5151 p.261
>>
>> 450.839.1103 (Fax)
>>
>> Web : http://www.lanauco.com <http://www.lanauco.com/>
>>
>
>
> ----------------------------------------------------------------------
> ----
> ----
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics Download AppDynamics Lite
> for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
> ----------------------------------------------------------------------
> -------- Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics Download AppDynamics Lite
> for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
--------------------------------------------------------------------------
----
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite for
free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel