View Javadoc

1   /*
2    * Copyright 2005-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.soap.saaj;
18  
19  import javax.xml.soap.SOAPException;
20  import javax.xml.soap.SOAPHeaderElement;
21  import javax.xml.transform.Result;
22  
23  import org.springframework.ws.soap.SoapHeaderElement;
24  import org.springframework.ws.soap.SoapHeaderException;
25  
26  /**
27   * SAAJ-specific implementation of the <code>SoapHeaderElement</code> interface. Wraps a [email protected]
28   * javax.xml.soap.SOAPHeaderElement}.
29   *
30   * @author Arjen Poutsma
31   * @since 1.0.0
32   */
33  class SaajSoapHeaderElement extends SaajSoapElement<SOAPHeaderElement> implements SoapHeaderElement {
34  
35      SaajSoapHeaderElement(SOAPHeaderElement headerElement) {
36          super(headerElement);
37      }
38  
39      public Result getResult() throws SoapHeaderException {
40          return getImplementation().getResult(getSaajElement());
41      }
42  
43      public String getActorOrRole() throws SoapHeaderException {
44          return getImplementation().getActorOrRole(getSaajHeaderElement());
45      }
46  
47      public void setActorOrRole(String actorOrRole) throws SoapHeaderException {
48          getImplementation().setActorOrRole(getSaajHeaderElement(), actorOrRole);
49      }
50  
51      public boolean getMustUnderstand() throws SoapHeaderException {
52          return getImplementation().getMustUnderstand(getSaajHeaderElement());
53      }
54  
55      public void setMustUnderstand(boolean mustUnderstand) throws SoapHeaderException {
56          getImplementation().setMustUnderstand(getSaajHeaderElement(), mustUnderstand);
57      }
58  
59      public String getText() {
60          return getImplementation().getText(getSaajHeaderElement());
61      }
62  
63      public void setText(String content) {
64          try {
65              getImplementation().setText(getSaajHeaderElement(), content);
66          }
67          catch (SOAPException ex) {
68              throw new SaajSoapHeaderException(ex);
69          }
70      }
71  
72      protected SOAPHeaderElement getSaajHeaderElement() {
73          return (SOAPHeaderElement) getSaajElement();
74      }
75  
76  }