您的位置:首页 >> 编程开发 >> Java >> JavaBeans >> 正文
RSS
 

Petstore源码追踪记(3)-商业逻辑处理(五)

http://www.rdxx.com 01年11月18日 11:08 互联网 我要投稿

关键词: 商业 , 逻辑 , Stor

 (接上期)

Web tier
当使用者输入http://localhost:8080/petstore/customer.doMainServlet接收到

Request
,转到doProcess()函数:

private void doProcess(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException {
    // set the locale of the user to default if not set
    if (request.getSession().getAttribute(WebKeys.LOCALE) == null) {
       request.getSession().setAttribute(WebKeys.LOCALE, defaultLocale);
    }
    try {
       getRequestProcessor().processRequest(request);
//
进行转导动作(forward)              
getScreenFlowManager().forwardToNextScreen(request,response);
    } catch (Throwable ex) {
       String className = ex.getClass().getName();
       String nextScreen = getScreenFlowManager().getExceptionScreen(ex);
       // put the exception in the request
       request.setAttribute("javax.servlet.jsp.jspException", ex);
       if (nextScreen == null) {
          // send to general error screen
          ex.printStackTrace();
          throw new ServletException("MainServlet: unknown exception: " +
className);
       }
          context.getRequestDispatcher(nextScreen).forward(request, response);
    }

}

请开启

Petstore_home\src\waf\src\controller\com\sun\j2ee\blueprints\waf\controller\web\flow\ScreenFlowManager.java
,在约112列可找到forwardToNextScreen()函数:

public void forwardToNextScreen(HttpServletRequest request, HttpServletResponse
response) throws java.io.IOException, FlowHandlerException,
javax.servlet.ServletException {
      // set the presious screen
      String fullURL = request.getRequestURI();
      // get the screen name
      String selectedURL = defaultScreen;
      int lastPathSeparator = fullURL.lastIndexOf("/") + 1;
      if (lastPathSeparator != -1) {
          selectedURL = fullURL.substring(lastPathSeparator, fullURL.length());
      }
      //
请加入侦察码,以本例来说,selectedURL=customer.do
      System.out.println("selectURL="+ selectedURL);
      String currentScreen = "";
      URLMapping urlMapping = getURLMapping(selectedURL);

9 7 3 1 2 3 4 5 6 7 4 8 :

 
 
标签: 商业 , 逻辑 , Stor 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站