1. #1
    Sencha User
    Join Date
    Jun 2007
    Posts
    216
    Vote Rating
    0
    end-user is on a distinguished road

      0  

    Default events: connection exceptions, chaining events & canceling

    events: connection exceptions, chaining events & canceling


    As I've posted previously, I'd like to setup a global connection handler. Essentially, I want to do something similar in concept to the basic login tutorial; I want to capture and handle 403 statuses. If any XHR request results in a 403 status, I want to cancel, gracefully, the requesting event (which could be a loader), and launch a separate process. It would be cool if, after that process was done, it could resume the initiator, but it has to at least cancel it. I'd also like the listener to act as an interceptor - if the response is not a 403, chain to whatever failure handler would normally receive the event. Can someone tell me if this can be done, and what I'd need to do to make it happen?

    TIA

  2. #2
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    See ext-basex (in my sig below). It enhances the ext-base adaptor to handle all that with native Ext events.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  3. #3
    Sencha User
    Join Date
    Jun 2007
    Posts
    216
    Vote Rating
    0
    end-user is on a distinguished road

      0  

    Default


    Ok, so, I'm trying it out. When I add it to an already working page, I get an error about this.headers not being defined. Is there something special I need to do to implement it?

  4. #4
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Some code and stacktrace might help
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  5. #5
    Sencha User
    Join Date
    Jun 2007
    Posts
    216
    Vote Rating
    0
    end-user is on a distinguished road

      0  

    Default


    Well, ok - I'm using a simple TreeLoader to make a call (actually twice, the first is the lazy load, the second expands a node):
    Code:
    tree=new T.TreePanel({
    	title: "review items",
    	animate:false,
    	enableDD:false,
    	lines:false,
    	frame:true,
    	autoHeight:true,
    	autoScroll:true,
    	rootVisible:true,
    	loader: new T.TreeLoader({
    		dataUrl:"/foundry/forge/test3.cfm"
    	}),
    	root: new T.AsyncTreeNode({
    	text:"Districts"
    	,listeners:{
    		expand:{
    			fn:function(){
    				var N=tree.getNodeById(d)
    				N.expand(); N.getUI().getEl().scrollIntoView();
    			},single:true
    		}
    	}
    	,id:"district"
    	})
    })
    And this results:
    Code:
    this.headers is undefined
    http://localhost/srsdss/js/ext/ux/ext-basex.js
    Line 546
    
    request()()	ext-basex.js (line 546)
    request()(Object url=/foundry/forge/test3.cfm scope=Object)	ext-all-debug.js (line 5106)
    requestData()([Node district] loaded=false loading=true childrenRendered=false, function())	ext-all-debug.js (line 23859)
    load()([Node district] loaded=false loading=true childrenRendered=false, function())	ext-all-debug.js (line 23816)
    expand()(undefined, undefined, undefined)	ext-all-debug.js (line 23162)
    fn()()	cN_formInit.js (line 83)
    createSingle()()	ext-all-debug.js (line 1397)
    fire()()	ext-all-debug.js (line 1488)
    fireEvent()()	ext-all-debug.js (line 1184)
    afterExpand()()	ext-all-debug.js (line 16098)
    onExpand()(true, undefined)	ext-all-debug.js (line 28119)
    expand()(undefined)	ext-all-debug.js (line 16080)
    onCheckClick()()	ext-all-debug.js (line 28124)
    h()()	ext-all-debug.js (line 1613)
    getTime()()	yahoo-do...-event.js (line 8)
    
    [Break on this error] var cType = this.headers['Content-Type']||null;

  6. #6
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Hmm..

    The default value for this(Ext.lib.Ajax).headers should be {}.

    If you 'break' on that error what is 'this' and/or what is the value of this.headers?

    Are you clearing out the default headers somewhere else?
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  7. #7
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Exclamation


    Ah, I see now.

    ext-basex is designed to enhance the Ext base adaptor only. Not the YUI adapter.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  8. #8
    Sencha User
    Join Date
    Jun 2007
    Posts
    216
    Vote Rating
    0
    end-user is on a distinguished road

      0  

    Default


    Yep; when I break on that line, 'this' is a queueManager object; there are no headers defined.
    Code:
    this  =  Object queueManager=Object queueAll=false activeRequests=0
    cType  =  undefined
    cb  =  Object scope=Object argument=Object timeout=30000
    data  =  "node=district"
    h  =  undefined
    hs  =  false
    method  =  "POST"
    options  =  Object async=true headers=false proxied=false
    q  =  undefined
    qm  =  undefined
    qname  =  undefined
    req  =  undefined
    uri  =  "/foundry/forge/test3.cfm"
    y  =  2
    No, I'm not monkeying with anything; it should all be straight defaults. My includes:
    PHP Code:
    <script src="/js/yui/core/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script src="/js/yui/core/build/container/container-min.js"></script>
    <script src="/js/yui/core/build/utilities/utilities.js"></script>
    <script src="/js/ext/core/adapter/yui/ext-yui-adapter.js"></script>
    <script src="/js/ext/core/ext-all-debug.js"></script>
    <script src="/js/ext/ux/ext-basex.js"></script>
    <script src="/js/ext/ux/Ext.ux.Plugin.RemoteComponent.js"></script>
    <script>Ext.BLANK_IMAGE_URL = "/imgs/s.gif";</script>
    <script src="/js/common.js"></script> 
    I did make this change on line 11551 of ext-all-debug.js, however, if that makes any difference

  9. #9
    Sencha User
    Join Date
    Jun 2007
    Posts
    216
    Vote Rating
    0
    end-user is on a distinguished road

      0  

    Default


    Oh. Ok, well, I reassert my original post, then.

  10. #10
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Ext.Ajax does have a requestexception event available to you. Check the docs.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar