Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    XJSONDataSource Http Headers

    Using:
    SmartGWT 2.4 LGPL
    GWT 2.2
    Google Chrome

    Problem:
    I need to include a http header in my requests.
    I'm using XJSONDataSource, and in transformRequest method I'm including the following code:

    Map<String, String> headers = new LinkedHashMap<String, String>();
    headers.put("test", "something");
    dsRequest.setHttpHeaders(headers);
    dsRequest.setTransport(RPCTransport.XMLHTTPREQUEST);
    return super.transformRequest(dsRequest);

    When I see the received request, the header is not included. Am I doing something wrong?

    Thanks,
    agalvao

    #2
    This transport literally writes a <script> tag into the DOM. There is no way to include an HTTP header.

    Comment


      #3
      But, is there any way of sending http headers when using XJSONDataSource?

      Comment


        #4
        No, this is a fundamental browser limitation with cross-domain calls. Some more recent versions of browser support cross-domain xmlHttpRequests, but this will only work on those browsers.

        Comment

        Working...
        X