Java Doc for Header.java in  » 6.0-JDK-Modules » jax-ws-runtime » com » sun » xml » ws » api » message » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » jax ws runtime » com.sun.xml.ws.api.message 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.sun.xml.ws.api.message.Header

All known Subclasses:   com.sun.xml.ws.message.AbstractHeaderImpl,
Header
public interface Header (Code)
A SOAP header.

A header is immutable, but unlike body it can be read multiple times. The Header abstraction hides how the header data is represented in memory; instead, it commits to the ability to write itself to XML infoset.

When a message is received from the transport and being processed, the processor needs to "peek" some information of a header, such as the tag name, the mustUnderstand attribute, and so on. Therefore, the Header interface exposes those information as properties, so that they can be checked without replaying the infoset, which is efficiently but still costly.

A Header may belong to more than one HeaderList due to wrapping of Message .
See Also:   HeaderList
See Also:   Headers





Method Summary
 StringgetAttribute(String nsUri, String localName)
     Gets the attribute value on the header element.
Parameters:
  nsUri - The namespace URI of the attribute.
 StringgetAttribute(QName name)
     Gets the attribute value on the header element.
public  StringgetLocalPart()
     Gets the local name of this header element.
public  StringgetNamespaceURI()
     Gets the namespace URI of this header element.
public  StringgetRole(SOAPVersion soapVersion)
     Gets the value of the soap:role attribute (or soap:actor for SOAP 1.1).

If the attribute is omitted, the value defaults to SOAPVersion.implicitRole .
Parameters:
  soapVersion - The caller specifies the SOAP version that the pipeline is working against.Often each Header implementation already knows the SOAP versionanyway, but this allows some Headers to avoid keeping it.That's why this redundant parameter is passed in.never null.

public  StringgetStringContent()
     Used to obtain value XYZ from a header that looks like "<header>XYZ</header>".
public  booleanisIgnorable(SOAPVersion soapVersion, Set<String> roles)
     Checks if this header is ignorable for us (IOW, make sure that this header has a problematic "mustUnderstand" header value that we have to reject.)

This method is used as a part of the mustUnderstanx processing. At the end of the processing, the JAX-WS identifies a list of Header s that were not understood.

public  booleanisRelay()
     True if this header is to be relayed if not processed.
public  WSEndpointReferencereadAsEPR(AddressingVersion expected)
     Reads this header as an WSEndpointReference .
public  TreadAsJAXB(Unmarshaller unmarshaller)
     Reads the header as a JAXB object by using the given unmarshaller.
public  TreadAsJAXB(Bridge<T> bridge)
     Reads the header as a JAXB object by using the given unmarshaller.
public  XMLStreamReaderreadHeader()
     Reads the header as a XMLStreamReader .

The returned parser points at the start element of this header. (IOW, XMLStreamReader.getEventType would return XMLStreamReader.START_ELEMENT .

Performance Expectation

For some Header implementations, this operation is a non-trivial operation.

public  voidwriteTo(XMLStreamWriter w)
     Writes out the header as a fragment.
throws:
  XMLStreamException - if the operation fails for some reason.
public  voidwriteTo(SOAPMessage saaj)
     Writes out the header to the given SOAPMessage.

Sometimes a Message needs to produce itself as SOAPMessage , in which case each header needs to turn itself into a header.
throws:
  SOAPException - if the operation fails for some reason.

public  voidwriteTo(ContentHandler contentHandler, ErrorHandler errorHandler)
     Writes out the header as SAX events.

Sometimes a Message needs to produce SAX events, and this method is necessary for headers to participate to it.

A header is responsible for producing the SAX events for its part, including startPrefixMapping and endPrefixMapping, but not startDocument/endDocument.

Note that SAX contract requires that any error that does NOT originate from ContentHandler (meaning any parsing error and etc) must be first reported to ErrorHandler .




Method Detail
getAttribute
String getAttribute(String nsUri, String localName)(Code)
Gets the attribute value on the header element.
Parameters:
  nsUri - The namespace URI of the attribute. Can be empty.
Parameters:
  localName - The local name of the attribute.if the attribute is found, return the whitespace normalized value.(meaning no leading/trailing space, no consequtive whitespaces in-between.)Otherwise null. Note that the XML parsers are responsible forwhitespace-normalizing attributes, so Header implementationdoesn't have to do anything.



getAttribute
String getAttribute(QName name)(Code)
Gets the attribute value on the header element.

This is a convenience method that calls into Header.getAttribute(String,String)
Parameters:
  name - Never null.
See Also:   Header.getAttribute(String,String)




getLocalPart
public String getLocalPart()(Code)
Gets the local name of this header element. this string must be interned.



getNamespaceURI
public String getNamespaceURI()(Code)
Gets the namespace URI of this header element. this string must be interned.



getRole
public String getRole(SOAPVersion soapVersion)(Code)
Gets the value of the soap:role attribute (or soap:actor for SOAP 1.1).

If the attribute is omitted, the value defaults to SOAPVersion.implicitRole .
Parameters:
  soapVersion - The caller specifies the SOAP version that the pipeline is working against.Often each Header implementation already knows the SOAP versionanyway, but this allows some Headers to avoid keeping it.That's why this redundant parameter is passed in.never null. This string need not be interned.




getStringContent
public String getStringContent()(Code)
Used to obtain value XYZ from a header that looks like "<header>XYZ</header>". The primary use of this header for now is to access certain Addressing headers quickly.
throws:
  WebServiceException - If the structure of the header is more complicated thana simple string header.Can be empty but always non-null.



isIgnorable
public boolean isIgnorable(SOAPVersion soapVersion, Set<String> roles)(Code)
Checks if this header is ignorable for us (IOW, make sure that this header has a problematic "mustUnderstand" header value that we have to reject.)

This method is used as a part of the mustUnderstanx processing. At the end of the processing, the JAX-WS identifies a list of Header s that were not understood. This method is invoked on those Header s, to verify that we don't need to report an error for it.

specifically, this method has to perform the following tasks:

  • If this header does not have mustUnderstand as "1" nor "true", then this method must return true.
  • Otherwise, check the role attribute (for SOAP 1.2) or the actor attribute (for SOAP 1.1). When those attributes are absent, the default values have to be assumed. See Header.getRole(SOAPVersion) for how the values are defaulted. Now, see if the roles set contains the value. If so, this method must return false (indicating that an error is in order.)
  • Otherwise return true (since we don't play the role this header is intended for.)

Parameters:
  soapVersion - The caller specifies the SOAP version that the pipeline is working against.Often each Header implementation already knows the SOAP versionanyway, but this allows some Headers to avoid keeping it.That's why this redundant parameter is passed in.
Parameters:
  roles - The set of role values that the current JAX-WS pipeline is assuming.Note that SOAP 1.1 and SOAP 1.2 use different strings for the same role,and the caller is responsible for supplying a proper value depending on theactive SOAP version in use.true if no error needs to be reported. False if an error needs to be raised.See the method javadoc for more discussion.



isRelay
public boolean isRelay()(Code)
True if this header is to be relayed if not processed. For SOAP 1.1 messages, this method always return false.

IOW, this method returns true if there's @soap:relay='true' is present.

Implementation Note

The implementation needs to check for both "true" and "1", but because attribute values are normalized, it doesn't have to consider " true", " 1 ", and so on. false.




readAsEPR
public WSEndpointReference readAsEPR(AddressingVersion expected) throws XMLStreamException(Code)
Reads this header as an WSEndpointReference .
Parameters:
  expected - The version of the addressing used to parse the EPR.If the actual infoset and this doesn't agree, thenyou'll get an WebServiceException stating that fact.On a successful return, this method never returns null.



readAsJAXB
public T readAsJAXB(Unmarshaller unmarshaller) throws JAXBException(Code)
Reads the header as a JAXB object by using the given unmarshaller.



readAsJAXB
public T readAsJAXB(Bridge<T> bridge) throws JAXBException(Code)
Reads the header as a JAXB object by using the given unmarshaller.



readHeader
public XMLStreamReader readHeader() throws XMLStreamException(Code)
Reads the header as a XMLStreamReader .

The returned parser points at the start element of this header. (IOW, XMLStreamReader.getEventType would return XMLStreamReader.START_ELEMENT .

Performance Expectation

For some Header implementations, this operation is a non-trivial operation. Therefore, use of this method is discouraged unless the caller is interested in reading the whole header.

Similarly, if the caller wants to use this method only to do the API conversion (such as simply firing SAX events from XMLStreamReader ), then the JAX-WS team requests that you talk to us.

Message s that come from tranport usually provides a reasonably efficient implementation of this method. must not null.




writeTo
public void writeTo(XMLStreamWriter w) throws XMLStreamException(Code)
Writes out the header as a fragment.
throws:
  XMLStreamException - if the operation fails for some reason. This leaves thewriter to an undefined state.



writeTo
public void writeTo(SOAPMessage saaj) throws SOAPException(Code)
Writes out the header to the given SOAPMessage.

Sometimes a Message needs to produce itself as SOAPMessage , in which case each header needs to turn itself into a header.
throws:
  SOAPException - if the operation fails for some reason. This leaves thewriter to an undefined state.




writeTo
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException(Code)
Writes out the header as SAX events.

Sometimes a Message needs to produce SAX events, and this method is necessary for headers to participate to it.

A header is responsible for producing the SAX events for its part, including startPrefixMapping and endPrefixMapping, but not startDocument/endDocument.

Note that SAX contract requires that any error that does NOT originate from ContentHandler (meaning any parsing error and etc) must be first reported to ErrorHandler . If the SAX event production cannot be continued and the processing needs to abort, the code may then throw the same SAXParseException reported to ErrorHandler .
Parameters:
  contentHandler - The ContentHandler that receives SAX events.
Parameters:
  errorHandler - The ErrorHandler that receives parsing errors.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.