001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: package com.sun.xml.internal.ws.handler;
026:
027: import com.sun.xml.internal.ws.spi.runtime.Invoker;
028: import java.util.Collection;
029: import java.util.Map;
030: import java.util.Set;
031: import javax.xml.ws.handler.LogicalMessageContext;
032: import com.sun.xml.internal.ws.spi.runtime.MessageContext;
033:
034: import com.sun.xml.internal.ws.pept.ept.MessageInfo;
035: import com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage;
036: import com.sun.xml.internal.ws.encoding.xml.XMLMessage;
037: import java.lang.reflect.Method;
038:
039: /**
040: * Version of {@link HandlerContext} for XML/HTTP binding that
041: * only deals with logical messages.
042: *
043: * <p>Class has to defer information to HandlerContext so that properties
044: * are shared between this and SOAPMessageContext.
045: *
046: * @see HandlerContext
047: *
048: * @author WS Development Team
049: * @author WS Development Team
050: */
051: public class XMLHandlerContext extends HandlerContext {
052:
053: private XMLMessage xmlMessage;
054: private LogicalMessageContext logicalContext;
055: private SHDXMLMessageContext shdXmlContext;
056:
057: public XMLHandlerContext(MessageInfo messageInfo,
058: InternalMessage internalMessage, XMLMessage xmlMessage) {
059: super (messageInfo, internalMessage);
060: this .xmlMessage = xmlMessage;
061: }
062:
063: public LogicalMessageContext getLogicalMessageContext() {
064: if (logicalContext == null) {
065: logicalContext = new XMLLogicalMessageContextImpl(this );
066: }
067: return logicalContext;
068: }
069:
070: /**
071: * @return Returns XMLMessage
072: */
073: public XMLMessage getXMLMessage() {
074: return xmlMessage;
075: }
076:
077: /**
078: * @param xmlMessage The xmlMessage to set.
079: */
080: public void setXMLMessage(XMLMessage xmlMessage) {
081: this .xmlMessage = xmlMessage;
082: }
083:
084: public SHDXMLMessageContext getSHDXMLMessageContext() {
085: if (shdXmlContext == null) {
086: shdXmlContext = new SHDXMLMessageContext(this );
087: }
088: return shdXmlContext;
089: }
090:
091: private static class SHDXMLMessageContext extends
092: XMLLogicalMessageContextImpl implements
093: com.sun.xml.internal.ws.spi.runtime.MessageContext {
094:
095: XMLHandlerContext handlerCtxt;
096:
097: public SHDXMLMessageContext(XMLHandlerContext handlerCtxt) {
098: super (handlerCtxt);
099: this .handlerCtxt = handlerCtxt;
100: }
101:
102: public String getBindingId() {
103: return handlerCtxt.getBindingId();
104: }
105:
106: public Method getMethod() {
107: return handlerCtxt.getMethod();
108: }
109:
110: public void setCanonicalization(String algorithm) {
111: handlerCtxt.setCanonicalization(algorithm);
112: }
113:
114: public Invoker getInvoker() {
115: return handlerCtxt.getInvoker();
116: }
117:
118: public boolean isMtomEnabled() {
119: return false;
120: }
121:
122: }
123:
124: }
|