| <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>RampartSender.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Coverage Report</a> > <a href="index.source.html" class="el_package">org.apache.rampart.handler</a> > <span class="el_source">RampartSender.java</span></div><h1>RampartSender.java</h1><pre class="source lang-java linenums">/* |
| * Copyright 2004,2005 The Apache Software Foundation. |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package org.apache.rampart.handler; |
| |
| import org.apache.axis2.AxisFault; |
| import org.apache.axis2.context.MessageContext; |
| import org.apache.axis2.description.HandlerDescription; |
| import org.apache.axis2.description.Parameter; |
| import org.apache.axis2.engine.Handler; |
| import org.apache.commons.logging.Log; |
| import org.apache.commons.logging.LogFactory; |
| import org.apache.rampart.MessageBuilder; |
| import org.apache.rampart.RampartConstants; |
| import org.apache.rampart.RampartException; |
| import org.apache.ws.secpolicy.WSSPolicyException; |
| import org.apache.ws.security.WSSecurityException; |
| |
| /** |
| * Rampart outflow handler. |
| * This constructs the secured message according to the effective policy. |
| */ |
| public class RampartSender implements Handler { |
| |
| <span class="fc" id="L38"> private static Log mlog = LogFactory.getLog(RampartConstants.MESSAGE_LOG);</span> |
| |
| <span class="fc" id="L40"> private static HandlerDescription EMPTY_HANDLER_METADATA =</span> |
| new HandlerDescription("default Handler"); |
| |
| private HandlerDescription handlerDesc; |
| |
| <span class="fc" id="L45"> public RampartSender() {</span> |
| <span class="fc" id="L46"> this.handlerDesc = EMPTY_HANDLER_METADATA;</span> |
| <span class="fc" id="L47"> }</span> |
| |
| public void cleanup() { |
| <span class="nc" id="L50"> }</span> |
| |
| public void init(HandlerDescription handlerdesc) { |
| <span class="fc" id="L53"> this.handlerDesc = handlerdesc;</span> |
| <span class="fc" id="L54"> }</span> |
| |
| public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { |
| |
| <span class="fc bfc" id="L58" title="All 2 branches covered."> if (!msgContext.isEngaged(WSSHandlerConstants.SECURITY_MODULE_NAME)) {</span> |
| <span class="fc" id="L59"> return InvocationResponse.CONTINUE;</span> |
| } |
| |
| |
| <span class="fc" id="L63"> MessageBuilder builder = new MessageBuilder();</span> |
| try { |
| <span class="fc" id="L65"> builder.build(msgContext);</span> |
| <span class="nc" id="L66"> } catch (WSSecurityException e) {</span> |
| <span class="nc" id="L67"> throw new AxisFault(e.getMessage(), e);</span> |
| <span class="nc" id="L68"> } catch (WSSPolicyException e) {</span> |
| <span class="nc" id="L69"> throw new AxisFault(e.getMessage(), e);</span> |
| <span class="nc" id="L70"> } catch (RampartException e) {</span> |
| // If a framework exception is occurred while processing a security fault |
| // send the original fault to the client. |
| <span class="nc bnc" id="L73" title="All 2 branches missed."> if (msgContext.isProcessingFault()) {</span> |
| <span class="nc" id="L74"> return InvocationResponse.CONTINUE;</span> |
| } else { |
| <span class="nc" id="L76"> throw new AxisFault(e.getMessage(), e);</span> |
| } |
| <span class="fc" id="L78"> }</span> |
| |
| <span class="pc bpc" id="L80" title="1 of 2 branches missed."> if(mlog.isDebugEnabled()){</span> |
| <span class="nc" id="L81"> mlog.debug("*********************** RampartSender sent out \n" + </span> |
| msgContext.getEnvelope()); |
| } |
| |
| <span class="fc" id="L85"> return InvocationResponse.CONTINUE; </span> |
| } |
| |
| public void flowComplete(MessageContext msgContext) |
| { |
| <span class="fc" id="L90"> }</span> |
| |
| public HandlerDescription getHandlerDesc() { |
| <span class="fc" id="L93"> return this.handlerDesc;</span> |
| } |
| |
| public String getName() { |
| <span class="nc" id="L97"> return "Apache Rampart outflow handler";</span> |
| } |
| |
| public Parameter getParameter(String name) { |
| <span class="nc" id="L101"> return this.handlerDesc.getParameter(name);</span> |
| } |
| |
| } |
| </pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.5.201505241946</span></div></body></html> |