ICEfaces
  1. ICEfaces
  2. ICE-10294

Unable to access BridgeIt when page is first loaded using ajax (must be a GET)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Labels:
      None
    • Environment:
      jsf2 bridgeit mobi
    • Assignee Priority:
      P1
    • Workaround Exists:
      Yes
    • Workaround Description:
      load bridgeit.js on mobile-showcase.xhtml page for now.

      Description

      can only access bridgeit.js from a Get and not an XMLHttprequest (ajax).
      or get the following error:-

      XMLHttpRequest cannot load http://bridgeit.github.io/bridgeit.js/src/bridgeit.js?v=4_0_0_141001. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://10.18.39.137:8080' is therefore not allowed access.
      ......
      Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://bridgeit.github.io/bridgeit.js/src/bridgeit.js?v=4_0_0_141001'.
      1. Picture 1.png
        16 kB
      2. Picture 2.png
        49 kB

        Issue Links

          Activity

          Judy Guglielmin created issue -
          Judy Guglielmin made changes -
          Field Original Value New Value
          Assignee Ken Fyten [ ken.fyten ]
          Hide
          Ken Fyten added a comment -

          This can be tested by removing the "bridgeit.js" load from the showcase-mobile.xhtml page. Then it will attempt to load bridgeit.js using ajax techniques when you first select one of the native mobi demos (and will fail).

          Show
          Ken Fyten added a comment - This can be tested by removing the "bridgeit.js" load from the showcase-mobile.xhtml page. Then it will attempt to load bridgeit.js using ajax techniques when you first select one of the native mobi demos (and will fail).
          Ken Fyten made changes -
          Assignee Ken Fyten [ ken.fyten ] Mircea Toma [ mircea.toma ]
          Fix Version/s 4.0 [ 11382 ]
          Affects Version/s 4.0 [ 11382 ]
          Affects Version/s 4.0.BETA [ 10770 ]
          Assignee Priority P1 [ 10010 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #42678 Thu Oct 02 11:31:22 MDT 2014 judy.guglielmin ICE-9484 put splash back not in menu for now. used tag handlers to only include view contents if that view is selected. bridgeit workaround for ICE-10294 until that Jira is resolved. Minor styling modifications. Removed ace components where h components could be used instead.
          Files Changed
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/camcorder/camcorder-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/fetchcontact/fetchcontact-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/fieldset/fieldset-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/augmentedreality/augmentedreality-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/pagepanel/pagepanel.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/outputlist/list-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/viewsize/viewsize-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/fetchcontact/fetchcontact-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/camera/camera-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/pagepanel/pagepanel-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/cloudpush/cloudpush-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/showcase-mobile.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/microphone/microphone-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/cloudpush/cloudpush-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/sms/sms-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geolocation/geolocation-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/scan/scan-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/pagepanel/pagepanel-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/camera/camera-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/scan/scan-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/datespinner/date-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geolocation/geolocation-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/flipswitch/flip-switch-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/sms/sms-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/dataview/dataview-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/augmentedreality/augmentedreality-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/viewManager/viewmanager-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/viewsize/viewsize-desc.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/viewManager/viewmanager-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/camcorder/camcorder-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/dataview/dataview-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/fieldset/fieldset-example.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/outputlist/list-desc.xhtml
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #42680 Thu Oct 02 12:29:18 MDT 2014 judy.guglielmin ICE-9484 splash page now is in menu that ICE-10295 is resolved. Note that ICE-10294 still does not work correctly even with workaround as the js error causes the view content to not load.
          Files Changed
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/showcase-mobile.xhtml
          Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/example/mobi/viewmanager/ViewManagerBean.java
          Hide
          Ken Fyten added a comment -

          Note that the following attempts at an application-level workaround for this have failed:

          1. Trying to load the bridgeit.js directly in the main page fails to avoid the JS error when a native mobi component demo is selected.
          2. Using mandatoryResourceConfig to force load the bridgeit.js file on initial page load. Still logs the JS error when the native mobi component demo is selected, as I guess it still tries to load bridgeit.js again via ajax (shouldn't it be smart enough to know it's already loaded?)

          This is becoming a problem. Any idea why #2 doesn't work?

          Perhaps if the JS is successfully loaded via mandatoryResourceConfig, then the error on ajax update could be trapped and logged as warn or something but not break the app.?

          Show
          Ken Fyten added a comment - Note that the following attempts at an application-level workaround for this have failed: Trying to load the bridgeit.js directly in the main page fails to avoid the JS error when a native mobi component demo is selected. Using mandatoryResourceConfig to force load the bridgeit.js file on initial page load. Still logs the JS error when the native mobi component demo is selected, as I guess it still tries to load bridgeit.js again via ajax (shouldn't it be smart enough to know it's already loaded?) This is becoming a problem. Any idea why #2 doesn't work? Perhaps if the JS is successfully loaded via mandatoryResourceConfig, then the error on ajax update could be trapped and logged as warn or something but not break the app.?
          Hide
          Mircea Toma added a comment -

          The "No 'Access-Control-Allow-Origin' header is present on the requested resource." error is raised because the JS resource was requested from a different domain (bridgeit.github.io) than the one the page was loaded from (10.18.39.137). This is a restriction imposed by modern browsers for the AJAX requests.

          To solve this problem bridgeit.github.io server will need to send the proper CORS headers. Please see http://en.wikipedia.org/wiki/Cross-origin_resource_sharing .

          Show
          Mircea Toma added a comment - The "No 'Access-Control-Allow-Origin' header is present on the requested resource." error is raised because the JS resource was requested from a different domain ( bridgeit.github.io ) than the one the page was loaded from ( 10.18.39.137 ). This is a restriction imposed by modern browsers for the AJAX requests. To solve this problem bridgeit.github.io server will need to send the proper CORS headers. Please see http://en.wikipedia.org/wiki/Cross-origin_resource_sharing .
          Ken Fyten made changes -
          Assignee Mircea Toma [ mircea.toma ] Philip Breau [ philip.breau ]
          Philip Breau made changes -
          Assignee Philip Breau [ philip.breau ] Ken Fyten [ ken.fyten ]
          Hide
          Philip Breau added a comment -

          I put the following files on api.bridgeit.mobi:

          http://api.bridgeit.mobi/bridgeit/v1.0.4/bridgeit.js
          http://api.bridgeit.mobi/bridgeit/v1.x-latest/bridgeit.js

          But currently there do not seem to be any CORS headers being set on those requests.

          Show
          Philip Breau added a comment - I put the following files on api.bridgeit.mobi: http://api.bridgeit.mobi/bridgeit/v1.0.4/bridgeit.js http://api.bridgeit.mobi/bridgeit/v1.x-latest/bridgeit.js But currently there do not seem to be any CORS headers being set on those requests.
          Ken Fyten made changes -
          Link This issue blocks ICE-10285 [ ICE-10285 ]
          Jack Van Ooststroom made changes -
          Assignee Ken Fyten [ ken.fyten ] Jack Van Ooststroom [ jack.van.ooststroom ]
          Hide
          Jack Van Ooststroom added a comment -

          The bridgeit.war on api.bridgeit.mobi was a handcrafted .war-file. I updated this by including a web.xml and the CustomHeaderFilter from NaaS, to ensure the Access-Control-Allow-Origin header is set to * for now. If we need additional fine tuning of the CORS headers, we should be able to configure this in the web.xml.

          Show
          Jack Van Ooststroom added a comment - The bridgeit.war on api.bridgeit.mobi was a handcrafted .war-file. I updated this by including a web.xml and the CustomHeaderFilter from NaaS, to ensure the Access-Control-Allow-Origin header is set to * for now. If we need additional fine tuning of the CORS headers, we should be able to configure this in the web.xml.
          Hide
          Jack Van Ooststroom added a comment -

          SyntaxError in Chrome Console

          Show
          Jack Van Ooststroom added a comment - SyntaxError in Chrome Console
          Jack Van Ooststroom made changes -
          Attachment Picture 1.png [ 17504 ]
          Hide
          Jack Van Ooststroom added a comment -

          I see a SyntaxError when trying to open Showcase -> Mobile -> Fetch Contact. See attached picture for details.

          Show
          Jack Van Ooststroom added a comment - I see a SyntaxError when trying to open Showcase -> Mobile -> Fetch Contact. See attached picture for details.
          Hide
          Jack Van Ooststroom added a comment -

          Now with line numbers.

          Show
          Jack Van Ooststroom added a comment - Now with line numbers.
          Jack Van Ooststroom made changes -
          Attachment Picture 2.png [ 17505 ]
          Hide
          Ken Fyten added a comment -

          This is now working as expected.

          Show
          Ken Fyten added a comment - This is now working as expected.
          Ken Fyten made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Jack Van Ooststroom
              Reporter:
              Judy Guglielmin
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: