(接上期)作者:欧宣修
图10 编译成功画面
重新部署
如:build deploy
图11 部署成功画面
现在我们可开启浏览器,依上述流程重新执行一次,当进入http://localhost:8080/petstore/index.jsp,观察RI Console秀出
登入页、登入失败页之URL:
图12 登入页、登入失败页之URL
从首页点选使用者帐号浏览页,RI Console秀出目的页URL及找出customer.do为保护页:
图13 目的页URL及找出customer.do为保护页
第二阶段
登入画面(signon.screen)可从screendefinitions_en_US.xml找出内容对应档案为signon.jsp,它源码位置在petstore_home\src\apps\petstore\src\docroot,开启它请看约53列:
<waf:form name="existingcustomer" action="j_signon_check" method="POST">
<table cellpadding="5" cellspacing="0" border="0">
<tr>
<td class="petstore" align="center" colspan="2">
<b>Yes.</b>
</td>
</tr>
<tr>
<td class="petstore_form" align="right">
<b>User Name:</b>
</td>
<td class="petstore_form">
<c:choose>
<c:when test="${cookie['bp_signon'] != null && cookie['bp_signon']
!='}">
<waf:input cssClass="petstore_form"
type="text"
size="15"
name="j_username"
validation="validation">
<waf:value><c:out value="${cookie['bp_signon'].value}"/></waf:value>
</waf:input>
</td>
</tr>
<tr>
以下略...
这是一个典型的Web-Form输入画面,使用了JSTL及Petstore自已写的自订卷标(Custom Tag),这些卷标的用法不是本文的讨论重点,请读者自行参阅相关文件、书籍,我们将焦点放在流程上,请注意上述的程序片段粗体部份,使用者将帐号(User Name)及密码(Password)输入后按登入(Sign In)钮,服务器(Web Server)会将request传送给” j_signon_check”这个奇怪的URL,我们再回到SignOnFilter,在初始的变量宣告上,可找到这个URL,约70列:
public static final String FORM_SIGNON_URL = "j_signon_check";
在doFilter()函式可发现下列程序接收Request进行验证,顺便加上侦察程序代码(Debug code),方便待会程序验证:






