hard-coded component id in Tobago.Updater
-----------------------------------------

                 Key: TOBAGO-222
                 URL: http://issues.apache.org/jira/browse/TOBAGO-222
             Project: MyFaces Tobago
          Issue Type: Bug
    Affects Versions: 1.0.8, 1.0.9
            Reporter: Dennis Hauser


The ajax reload functionality included in Tobago.Updater uses a hard-coded 
component-id for full page reloads in case it receives an unexpected awnser 
from the server.

See last to else-parts in attached code :   
Tobago.submitAction("page:overviewSheet");


Tobago.Updater = {
  CODE_SUCCESS: "<status code=\"200\"/>",

  CODE_NOT_MODIFIED: "<status code=\"304\"/>",

  CODE_RELOAD_REQUIRED: "<status code=\"309\"/>",

  UPDATE_TIMEOUT: 5000,  // Five seconds 

  options: {
    method: 'post',
    asynchronous: true,
    parameters: '',
    evalScripts: true,
    createOverlay: true,
    onComplete: function(){}, // empty function
    insertion: function(receiver, response, transport) {
      //Tobago.deleteOverlay(receiver);
      //LOG.debug("response = \"" + response.substring(0, 30 < response.length 
? 30 : response.length) + "\"");
      //LOG.debug("this.CODE_NOT_MODIFIED = \"" + 
Tobago.Updater.CODE_NOT_MODIFIED + "\" ist lang:" + 
Tobago.Updater.CODE_NOT_MODIFIED.length);
      if (transport.status == 304) {
        Tobago.deleteOverlay(receiver);
        LOG.debug("skip update response status 304");
      } else if (response.substring(0, Tobago.Updater.CODE_NOT_MODIFIED.length) 
== Tobago.Updater.CODE_NOT_MODIFIED) {
        // no update needed, do nothing
              LOG.debug("skip update");
        receiver.skipUpdate = true;
      } else if (response.substring(0, Tobago.Updater.CODE_SUCCESS.length) == 
Tobago.Updater.CODE_SUCCESS) {
        // update content
              LOG.debug("update content");
        Element.update(receiver, response.substring(20));
      } else if (response.substring(0, 
Tobago.Updater.CODE_RELOAD_REQUIRED.length) == 
Tobago.Updater.CODE_RELOAD_REQUIRED) {
        // reload complete page
        LOG.debug("full reload requested");
        Tobago.submitAction("page:overviewSheet");
      } else {
        // unknown response do full page reload
        LOG.debug("initiating full reload");
        Tobago.submitAction("page:overviewSheet");
      }
    }
  },





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to