Source Code Cross Referenced for SecurityHeaderWrapper.java in  » 6.0-JDK-Modules-com.sun » xws-security » com » sun » xml » ws » security » opt » impl » 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 com.sun » xws security » com.sun.xml.ws.security.opt.impl.message 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms
003:         * of the Common Development and Distribution License
004:         * (the License).  You may not use this file except in
005:         * compliance with the License.
006:         *
007:         * You can obtain a copy of the license at
008:         * https://glassfish.dev.java.net/public/CDDLv1.0.html.
009:         * See the License for the specific language governing
010:         * permissions and limitations under the License.
011:         *
012:         * When distributing Covered Code, include this CDDL
013:         * Header Notice in each file and include the License file
014:         * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
015:         * If applicable, add the following below the CDDL Header,
016:         * with the fields enclosed by brackets [] replaced by
017:         * you own identifying information:
018:         * "Portions Copyrighted [year] [name of copyright owner]"
019:         *
020:         * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
021:         */
022:
023:        package com.sun.xml.ws.security.opt.impl.message;
024:
025:        import com.sun.xml.ws.api.addressing.AddressingVersion;
026:        import com.sun.xml.ws.api.addressing.WSEndpointReference;
027:        import com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader;
028:        import com.sun.istack.NotNull;
029:        import com.sun.xml.bind.api.Bridge;
030:        import com.sun.xml.bind.api.BridgeContext;
031:        import com.sun.xml.ws.api.SOAPVersion;
032:        import org.xml.sax.ContentHandler;
033:        import org.xml.sax.ErrorHandler;
034:        import org.xml.sax.SAXException;
035:
036:        import javax.xml.bind.JAXBException;
037:        import javax.xml.bind.Unmarshaller;
038:        import javax.xml.namespace.QName;
039:        import javax.xml.soap.SOAPException;
040:        import javax.xml.soap.SOAPMessage;
041:        import javax.xml.stream.XMLStreamException;
042:        import javax.xml.stream.XMLStreamReader;
043:        import javax.xml.stream.XMLStreamWriter;
044:        import java.util.Set;
045:
046:        /**
047:         *
048:         * @author K.Venugopal@sun.com
049:         */
050:        public class SecurityHeaderWrapper implements 
051:                com.sun.xml.ws.api.message.Header {
052:
053:            private SecurityHeader sh;
054:
055:            /** Creates a new instance of HeaderWrapper */
056:            public SecurityHeaderWrapper(SecurityHeader sh) {
057:                this .sh = sh;
058:            }
059:
060:            /**
061:             * Checks if this header is ignorable for us (IOW, make sure
062:             * that this header has a problematic "mustUnderstand" header value
063:             * that we have to reject.)
064:             *
065:             * <p>
066:             * This method is used as a part of the
067:             * <a href="HeaderList.html#MU">mustUnderstanx processing</a>.
068:             * At the end of the processing, the JAX-WS identifies a list of {@link Header}s
069:             * that were not understood. This method is invoked on those {@link Header}s,
070:             * to verify that we don't need to report an error for it.
071:             *
072:             * <p>
073:             * specifically, this method has to perform the following tasks:
074:             *
075:             * <ul>
076:             *  <li>If this header does not have <tt>mustUnderstand</tt> as "1" nor "true",
077:             *      then this method must return true.
078:             *  <li>Otherwise, check the role attribute (for SOAP 1.2) or the actor attribute (for SOAP 1.1).
079:             *      When those attributes are absent, the default values have to be assumed.
080:             *      See {@link #getRole(SOAPVersion)} for how the values are defaulted.
081:             *      Now, see if the {@code roles} set contains the value.
082:             *      If so, this method must return false (indicating that an error is in order.)
083:             *  <li>Otherwise return true (since we don't play the role this header is intended for.)
084:             * </ul>
085:             *
086:             * @param soapVersion
087:             *      The caller specifies the SOAP version that the pipeline is working against.
088:             *      Often each {@link Header} implementation already knows the SOAP version
089:             *      anyway, but this allows some {@link Header}s to avoid keeping it.
090:             *      That's why this redundant parameter is passed in.
091:             * @param roles
092:             *      The set of role values that the current JAX-WS pipeline is assuming.
093:             *      Note that SOAP 1.1 and SOAP 1.2 use different strings for the same role,
094:             *      and the caller is responsible for supplying a proper value depending on the
095:             *      active SOAP version in use.
096:             *
097:             * @return
098:             *      true if no error needs to be reported. False if an error needs to be raised.
099:             *      See the method javadoc for more discussion.
100:             */
101:            public boolean isIgnorable(SOAPVersion soapVersion,
102:                    Set<String> roles) {
103:                throw new UnsupportedOperationException();
104:            }
105:
106:            /**
107:             * Gets the value of the soap:role attribute (or soap:actor for SOAP 1.1).
108:             *
109:             * <p>
110:             * If the attribute is omitted, the value defaults to {@link SOAPVersion#implicitRole}.
111:             *
112:             * @param soapVersion
113:             *      The caller specifies the SOAP version that the pipeline is working against.
114:             *      Often each {@link Header} implementation already knows the SOAP version
115:             *      anyway, but this allows some {@link Header}s to avoid keeping it.
116:             *      That's why this redundant parameter is passed in.
117:             * @return
118:             *      never null. This string need not be interned.
119:             */
120:            public String getRole(SOAPVersion soapVersion) {
121:                throw new UnsupportedOperationException();
122:            }
123:
124:            /**
125:             * True if this header is to be relayed if not processed.
126:             * For SOAP 1.1 messages, this method always return false.
127:             *
128:             * <p>
129:             * IOW, this method returns true if there's @soap:relay='true'
130:             * is present.
131:             *
132:             * <h3>Implementation Note</h3>
133:             * <p>
134:             * The implementation needs to check for both "true" and "1",
135:             * but because attribute values are normalized, it doesn't have
136:             * to consider " true", " 1 ", and so on.
137:             *
138:             * @return
139:             *      false.
140:             */
141:            public boolean isRelay() {
142:                throw new UnsupportedOperationException();
143:            }
144:
145:            /**
146:             * Gets the namespace URI of this header element.
147:             *
148:             * @return
149:             *      this string must be interned.
150:             */
151:            public String getNamespaceURI() {
152:                return sh.getNamespaceURI();
153:            }
154:
155:            /**
156:             * Gets the local name of this header element.
157:             *
158:             * @return
159:             *      this string must be interned.
160:             */
161:            public String getLocalPart() {
162:                return sh.getLocalPart();
163:            }
164:
165:            /**
166:             * Gets the attribute value on the header element.
167:             *
168:             * @param nsUri
169:             *      The namespace URI of the attribute. Can be empty.
170:             * @param localName
171:             *      The local name of the attribute.
172:             *
173:             * @return
174:             *      if the attribute is found, return the whitespace normalized value.
175:             *      (meaning no leading/trailing space, no consequtive whitespaces in-between.)
176:             *      Otherwise null. Note that the XML parsers are responsible for
177:             *      whitespace-normalizing attributes, so {@link Header} implementation
178:             *      doesn't have to do anything.
179:             */
180:            public String getAttribute(String nsUri, String localName) {
181:                throw new UnsupportedOperationException();
182:            }
183:
184:            /**
185:             * Gets the attribute value on the header element.
186:             *
187:             * <p>
188:             * This is a convenience method that calls into {@link #getAttribute(String, String)}
189:             *
190:             * @param name
191:             *      Never null.
192:             *
193:             * @see #getAttribute(String, String)
194:             */
195:            public String getAttribute(QName name) {
196:                throw new UnsupportedOperationException();
197:            }
198:
199:            /**
200:             * Reads the header as a {@link XMLStreamReader}.
201:             *
202:             * <p>
203:             * The returned parser points at the start element of this header.
204:             * (IOW, {@link XMLStreamReader#getEventType()} would return
205:             * {@link XMLStreamReader#START_ELEMENT}.
206:             *
207:             * <h3>Performance Expectation</h3>
208:             * <p>
209:             * For some {@link Header} implementations, this operation
210:             * is a non-trivial operation. Therefore, use of this method
211:             * is discouraged unless the caller is interested in reading
212:             * the whole header.
213:             *
214:             * <p>
215:             * Similarly, if the caller wants to use this method only to do
216:             * the API conversion (such as simply firing SAX events from
217:             * {@link XMLStreamReader}), then the JAX-WS team requests
218:             * that you talk to us.
219:             *
220:             * <p>
221:             * {@link Message}s that come from tranport usually provides
222:             * a reasonably efficient implementation of this method.
223:             *
224:             * @return
225:             *      must not null.
226:             */
227:            public XMLStreamReader readHeader() throws XMLStreamException {
228:                throw new UnsupportedOperationException();
229:                //We should avoid such operations for Security operated headers.
230:
231:            }
232:
233:            /**
234:             * Reads the header as a JAXB object by using the given unmarshaller.
235:             */
236:            public <T> T readAsJAXB(Unmarshaller unmarshaller)
237:                    throws JAXBException {
238:                throw new UnsupportedOperationException();
239:            }
240:
241:            /**
242:             * @deprecated
243:             *      Use {@link #readAsJAXB(Bridge)}. To be removed after JavaOne.
244:             */
245:            public <T> T readAsJAXB(Bridge<T> bridge, BridgeContext context)
246:                    throws JAXBException {
247:                throw new UnsupportedOperationException();
248:            }
249:
250:            /**
251:             * Reads the header as a JAXB object by using the given unmarshaller.
252:             */
253:            public <T> T readAsJAXB(Bridge<T> bridge) throws JAXBException {
254:                throw new UnsupportedOperationException();
255:            }
256:
257:            /**
258:             * Writes out the header.
259:             *
260:             * @throws XMLStreamException
261:             *      if the operation fails for some reason. This leaves the
262:             *      writer to an undefined state.
263:             */
264:            public void writeTo(XMLStreamWriter w) throws XMLStreamException {
265:                sh.writeTo(w);
266:            }
267:
268:            /**
269:             * Writes out the header to the given SOAPMessage.
270:             *
271:             * <p>
272:             * Sometimes a {@link Message} needs to produce itself
273:             * as {@link SOAPMessage}, in which case each header needs
274:             * to turn itself into a header.
275:             *
276:             * @throws SOAPException
277:             *      if the operation fails for some reason. This leaves the
278:             *      writer to an undefined state.
279:             */
280:            public void writeTo(SOAPMessage saaj) throws SOAPException {
281:                throw new UnsupportedOperationException(
282:                        "use writeTo(XMLStreamWriter w) ");
283:            }
284:
285:            /**
286:             * Writes out the header as SAX events.
287:             *
288:             * <p>
289:             * Sometimes a {@link Message} needs to produce SAX events,
290:             * and this method is necessary for headers to participate to it.
291:             *
292:             * <p>
293:             * A header is responsible for producing the SAX events for its part,
294:             * including <tt>startPrefixMapping</tt> and <tt>endPrefixMapping</tt>,
295:             * but not startDocument/endDocument.
296:             *
297:             * <p>
298:             * Note that SAX contract requires that any error that does NOT originate
299:             * from {@link ContentHandler} (meaning any parsing error and etc) must
300:             * be first reported to {@link ErrorHandler}. If the SAX event production
301:             * cannot be continued and the processing needs to abort, the code may
302:             * then throw the same {@link SAXParseException} reported to {@link ErrorHandler}.
303:             *
304:             * @param contentHandler
305:             *      The {@link ContentHandler} that receives SAX events.
306:             *
307:             * @param errorHandler
308:             *      The {@link ErrorHandler} that receives parsing errors.
309:             */
310:            public void writeTo(ContentHandler contentHandler,
311:                    ErrorHandler errorHandler) throws SAXException {
312:                throw new UnsupportedOperationException(
313:                        "use writeTo(XMLStreamWriter w) ");
314:            }
315:
316:            public String getStringContent() {
317:                throw new UnsupportedOperationException();
318:            }
319:
320:            public @NotNull
321:            WSEndpointReference readAsEPR(AddressingVersion expected)
322:                    throws XMLStreamException {
323:                throw new UnsupportedOperationException();
324:            }
325:        }
ww_w___.__j__av_a_2__s_.__com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.