⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 j-scwcd-7-5.html

📁 sun公司java认证课程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
    </script><a href="#navskip"><img border="0" alt="Skip to main content" src="../i/c.gif"></a>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="tbgc" width="160"><a href="/developerWorks/cgi-bin/click.cgi?url=http://www.ibm.com/cn"><img height="47" width="160" alt="IBM" border="0" src="../i/ibm-logo.gif"></a></td><td class="tbg" width="195"><font color="#99ccff" size="2"><b>中国</b></font><a href="#main"><img alt="Skip to main content" height="1" width="195" border="0" src="../i/c.gif"></a></td><td valign="top" align="right" class="tbgc" width="100%">
<table cellspacing="0" cellpadding="0" border="0">
<form name="form1" id="form1" action="http://202.95.2.149/cgi-bin/dWsearch.pl" method="get">
<tr>
<td colspan="6"><img alt="" height="4" width="390" border="0" src="../i/c.gif"></td>
</tr>
<tr valign="middle">
<td class="dwsearch" height="8"><select class="dwsearch" name="selScope"><option value="dW">dW 中国所有内容</option><option value="dW">.................  </option><option value="dW">dW 中国技术专区:</option><option value="comptZ"> 组件技术</option><option value="javaZ"> Java 技术</option><option value="linuxZ"> Linux</option><option value="xmlZ"> XML</option><option value="linuxZ">dW 中国特别专题:</option><option value="securityZ"> 安全</option><option value="unicodeZ"> Unicode</option><option value="all">IBM 全部内容</option></select></td><td class="small"><img alt="" border="0" height="1" width="5" src="../i/c.gif"></td><td><input maxlength="100" size="15" height="15" name="UserRestriction" class="dwsearch" type="text"></td><td><img alt="" height="1" width="5" border="0" src="../i/c.gif"></td><td width="64"><input alt="搜索" name="Search" value="Search" border="0" height="23" width="64" src="../i/search.gif" type="image"></td><td valign="top"><img alt="" height="1" width="34" border="0" src="../i/c.gif"></td>
</tr>
<tr valign="top">
<td class="small" colspan="6"><a target="_blank" style="color: #ffffff;" href="http://202.95.2.149/help.htm">高级搜索</a><img alt="" height="1" width="1" border="0" src="../i/c.gif"></td>
</tr>
<tr>
<td colspan="6"><img alt="" height="4" width="390" border="0" src="../i/c.gif"></td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td class="hbg" height="21" width="160"></td><td class="bbg" valign="top" height="21" colspan="2">  <a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/" class="mainlink">IBM 主页</a><span class="divider"> | </span><a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/products/index.shtml" class="mainlink">产品与服务</a><span class="divider"> | </span><a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/support/index.shtml" class="mainlink">支持与下载</a><span class="divider"> | </span><a href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/account/index.shtml" class="mainlink">个性化服务</a></td>
</tr>
</table>
<TABLE width="100%" cellspacing="0" cellpadding="0" border="0">
<TR>
<TD bgcolor="#ffffff" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#cc6633" height="3" width="150"><IMG src="../i/c.gif" width="150" height="3"></TD>
</TR>
<TR>
<TD bgcolor="#333333" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#000000" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#ffffff" height="1" width="150"><IMG src="../i/c.gif" width="150" height="2"></TD>
</TR>
</TABLE>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><font size="-1" face="Verdana, sans-serif"><a href="/developerWorks/cn/index.shtml">developerWorks 中国网站</a> : <a href="/developerWorks/cn/java/index.shtml">JAVA</a> : <a href="/developerWorks/cn/cnedu.nsf/java-onlinecourse-bytitle?OpenView&Count=50">教学 - 在线教程</a></font>
<br>
<img alt="Java 认证成功之路,第 2 部分:SCWCD" src="imagemaster/masthead.jpg"></td><td width="*" valign="bottom" align="right"><a border="0" href="j-scwcd.zip"><img alt="下载 ZIP 文件" border="0" src="../i/icon-zip.gif"></a><a target="_blank" href="../tutorial_eng/index.html" border="0"><img alt="英文原文" border="0" src="../i/icon-source.gif"></a>
					
					
					
&nbsp;&nbsp;&nbsp;
				</td>
</tr>
<tr>
<td height="2" colspan="2"><img height="2" width="1" src="../i/c.gif"></td>
</tr>
</table>
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD width="150" height="1" bgcolor="#000000" colspan="6"><IMG alt="" height="1" width="150" src="../i/c.gif"></TD>
</TR>
<TR>
<TD background="../i/sw-gold.gif"><a border="0" href="index.html" onMouseOver="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" onMouseOut="iOut('topmain'); iOut('bottommain'); self.status=''; return true;"><img alt="主菜单" border="0" src="../i/main.gif" name="topmain"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" onMouseOut="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" href="index7.html"><img alt="章节菜单" border="0" src="../i/section.gif" name="topsection"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" onMouseOut="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" href="j-scwcd-15-3.html"><img alt="给出此教程的反馈意见" border="0" src="../i/feedback.gif" name="topfeedback"></a></TD><TD width="100%" background="../i/sw-gold.gif"><img src="../i/c.gif"></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" onMouseOut="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" href="j-scwcd-7-4.html"><img alt="上页" border="0" src="../i/previous.gif" name="topprevious"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" onMouseOut="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" href="j-scwcd-7-6.html"><img alt="下页" border="0" src="../i/next.gif" name="topnext"></a></TD>
</TR>
</TABLE>
<table bgcolor="ffffff" cellspacing="0" cellpadding="2" border="0" height="400" width="100%">
<tr valign="bottom">
<a name="navskip"></a><td height="25" colspan="4"><img alt="7.开发安全的 Web 应用程序" src="imagemaster/titlebar7.jpg" border="0" height="25" width="562"></td>
</tr>
<tr>
<td bgcolor="ffffff" width="15">&nbsp;</td><td bgcolor="ffffff" width="12">&nbsp;</td><td valign="top" align="left" bgcolor="ffffff" width="*">
<p>
<br>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="90%"><font size="4" face="Verdana, Arial, Helvetica"><b>安全约束</b></font></td><td width="200" align="right"><font size="1" face="Verdana, Arial, Helvetica"><nobr>   第 5 页(共7 页)</nobr></font></td>
</tr>
</table>
<br>
<br>
</p>
<font size="2" face="Verdana, Arial, Helvetica">
<p>安全约束决定了谁被授权访问 Web 应用程序的资源。</p>
<p>
<b>security-constraint</b>
<br>

<code>&lt;security-constraint&gt;</code> 元素用于把安全约束与一个或多个 Web 资源集合关联起来。<code>&lt;security-constraint&gt;</code> 的子元素是 <code>&lt;display-name&gt;</code> <code>&lt;web-resource-collection&gt;</code>、<code>&lt;auth-constraint&gt;</code> 和 <code>&lt;user-data-constraint&gt;</code>。</p>
<p>
<b>web-resource-collection</b>
<br>

<code>&lt;web-resource-collection&gt;</code> 元素指定了一组资源,安全约束将应用到这组资源上。它的子元素是 <code>&lt;web-resource-name&gt;</code>、<code>&lt;description&gt;</code>、<code>&lt;url-pattern&gt;</code> 和 <code>&lt;http-method&gt;</code>,如下所述:<br> 

<ul>
<li>

<code>&lt;web-resource-name&gt;</code> 指定了资源的名称。</li>
<li>
<code>&lt;description&gt;</code> 提供了资源的描述。</li>
<li> 
<code>&lt;url-pattern&gt;</code> 指定了要访问的资源的 URL 模式。</li>
<li>
<code>&lt;http-method&gt;</code> 指定该约束所应用的 HTTP 方法。</li>
</ul>如果没有指定 HTTP 方法,安全约束应用到所有 HTTP 方法。</p>
<p>下面配置指定,<code>MarksServlet</code> 的 <code>POST()</code> 方法将受应用程序安全约束的支配:</p>
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12">
&lt;security-constraint&gt;
    &lt;web-resource-collection&gt;
        &lt;web-resource-name&gt; marks &lt;/web-resource-name&gt;
        &lt;url-pattern&gt; /servlet/MarksServlet &lt;/url-pattern&gt;
        &lt;http-method&gt;POST&lt;/http-method&gt;
    &lt;/web-resource-collection&gt;
&lt;/security-constraint&gt;
</code>
</pre>
<p>
<b>auth-constraint</b>
<br>

<code>&lt;auth-constraint&gt;</code> 元素指定哪些安全角色可以访问安全约束应用到的资源。它的子元素是 <code>&lt;description&gt;</code> 和 <code>&lt;role-name&gt;</code>。</p>
<p>
<code>&lt;role-name&gt;</code> 元素应该是部署描述符中,<code>&lt;security-role&gt;</code> 元素定义的一个名称。注意,角色是区分大小写的。</p>
<p>下面代码指出,属于角色&ldquo;teacher&rdquo;的用户将被授予对受安全约束保护的资源的访问权限:</p>
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12">
&lt;auth-constraint&gt;
        &lt;description&gt;Only for teachers&lt;/description&gt;
        &lt;role-name&gt;teacher&lt;/role-name&gt;
&lt;auth-constraint&gt;
</code>
</pre>
<p>要指定所有角色可以访问安全的资源,指定星号(*)字符:</p>
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12">
&lt;auth-constraint&gt;
        &lt;description&gt; For all roles &lt;/description&gt;
        &lt;role-name&gt;*&lt;/role-name&gt;
&lt;auth-constraint&gt;
</code>
</pre>
<p>
<b>user-data-constraint</b>
<br>

<code>&lt;user-data-constraint&gt;</code> 元素指定应该怎样保护客户机和服务器之间传输的数据。它的子元素是 <code>&lt;description&gt;</code> 和 <code>&lt;transport-guarantee&gt;</code>。</p>
<p>
<code>&lt;transport-guarantee&gt;</code> 元素可以包含三个值中的任何值:<code>NONE</code>、<code>INTEGRAL</code> 和 <code>CONFIDENTIAL</code>。其中,<code>NONE</code> 是没有传输保证,<code>INTEGRAL</code> 是不能在传输中更改的数据,<code>CONFIDENTIAL</code>  是不能被观察的传输的内容。</p>
<p>下面例子展示了 <code>&lt;user-data-constraint&gt;</code> 元素的使用:</p>
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12">
&lt;user-data-constraint&gt;
        &lt;description&gt; Integral Transmission &lt;/description&gt;
        &lt;transport-guarantee&gt;INTEGRAL&lt;/transport-guarantee&gt;
&lt;/user-data-constraint&gt;
</code>
</pre>
<br>
</font></td>
</tr>
</table>
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD background="../i/sw-gold.gif"><a border="0" href="index.html" onMouseOver="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" onMouseOut="iOut('topmain'); iOut('bottommain'); self.status=''; return true;"><img alt="主菜单" border="0" src="../i/main.gif" name="bottommain"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" onMouseOut="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" href="index7.html"><img alt="章节菜单" border="0" src="../i/section.gif" name="bottomsection"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" onMouseOut="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" href="j-scwcd-15-3.html"><img alt="给出此教程的反馈意见" border="0" src="../i/feedback.gif" name="bottomfeedback"></a></TD><TD width="100%" background="../i/sw-gold.gif"><img src="../i/c.gif"></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" onMouseOut="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" href="j-scwcd-7-4.html"><img alt="上页" border="0" src="../i/previous.gif" name="bottomprevious"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" onMouseOut="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" href="j-scwcd-7-6.html"><img alt="下页" border="0" src="../i/next.gif" name="bottomnext"></a></TD>
</TR>
<TR>
<TD width="150" height="1" bgcolor="#000000" colspan="6"><IMG alt="" height="1" width="150" src="../i/c.gif"></TD>
</TR>
</TABLE>
<TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
<TR>
<TD width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img alt="" height="1" width="1" src="../i/c.gif"></td>
</tr>
<tr valign="top">
<td class="bbg" height="21"> <a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/index.shtml">关于 IBM</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/privacy/index.shtml">隐私条约</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/legal/index.shtml">法律条款</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/contact/index.shtml">联系 IBM</a></td>
</tr>
</table>
</TD>
</TR>
</TABLE>
<script src="//www.ibm.com/common/stats/stats.js" language="JavaScript1.2" type="text/javascript"></script>
<noscript>
<img border="0" alt="" height="1" width="1" src="//stats.www.ibm.com/rc/images/uc.GIF?R=noscript"></noscript>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -