Modified: 
webservices/website/wss4j/xref/org/apache/wss4j/dom/message/WSSecHeader.html
URL: 
http://svn.apache.org/viewvc/webservices/website/wss4j/xref/org/apache/wss4j/dom/message/WSSecHeader.html?rev=1799161&r1=1799160&r2=1799161&view=diff
==============================================================================
--- 
webservices/website/wss4j/xref/org/apache/wss4j/dom/message/WSSecHeader.html 
(original)
+++ 
webservices/website/wss4j/xref/org/apache/wss4j/dom/message/WSSecHeader.html 
Mon Jun 19 09:02:30 2017
@@ -100,124 +100,133 @@
 <a class="jxr_linenumber" name="L92" href="#L92">92</a>      <strong 
class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> 
setMustUnderstand(<strong class="jxr_keyword">boolean</strong> mu) {
 <a class="jxr_linenumber" name="L93" href="#L93">93</a>          
mustunderstand = mu;
 <a class="jxr_linenumber" name="L94" href="#L94">94</a>      }
-<a class="jxr_linenumber" name="L95" href="#L95">95</a>  
+<a class="jxr_linenumber" name="L95" href="#L95">95</a>      
 <a class="jxr_linenumber" name="L96" href="#L96">96</a>      <em 
class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L97" href="#L97">97</a>  <em 
class="jxr_javadoccomment">     * Get the security header element of this 
instance.</em>
+<a class="jxr_linenumber" name="L97" href="#L97">97</a>  <em 
class="jxr_javadoccomment">     * Get the security header document of this 
instance.</em>
 <a class="jxr_linenumber" name="L98" href="#L98">98</a>  <em 
class="jxr_javadoccomment">     *</em>
 <a class="jxr_linenumber" name="L99" href="#L99">99</a>  <em 
class="jxr_javadoccomment">     * @return The security header element.</em>
 <a class="jxr_linenumber" name="L100" href="#L100">100</a> <em 
class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L101" href="#L101">101</a>     <strong 
class="jxr_keyword">public</strong> Element getSecurityHeaderElement() {
-<a class="jxr_linenumber" name="L102" href="#L102">102</a>         <strong 
class="jxr_keyword">return</strong> securityHeader;
+<a class="jxr_linenumber" name="L101" href="#L101">101</a>     <strong 
class="jxr_keyword">public</strong> Document getSecurityHeaderDoc() {
+<a class="jxr_linenumber" name="L102" href="#L102">102</a>         <strong 
class="jxr_keyword">return</strong> <strong 
class="jxr_keyword">this</strong>.doc;
 <a class="jxr_linenumber" name="L103" href="#L103">103</a>     }
 <a class="jxr_linenumber" name="L104" href="#L104">104</a> 
-<a class="jxr_linenumber" name="L105" href="#L105">105</a>     <strong 
class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> 
setSecurityHeaderElement(Element securityHeaderElement) {
-<a class="jxr_linenumber" name="L106" href="#L106">106</a>         <strong 
class="jxr_keyword">this</strong>.securityHeader = securityHeaderElement;
-<a class="jxr_linenumber" name="L107" href="#L107">107</a>     }
-<a class="jxr_linenumber" name="L108" href="#L108">108</a> 
-<a class="jxr_linenumber" name="L109" href="#L109">109</a>     <em 
class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L110" href="#L110">110</a> <em 
class="jxr_javadoccomment">     * Returns whether the security header is 
empty</em>
-<a class="jxr_linenumber" name="L111" href="#L111">111</a> <em 
class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L112" href="#L112">112</a> <em 
class="jxr_javadoccomment">     * @return true if empty or if there is no 
security header</em>
-<a class="jxr_linenumber" name="L113" href="#L113">113</a> <em 
class="jxr_javadoccomment">     *         false if non empty security 
header</em>
-<a class="jxr_linenumber" name="L114" href="#L114">114</a> <em 
class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L115" href="#L115">115</a>     <strong 
class="jxr_keyword">public</strong> <strong 
class="jxr_keyword">boolean</strong> isEmpty() <strong 
class="jxr_keyword">throws</strong> WSSecurityException {
-<a class="jxr_linenumber" name="L116" href="#L116">116</a>         <strong 
class="jxr_keyword">if</strong> (doc == <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L117" href="#L117">117</a>             <strong 
class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a 
href="../../../../../org/apache/wss4j/common/ext/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.ErrorCode.FAILURE,
 <span class="jxr_string">"empty"</span>,
-<a class="jxr_linenumber" name="L118" href="#L118">118</a>                     
                      <strong class="jxr_keyword">new</strong> Object[] {<span 
class="jxr_string">"The Document of WSSecHeader is null"</span>});
-<a class="jxr_linenumber" name="L119" href="#L119">119</a>         }
-<a class="jxr_linenumber" name="L120" href="#L120">120</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader == <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L121" href="#L121">121</a>             
securityHeader =
-<a class="jxr_linenumber" name="L122" href="#L122">122</a>                 
WSSecurityUtil.findWsseSecurityHeaderBlock(
-<a class="jxr_linenumber" name="L123" href="#L123">123</a>                     
doc, doc.getDocumentElement(), actor, false
-<a class="jxr_linenumber" name="L124" href="#L124">124</a>                 );
-<a class="jxr_linenumber" name="L125" href="#L125">125</a>         }
-<a class="jxr_linenumber" name="L126" href="#L126">126</a> 
-<a class="jxr_linenumber" name="L127" href="#L127">127</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader == <strong 
class="jxr_keyword">null</strong> || securityHeader.getFirstChild() == <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L128" href="#L128">128</a>             <strong 
class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="L129" href="#L129">129</a>         }
-<a class="jxr_linenumber" name="L130" href="#L130">130</a>         <strong 
class="jxr_keyword">return</strong> false;
-<a class="jxr_linenumber" name="L131" href="#L131">131</a>     }
-<a class="jxr_linenumber" name="L132" href="#L132">132</a> 
-<a class="jxr_linenumber" name="L133" href="#L133">133</a>     <em 
class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L134" href="#L134">134</a> <em 
class="jxr_javadoccomment">     * Creates a security header and inserts it as 
child into the SOAP Envelope.</em>
-<a class="jxr_linenumber" name="L135" href="#L135">135</a> <em 
class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L136" href="#L136">136</a> <em 
class="jxr_javadoccomment">     * Check if a WS Security header block for an 
actor is already available in</em>
-<a class="jxr_linenumber" name="L137" href="#L137">137</a> <em 
class="jxr_javadoccomment">     * the document. If a header block is found 
return it, otherwise a new</em>
-<a class="jxr_linenumber" name="L138" href="#L138">138</a> <em 
class="jxr_javadoccomment">     * wsse:Security header block is created and the 
attributes set</em>
-<a class="jxr_linenumber" name="L139" href="#L139">139</a> <em 
class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L140" href="#L140">140</a> <em 
class="jxr_javadoccomment">     * @return A 
&lt;code&gt;wsse:Security&lt;/code&gt; element</em>
-<a class="jxr_linenumber" name="L141" href="#L141">141</a> <em 
class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L142" href="#L142">142</a>     <strong 
class="jxr_keyword">public</strong> Element insertSecurityHeader() <strong 
class="jxr_keyword">throws</strong> WSSecurityException {
-<a class="jxr_linenumber" name="L143" href="#L143">143</a>         <em 
class="jxr_comment">//</em>
-<a class="jxr_linenumber" name="L144" href="#L144">144</a>         <em 
class="jxr_comment">// If there is already a security header in this instance 
just return it</em>
-<a class="jxr_linenumber" name="L145" href="#L145">145</a>         <em 
class="jxr_comment">//</em>
-<a class="jxr_linenumber" name="L146" href="#L146">146</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader != <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L147" href="#L147">147</a>             <strong 
class="jxr_keyword">return</strong> securityHeader;
-<a class="jxr_linenumber" name="L148" href="#L148">148</a>         }
-<a class="jxr_linenumber" name="L149" href="#L149">149</a> 
-<a class="jxr_linenumber" name="L150" href="#L150">150</a>         <strong 
class="jxr_keyword">if</strong> (doc == <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L151" href="#L151">151</a>             <strong 
class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a 
href="../../../../../org/apache/wss4j/common/ext/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.ErrorCode.FAILURE,
 <span class="jxr_string">"empty"</span>,
-<a class="jxr_linenumber" name="L152" href="#L152">152</a>                     
                      <strong class="jxr_keyword">new</strong> Object[] {<span 
class="jxr_string">"The Document of WSSecHeader is null"</span>});
-<a class="jxr_linenumber" name="L153" href="#L153">153</a>         }
-<a class="jxr_linenumber" name="L154" href="#L154">154</a> 
-<a class="jxr_linenumber" name="L155" href="#L155">155</a>         
securityHeader =
-<a class="jxr_linenumber" name="L156" href="#L156">156</a>             
WSSecurityUtil.findWsseSecurityHeaderBlock(
-<a class="jxr_linenumber" name="L157" href="#L157">157</a>                 
doc, doc.getDocumentElement(), actor, <strong class="jxr_keyword">true</strong>
-<a class="jxr_linenumber" name="L158" href="#L158">158</a>             );
-<a class="jxr_linenumber" name="L159" href="#L159">159</a> 
-<a class="jxr_linenumber" name="L160" href="#L160">160</a>         String 
soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
-<a class="jxr_linenumber" name="L161" href="#L161">161</a>         String 
soapPrefix =
-<a class="jxr_linenumber" name="L162" href="#L162">162</a>             
XMLUtils.setNamespace(
-<a class="jxr_linenumber" name="L163" href="#L163">163</a>                 
securityHeader, soapNamespace, WSConstants.DEFAULT_SOAP_PREFIX
-<a class="jxr_linenumber" name="L164" href="#L164">164</a>             );
-<a class="jxr_linenumber" name="L165" href="#L165">165</a> 
-<a class="jxr_linenumber" name="L166" href="#L166">166</a>         <strong 
class="jxr_keyword">if</strong> (actor != <strong 
class="jxr_keyword">null</strong> &amp;&amp; actor.length() &gt; 0) {
-<a class="jxr_linenumber" name="L167" href="#L167">167</a>             String 
actorLocal = WSConstants.ATTR_ACTOR;
-<a class="jxr_linenumber" name="L168" href="#L168">168</a>             <strong 
class="jxr_keyword">if</strong> 
(WSConstants.URI_SOAP12_ENV.equals(soapNamespace)) {
-<a class="jxr_linenumber" name="L169" href="#L169">169</a>                 
actorLocal = WSConstants.ATTR_ROLE;
-<a class="jxr_linenumber" name="L170" href="#L170">170</a>             }
-<a class="jxr_linenumber" name="L171" href="#L171">171</a>             
securityHeader.setAttributeNS(
-<a class="jxr_linenumber" name="L172" href="#L172">172</a>                 
soapNamespace,
-<a class="jxr_linenumber" name="L173" href="#L173">173</a>                 
soapPrefix + <span class="jxr_string">":"</span> + actorLocal,
-<a class="jxr_linenumber" name="L174" href="#L174">174</a>                 
actor
-<a class="jxr_linenumber" name="L175" href="#L175">175</a>             );
-<a class="jxr_linenumber" name="L176" href="#L176">176</a>         }
-<a class="jxr_linenumber" name="L177" href="#L177">177</a>         <strong 
class="jxr_keyword">if</strong> (mustunderstand) {
-<a class="jxr_linenumber" name="L178" href="#L178">178</a>             String 
mustUnderstandLocal = <span class="jxr_string">"1"</span>;
-<a class="jxr_linenumber" name="L179" href="#L179">179</a>             <strong 
class="jxr_keyword">if</strong> 
(WSConstants.URI_SOAP12_ENV.equals(soapNamespace)) {
-<a class="jxr_linenumber" name="L180" href="#L180">180</a>                 
mustUnderstandLocal = <span class="jxr_string">"true"</span>;
-<a class="jxr_linenumber" name="L181" href="#L181">181</a>             }
-<a class="jxr_linenumber" name="L182" href="#L182">182</a>             
securityHeader.setAttributeNS(
-<a class="jxr_linenumber" name="L183" href="#L183">183</a>                 
soapNamespace,
-<a class="jxr_linenumber" name="L184" href="#L184">184</a>                 
soapPrefix + <span class="jxr_string">":"</span> + 
WSConstants.ATTR_MUST_UNDERSTAND,
-<a class="jxr_linenumber" name="L185" href="#L185">185</a>                 
mustUnderstandLocal
-<a class="jxr_linenumber" name="L186" href="#L186">186</a>             );
-<a class="jxr_linenumber" name="L187" href="#L187">187</a>         }
-<a class="jxr_linenumber" name="L188" href="#L188">188</a>         
XMLUtils.setNamespace(securityHeader, WSConstants.WSU_NS, 
WSConstants.WSU_PREFIX);
-<a class="jxr_linenumber" name="L189" href="#L189">189</a> 
-<a class="jxr_linenumber" name="L190" href="#L190">190</a>         <strong 
class="jxr_keyword">return</strong> securityHeader;
-<a class="jxr_linenumber" name="L191" href="#L191">191</a>     }
-<a class="jxr_linenumber" name="L192" href="#L192">192</a> 
-<a class="jxr_linenumber" name="L193" href="#L193">193</a>     <strong 
class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> 
removeSecurityHeader() <strong class="jxr_keyword">throws</strong> 
WSSecurityException {
-<a class="jxr_linenumber" name="L194" href="#L194">194</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader == <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L195" href="#L195">195</a>             <strong 
class="jxr_keyword">if</strong> (doc == <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L196" href="#L196">196</a>                 
<strong class="jxr_keyword">throw</strong> <strong 
class="jxr_keyword">new</strong> <a 
href="../../../../../org/apache/wss4j/common/ext/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.ErrorCode.FAILURE,
 <span class="jxr_string">"empty"</span>,
-<a class="jxr_linenumber" name="L197" href="#L197">197</a>                     
                          <strong class="jxr_keyword">new</strong> Object[] 
{<span class="jxr_string">"The Document of WSSecHeader is null"</span>});
-<a class="jxr_linenumber" name="L198" href="#L198">198</a>             }
-<a class="jxr_linenumber" name="L199" href="#L199">199</a> 
-<a class="jxr_linenumber" name="L200" href="#L200">200</a>             
securityHeader =
-<a class="jxr_linenumber" name="L201" href="#L201">201</a>                 
WSSecurityUtil.findWsseSecurityHeaderBlock(
-<a class="jxr_linenumber" name="L202" href="#L202">202</a>                     
doc, doc.getDocumentElement(), actor, false
-<a class="jxr_linenumber" name="L203" href="#L203">203</a>                 );
-<a class="jxr_linenumber" name="L204" href="#L204">204</a>         }
-<a class="jxr_linenumber" name="L205" href="#L205">205</a> 
-<a class="jxr_linenumber" name="L206" href="#L206">206</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader != <strong 
class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L207" href="#L207">207</a>             Node 
parent = securityHeader.getParentNode();
-<a class="jxr_linenumber" name="L208" href="#L208">208</a>             
parent.removeChild(securityHeader);
-<a class="jxr_linenumber" name="L209" href="#L209">209</a>         }
-<a class="jxr_linenumber" name="L210" href="#L210">210</a>     }
-<a class="jxr_linenumber" name="L211" href="#L211">211</a> 
-<a class="jxr_linenumber" name="L212" href="#L212">212</a> }
+<a class="jxr_linenumber" name="L105" href="#L105">105</a>     <em 
class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L106" href="#L106">106</a> <em 
class="jxr_javadoccomment">     * Get the security header element of this 
instance.</em>
+<a class="jxr_linenumber" name="L107" href="#L107">107</a> <em 
class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L108" href="#L108">108</a> <em 
class="jxr_javadoccomment">     * @return The security header element.</em>
+<a class="jxr_linenumber" name="L109" href="#L109">109</a> <em 
class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L110" href="#L110">110</a>     <strong 
class="jxr_keyword">public</strong> Element getSecurityHeaderElement() {
+<a class="jxr_linenumber" name="L111" href="#L111">111</a>         <strong 
class="jxr_keyword">return</strong> securityHeader;
+<a class="jxr_linenumber" name="L112" href="#L112">112</a>     }
+<a class="jxr_linenumber" name="L113" href="#L113">113</a> 
+<a class="jxr_linenumber" name="L114" href="#L114">114</a>     <strong 
class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> 
setSecurityHeaderElement(Element securityHeaderElement) {
+<a class="jxr_linenumber" name="L115" href="#L115">115</a>         <strong 
class="jxr_keyword">this</strong>.securityHeader = securityHeaderElement;
+<a class="jxr_linenumber" name="L116" href="#L116">116</a>     }
+<a class="jxr_linenumber" name="L117" href="#L117">117</a> 
+<a class="jxr_linenumber" name="L118" href="#L118">118</a>     <em 
class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L119" href="#L119">119</a> <em 
class="jxr_javadoccomment">     * Returns whether the security header is 
empty</em>
+<a class="jxr_linenumber" name="L120" href="#L120">120</a> <em 
class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L121" href="#L121">121</a> <em 
class="jxr_javadoccomment">     * @return true if empty or if there is no 
security header</em>
+<a class="jxr_linenumber" name="L122" href="#L122">122</a> <em 
class="jxr_javadoccomment">     *         false if non empty security 
header</em>
+<a class="jxr_linenumber" name="L123" href="#L123">123</a> <em 
class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L124" href="#L124">124</a>     <strong 
class="jxr_keyword">public</strong> <strong 
class="jxr_keyword">boolean</strong> isEmpty() <strong 
class="jxr_keyword">throws</strong> WSSecurityException {
+<a class="jxr_linenumber" name="L125" href="#L125">125</a>         <strong 
class="jxr_keyword">if</strong> (doc == <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L126" href="#L126">126</a>             <strong 
class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a 
href="../../../../../org/apache/wss4j/common/ext/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.ErrorCode.FAILURE,
 <span class="jxr_string">"empty"</span>,
+<a class="jxr_linenumber" name="L127" href="#L127">127</a>                     
                      <strong class="jxr_keyword">new</strong> Object[] {<span 
class="jxr_string">"The Document of WSSecHeader is null"</span>});
+<a class="jxr_linenumber" name="L128" href="#L128">128</a>         }
+<a class="jxr_linenumber" name="L129" href="#L129">129</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader == <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L130" href="#L130">130</a>             
securityHeader =
+<a class="jxr_linenumber" name="L131" href="#L131">131</a>                 
WSSecurityUtil.findWsseSecurityHeaderBlock(
+<a class="jxr_linenumber" name="L132" href="#L132">132</a>                     
doc, doc.getDocumentElement(), actor, false
+<a class="jxr_linenumber" name="L133" href="#L133">133</a>                 );
+<a class="jxr_linenumber" name="L134" href="#L134">134</a>         }
+<a class="jxr_linenumber" name="L135" href="#L135">135</a> 
+<a class="jxr_linenumber" name="L136" href="#L136">136</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader == <strong 
class="jxr_keyword">null</strong> || securityHeader.getFirstChild() == <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L137" href="#L137">137</a>             <strong 
class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="L138" href="#L138">138</a>         }
+<a class="jxr_linenumber" name="L139" href="#L139">139</a>         <strong 
class="jxr_keyword">return</strong> false;
+<a class="jxr_linenumber" name="L140" href="#L140">140</a>     }
+<a class="jxr_linenumber" name="L141" href="#L141">141</a> 
+<a class="jxr_linenumber" name="L142" href="#L142">142</a>     <em 
class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L143" href="#L143">143</a> <em 
class="jxr_javadoccomment">     * Creates a security header and inserts it as 
child into the SOAP Envelope.</em>
+<a class="jxr_linenumber" name="L144" href="#L144">144</a> <em 
class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L145" href="#L145">145</a> <em 
class="jxr_javadoccomment">     * Check if a WS Security header block for an 
actor is already available in</em>
+<a class="jxr_linenumber" name="L146" href="#L146">146</a> <em 
class="jxr_javadoccomment">     * the document. If a header block is found 
return it, otherwise a new</em>
+<a class="jxr_linenumber" name="L147" href="#L147">147</a> <em 
class="jxr_javadoccomment">     * wsse:Security header block is created and the 
attributes set</em>
+<a class="jxr_linenumber" name="L148" href="#L148">148</a> <em 
class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L149" href="#L149">149</a> <em 
class="jxr_javadoccomment">     * @return A 
&lt;code&gt;wsse:Security&lt;/code&gt; element</em>
+<a class="jxr_linenumber" name="L150" href="#L150">150</a> <em 
class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L151" href="#L151">151</a>     <strong 
class="jxr_keyword">public</strong> Element insertSecurityHeader() <strong 
class="jxr_keyword">throws</strong> WSSecurityException {
+<a class="jxr_linenumber" name="L152" href="#L152">152</a>         <em 
class="jxr_comment">//</em>
+<a class="jxr_linenumber" name="L153" href="#L153">153</a>         <em 
class="jxr_comment">// If there is already a security header in this instance 
just return it</em>
+<a class="jxr_linenumber" name="L154" href="#L154">154</a>         <em 
class="jxr_comment">//</em>
+<a class="jxr_linenumber" name="L155" href="#L155">155</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader != <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L156" href="#L156">156</a>             <strong 
class="jxr_keyword">return</strong> securityHeader;
+<a class="jxr_linenumber" name="L157" href="#L157">157</a>         }
+<a class="jxr_linenumber" name="L158" href="#L158">158</a> 
+<a class="jxr_linenumber" name="L159" href="#L159">159</a>         <strong 
class="jxr_keyword">if</strong> (doc == <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L160" href="#L160">160</a>             <strong 
class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a 
href="../../../../../org/apache/wss4j/common/ext/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.ErrorCode.FAILURE,
 <span class="jxr_string">"empty"</span>,
+<a class="jxr_linenumber" name="L161" href="#L161">161</a>                     
                      <strong class="jxr_keyword">new</strong> Object[] {<span 
class="jxr_string">"The Document of WSSecHeader is null"</span>});
+<a class="jxr_linenumber" name="L162" href="#L162">162</a>         }
+<a class="jxr_linenumber" name="L163" href="#L163">163</a> 
+<a class="jxr_linenumber" name="L164" href="#L164">164</a>         
securityHeader =
+<a class="jxr_linenumber" name="L165" href="#L165">165</a>             
WSSecurityUtil.findWsseSecurityHeaderBlock(
+<a class="jxr_linenumber" name="L166" href="#L166">166</a>                 
doc, doc.getDocumentElement(), actor, <strong class="jxr_keyword">true</strong>
+<a class="jxr_linenumber" name="L167" href="#L167">167</a>             );
+<a class="jxr_linenumber" name="L168" href="#L168">168</a> 
+<a class="jxr_linenumber" name="L169" href="#L169">169</a>         String 
soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
+<a class="jxr_linenumber" name="L170" href="#L170">170</a>         String 
soapPrefix =
+<a class="jxr_linenumber" name="L171" href="#L171">171</a>             
XMLUtils.setNamespace(
+<a class="jxr_linenumber" name="L172" href="#L172">172</a>                 
securityHeader, soapNamespace, WSConstants.DEFAULT_SOAP_PREFIX
+<a class="jxr_linenumber" name="L173" href="#L173">173</a>             );
+<a class="jxr_linenumber" name="L174" href="#L174">174</a> 
+<a class="jxr_linenumber" name="L175" href="#L175">175</a>         <strong 
class="jxr_keyword">if</strong> (actor != <strong 
class="jxr_keyword">null</strong> &amp;&amp; actor.length() &gt; 0) {
+<a class="jxr_linenumber" name="L176" href="#L176">176</a>             String 
actorLocal = WSConstants.ATTR_ACTOR;
+<a class="jxr_linenumber" name="L177" href="#L177">177</a>             <strong 
class="jxr_keyword">if</strong> 
(WSConstants.URI_SOAP12_ENV.equals(soapNamespace)) {
+<a class="jxr_linenumber" name="L178" href="#L178">178</a>                 
actorLocal = WSConstants.ATTR_ROLE;
+<a class="jxr_linenumber" name="L179" href="#L179">179</a>             }
+<a class="jxr_linenumber" name="L180" href="#L180">180</a>             
securityHeader.setAttributeNS(
+<a class="jxr_linenumber" name="L181" href="#L181">181</a>                 
soapNamespace,
+<a class="jxr_linenumber" name="L182" href="#L182">182</a>                 
soapPrefix + <span class="jxr_string">":"</span> + actorLocal,
+<a class="jxr_linenumber" name="L183" href="#L183">183</a>                 
actor
+<a class="jxr_linenumber" name="L184" href="#L184">184</a>             );
+<a class="jxr_linenumber" name="L185" href="#L185">185</a>         }
+<a class="jxr_linenumber" name="L186" href="#L186">186</a>         <strong 
class="jxr_keyword">if</strong> (mustunderstand) {
+<a class="jxr_linenumber" name="L187" href="#L187">187</a>             String 
mustUnderstandLocal = <span class="jxr_string">"1"</span>;
+<a class="jxr_linenumber" name="L188" href="#L188">188</a>             <strong 
class="jxr_keyword">if</strong> 
(WSConstants.URI_SOAP12_ENV.equals(soapNamespace)) {
+<a class="jxr_linenumber" name="L189" href="#L189">189</a>                 
mustUnderstandLocal = <span class="jxr_string">"true"</span>;
+<a class="jxr_linenumber" name="L190" href="#L190">190</a>             }
+<a class="jxr_linenumber" name="L191" href="#L191">191</a>             
securityHeader.setAttributeNS(
+<a class="jxr_linenumber" name="L192" href="#L192">192</a>                 
soapNamespace,
+<a class="jxr_linenumber" name="L193" href="#L193">193</a>                 
soapPrefix + <span class="jxr_string">":"</span> + 
WSConstants.ATTR_MUST_UNDERSTAND,
+<a class="jxr_linenumber" name="L194" href="#L194">194</a>                 
mustUnderstandLocal
+<a class="jxr_linenumber" name="L195" href="#L195">195</a>             );
+<a class="jxr_linenumber" name="L196" href="#L196">196</a>         }
+<a class="jxr_linenumber" name="L197" href="#L197">197</a>         
XMLUtils.setNamespace(securityHeader, WSConstants.WSU_NS, 
WSConstants.WSU_PREFIX);
+<a class="jxr_linenumber" name="L198" href="#L198">198</a> 
+<a class="jxr_linenumber" name="L199" href="#L199">199</a>         <strong 
class="jxr_keyword">return</strong> securityHeader;
+<a class="jxr_linenumber" name="L200" href="#L200">200</a>     }
+<a class="jxr_linenumber" name="L201" href="#L201">201</a> 
+<a class="jxr_linenumber" name="L202" href="#L202">202</a>     <strong 
class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> 
removeSecurityHeader() <strong class="jxr_keyword">throws</strong> 
WSSecurityException {
+<a class="jxr_linenumber" name="L203" href="#L203">203</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader == <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L204" href="#L204">204</a>             <strong 
class="jxr_keyword">if</strong> (doc == <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L205" href="#L205">205</a>                 
<strong class="jxr_keyword">throw</strong> <strong 
class="jxr_keyword">new</strong> <a 
href="../../../../../org/apache/wss4j/common/ext/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.ErrorCode.FAILURE,
 <span class="jxr_string">"empty"</span>,
+<a class="jxr_linenumber" name="L206" href="#L206">206</a>                     
                          <strong class="jxr_keyword">new</strong> Object[] 
{<span class="jxr_string">"The Document of WSSecHeader is null"</span>});
+<a class="jxr_linenumber" name="L207" href="#L207">207</a>             }
+<a class="jxr_linenumber" name="L208" href="#L208">208</a> 
+<a class="jxr_linenumber" name="L209" href="#L209">209</a>             
securityHeader =
+<a class="jxr_linenumber" name="L210" href="#L210">210</a>                 
WSSecurityUtil.findWsseSecurityHeaderBlock(
+<a class="jxr_linenumber" name="L211" href="#L211">211</a>                     
doc, doc.getDocumentElement(), actor, false
+<a class="jxr_linenumber" name="L212" href="#L212">212</a>                 );
+<a class="jxr_linenumber" name="L213" href="#L213">213</a>         }
+<a class="jxr_linenumber" name="L214" href="#L214">214</a> 
+<a class="jxr_linenumber" name="L215" href="#L215">215</a>         <strong 
class="jxr_keyword">if</strong> (securityHeader != <strong 
class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="L216" href="#L216">216</a>             Node 
parent = securityHeader.getParentNode();
+<a class="jxr_linenumber" name="L217" href="#L217">217</a>             
parent.removeChild(securityHeader);
+<a class="jxr_linenumber" name="L218" href="#L218">218</a>         }
+<a class="jxr_linenumber" name="L219" href="#L219">219</a>     }
+<a class="jxr_linenumber" name="L220" href="#L220">220</a> 
+<a class="jxr_linenumber" name="L221" href="#L221">221</a> }
 </pre>
 <hr/>
 <div id="footer">Copyright &#169; 2004&#x2013;2017 <a 
href="http://www.apache.org/";>The Apache Software Foundation</a>. All rights 
reserved.</div>


Reply via email to