webwork2.2.5에서 request를 먼저 찾고 ognl스택을 찾는다.

package com.opensymphony.webwork.dispatcher;

import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.util.OgnlValueStack;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

/**
* <!-- START SNIPPET: javadoc -->
*
* All WebWork requests are wrapped with this class, which provides simple JSTL accessibility. This is because JSTL
* works with request attributes, so this class delegates to the value stack except for a few cases where required to
* prevent infinite loops. Namely, we don't let any attribute name with "#" in it delegate out to the value stack, as it
* could potentially cause an infinite loop. For example, an infinite loop would take place if you called:
* request.getAttribute("#attr.foo").
*
* <!-- END SNIPPET: javadoc -->
*
* @since 2.2
*/
public class WebWorkRequestWrapper extends HttpServletRequestWrapper {
   public WebWorkRequestWrapper(HttpServletRequest req) {
       super(req);
   }

   public Object getAttribute(String s) {
       if (s != null && s.startsWith("javax.servlet")) {
           // don't bother with the standard javax.servlet attributes, we can short-circuit this
           // see WW-953 and the forums post linked in that issue for more info
           return super.getAttribute(s);
       }

       Object attribute = super.getAttribute(s);

       boolean alreadyIn = false;
       //WW-1365
       ActionContext ctx = ActionContext.getContext();
       Boolean b = (Boolean) ctx.get("__requestWrapper.getAttribute");
       if (b != null) {
           alreadyIn = b.booleanValue();
       }

       // note: we don't let # come through or else a request for
       // #attr.foo or #request.foo could cause an endless loop
       if (!alreadyIn && attribute == null && s.indexOf("#") == -1) {
           try {
               // If not found, then try the ValueStack
               ctx.put("__requestWrapper.getAttribute", Boolean.TRUE);
              OgnlValueStack stack = ctx.getValueStack();
               if (stack != null) {
                   attribute = stack.findValue(s);
               }
           } finally {
               ctx.put("__requestWrapper.getAttribute", Boolean.FALSE);
           }
       }
       return attribute;
   }
}

트랙백 보낼 주소 :: http://www.ologist.co.kr/trackback/708

댓글을 달아주세요:: 네티켓은 기본, 스팸은 사절

  1. 2008/05/23 04:17
    댓글 주소 수정/삭제 댓글
    나의 너의 친구는 위치의 현재 팬이 되었다!
  2. 2008/05/23 04:46
    댓글 주소 수정/삭제 댓글
    저에서 유사한 역사는 이었다.
  3. 2008/05/23 05:19
    댓글 주소 수정/삭제 댓글
    뉴스를 위한 감사합니다…
  4. 2008/05/23 05:52
    댓글 주소 수정/삭제 댓글
    정말 같지 않는 블로그!
  5. 2008/05/23 07:02
    댓글 주소 수정/삭제 댓글
    여보세요, 좋은 아주 위치!
  6. 2008/05/24 00:11
    댓글 주소 수정/삭제 댓글
    걸출한 블로그!
  7. 2008/05/24 02:02
    댓글 주소 수정/삭제 댓글
    정말 같지 않는 블로그!


BLOG main image
OOP and Java by ologist

공지사항

카테고리

All (649)
private!! (106)
WEB & IT (140)
Developer (400)