blob: 123cd2df75a96e753edbec593356e01a221fe350 [file] [log] [blame]
/*
* Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.xml.internal.ws.handler;
import javax.xml.ws.handler.LogicalMessageContext;
import javax.xml.soap.SOAPMessage;
import com.sun.xml.internal.ws.pept.ept.MessageInfo;
import com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage;
import com.sun.xml.internal.ws.spi.runtime.Invoker;
import javax.xml.ws.handler.soap.SOAPMessageContext;
/**
* The HandlerContext is used in the client and server runtime
* in {@link com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher} and
* {@link com.sun.xml.internal.ws.protocol.soap.server.SOAPMessageDispatcher} to hold
* information about the current message.
*
* <p>It stores a {@link com.sun.xml.internal.ws.pept.ept.MessageInfo} and
* {@link com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage}
* which are used by the rest of the runtime, and provides a bridge
* between these and the soap and logical message contexts that
* are used by the handlers.
*
* @see LogicalMessageContextImpl
* @see MessageContextImpl
* @see SOAPMessageContextImpl
*
* @author WS Development Team
*/
public class SOAPHandlerContext extends HandlerContext {
private SOAPMessage soapMessage;
private SOAPMessageContext soapContext;
private SHDSOAPMessageContext shdsoapContext;
private LogicalMessageContext logicalContext;
public SOAPHandlerContext(MessageInfo messageInfo,
InternalMessage internalMessage,
SOAPMessage soapMessage) {
super(messageInfo, internalMessage);
this.soapMessage = soapMessage;
}
public SOAPMessageContext getSOAPMessageContext() {
if (soapContext == null) {
soapContext = new SOAPMessageContextImpl(this);
}
return soapContext;
}
public SHDSOAPMessageContext getSHDSOAPMessageContext() {
if (shdsoapContext == null) {
shdsoapContext = new SHDSOAPMessageContext(this);
}
return shdsoapContext;
}
public LogicalMessageContext getLogicalMessageContext() {
if (logicalContext == null) {
logicalContext = new LogicalMessageContextImpl(this);
}
return logicalContext;
}
/**
* @return Returns the soapMessage.
*/
public SOAPMessage getSOAPMessage() {
return soapMessage;
}
/**
* @param soapMessage The soapMessage to set.
*/
public void setSOAPMessage(SOAPMessage soapMessage) {
this.soapMessage = soapMessage;
}
/**
* If there is a SOAPMessage already, use getSOAPMessage(). Ignore all other
* methods
*/
public boolean isAlreadySoap() {
return getSOAPMessage() != null;
}
}