天天看點

why there is always a HTTP 302 redirect when clicking workcenter

Created by Jerry Wang on Dec 06, 2014

在UI上點選任意一個work center,例如Master Data時,總會在Chrome Network裡觀察到一個http 302 redirect:

why there is always a HTTP 302 redirect when clicking workcenter

這其實是一個working as designed的behavior:

why there is always a HTTP 302 redirect when clicking workcenter

背景通過解析前台發送的http request裡的form fields,能拿到目前需要navigate到哪個work center,這個例子裡的workcenter的target id是SRV-MD-WC,

why there is always a HTTP 302 redirect when clicking workcenter

這個navigation event首先交由對應的controller進行處理:

why there is always a HTTP 302 redirect when clicking workcenter

之後生成一個navigation request:

why there is always a HTTP 302 redirect when clicking workcenter

這裡能發現架構的處理邏輯是,如果之前的處理沒有任何錯誤,lv_suppress_navigation 為abap_false,則總會在line 183執行一個redirect操作:

why there is always a HTTP 302 redirect when clicking workcenter

redirect的target url通過line 82的方法生成:

why there is always a HTTP 302 redirect when clicking workcenter

這個redirect target url就是Chrome裡觀察到的緊接着http 302 redirect POST之後的http 200 get:

why there is always a HTTP 302 redirect when clicking workcenter

繼續閱讀