欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
struts2代碼分析

struts2代碼分析

分類(lèi):默認欄目

據說(shuō)struts2是根據webwork的哲學(xué)修改過(guò)來(lái)的。下了struts2的代碼看了看,果然跟webwork如出一轍。不過(guò)struts2貌似更簡(jiǎn)潔一些。

webwork的精華在于和http解耦,基于接口編程,以及利用IOC的解耦設計。攔截器是它非常漂亮的思想,當然實(shí)現也非常的漂亮。

下面是代碼

 public void serviceAction(HttpServletRequest request,
   HttpServletResponse response, ServletContext context,
   ActionMapping mapping) throws ServletException {
  Map<String, Object> extraContext = createContextMap(request, response,
    mapping, context);
  // If there was a previous value stack, then create a new copy and pass
  // it in to be used by the new Action
  // 壓棧
  ValueStack stack = (ValueStack) request
    .getAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY);
  if (stack != null) {
   extraContext.put(ActionContext.VALUE_STACK, ValueStackFactory
     .getFactory().createValueStack(stack));
  }
  String timerKey = "Handling request from Dispatcher";
  try {
   UtilTimerStack.push(timerKey);
   String namespace = mapping.getNamespace();
   String name = mapping.getName();
   String method = mapping.getMethod();
   String id = request
     .getParameter(XWorkContinuationConfig.CONTINUE_PARAM);
   if (id != null) {
    // remove the continue key from the params - we don‘t want to
    // bother setting
    // on the value stack since we know it won‘t work. Besides, this
    // breaks devMode!
    Map params = (Map) extraContext.get(ActionContext.PARAMETERS);
    params.remove(XWorkContinuationConfig.CONTINUE_PARAM);
    // and now put the key in the context to be picked up later by
    // XWork
    extraContext.put(XWorkContinuationConfig.CONTINUE_KEY, id);
   }
   // 代理,實(shí)現了接口到實(shí)現的轉換。
   ActionProxy proxy = ActionProxyFactory.getFactory()
     .createActionProxy(configurationManager.getConfiguration(),
       namespace, name, extraContext, true, false);
   proxy.setMethod(method);
   request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY,
     proxy.getInvocation().getStack());
   // if the ActionMapping says to go straight to a result, do it!
   if (mapping.getResult() != null) {
    Result result = mapping.getResult();
    // 執行action
    result.execute(proxy.getInvocation());
   } else {
    proxy.execute();
   }
   // If there was a previous value stack then set it back onto the
   // request
   if (stack != null) {
    request.setAttribute(
      ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
   }
  } catch (ConfigurationException e) {
   LOG.error("Could not find action or result", e);
   sendError(request, response, context,
     HttpServletResponse.SC_NOT_FOUND, e);
  } catch (Exception e) {
   LOG.error("Could not execute action", e);
   sendError(request, response, context,
     HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
  } finally {
   UtilTimerStack.pop(timerKey);
  }
 }
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Struts2 源碼分析——Action代理類(lèi)的工作
Struts2中OGNL,valueStack,stackContext的學(xué)習
Struts2的簡(jiǎn)單使用(四)action向頁(yè)面傳值
OGNL & ValueStack 入門(mén) - Struts - Java - JavaEy...
requestMap 包裝了request
Struts2為什么可以用EL表達式取值?
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久