< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/AbstractHeaderImpl.java

Print this page




 111     }
 112 
 113     public @NotNull String getRole(@NotNull SOAPVersion soapVersion) {
 114         String v = getAttribute(soapVersion.nsUri, soapVersion.roleAttributeName);
 115         if(v==null)
 116             v = soapVersion.implicitRole;
 117         return v;
 118     }
 119 
 120     public boolean isRelay() {
 121         String v = getAttribute(SOAPVersion.SOAP_12.nsUri,"relay");
 122         if(v==null) return false;   // on SOAP 1.1 message there shouldn't be such an attribute, so this works fine
 123         return parseBool(v);
 124     }
 125 
 126     public String getAttribute(QName name) {
 127         return getAttribute(name.getNamespaceURI(),name.getLocalPart());
 128     }
 129 
 130     /**
 131      * Parses a string that looks like <tt>xs:boolean</tt> into boolean.
 132      *
 133      * This method assumes that the whilespace normalization has already taken place.
 134      */
 135     protected final boolean parseBool(String value) {
 136         if(value.length()==0)
 137             return false;
 138 
 139         char ch = value.charAt(0);
 140         return ch=='t' || ch=='1';
 141     }
 142 
 143     public String getStringContent() {
 144         try {
 145             XMLStreamReader xsr = readHeader();
 146             xsr.nextTag();
 147             return xsr.getElementText();
 148         } catch (XMLStreamException e) {
 149             return null;
 150         }
 151     }


 111     }
 112 
 113     public @NotNull String getRole(@NotNull SOAPVersion soapVersion) {
 114         String v = getAttribute(soapVersion.nsUri, soapVersion.roleAttributeName);
 115         if(v==null)
 116             v = soapVersion.implicitRole;
 117         return v;
 118     }
 119 
 120     public boolean isRelay() {
 121         String v = getAttribute(SOAPVersion.SOAP_12.nsUri,"relay");
 122         if(v==null) return false;   // on SOAP 1.1 message there shouldn't be such an attribute, so this works fine
 123         return parseBool(v);
 124     }
 125 
 126     public String getAttribute(QName name) {
 127         return getAttribute(name.getNamespaceURI(),name.getLocalPart());
 128     }
 129 
 130     /**
 131      * Parses a string that looks like {@code xs:boolean} into boolean.
 132      *
 133      * This method assumes that the whilespace normalization has already taken place.
 134      */
 135     protected final boolean parseBool(String value) {
 136         if(value.length()==0)
 137             return false;
 138 
 139         char ch = value.charAt(0);
 140         return ch=='t' || ch=='1';
 141     }
 142 
 143     public String getStringContent() {
 144         try {
 145             XMLStreamReader xsr = readHeader();
 146             xsr.nextTag();
 147             return xsr.getElementText();
 148         } catch (XMLStreamException e) {
 149             return null;
 150         }
 151     }
< prev index next >