Methods Summary |
---|
public static void | configureCodec(com.sun.xml.ws.transport.tcp.util.ChannelContext channelContext, com.sun.xml.ws.api.SOAPVersion soapVersion, com.sun.xml.ws.api.pipe.Codec defaultCodec)Configure Codec according to channel settings
final List<String> supportedMimeTypes = channelContext.getChannelSettings().getNegotiatedMimeTypes();
if (supportedMimeTypes != null) {
if (supportedMimeTypes.contains(MimeTypeConstants.FAST_INFOSET_STATEFUL_SOAP11) ||
supportedMimeTypes.contains(MimeTypeConstants.FAST_INFOSET_STATEFUL_SOAP12)) {
logger.log(Level.FINEST, "ChannelContext.configureCodec: FI Stateful");
StreamSOAPCodec streamSoapCodec = defaultCodec instanceof SOAPBindingCodec ?
((SOAPBindingCodec) defaultCodec).getXMLCodec() : null;
channelContext.setCodec(WSTCPFastInfosetStreamCodec.create(streamSoapCodec, soapVersion, channelContext, true));
return;
} else if (supportedMimeTypes.contains(MimeTypeConstants.FAST_INFOSET_SOAP11) ||
supportedMimeTypes.contains(MimeTypeConstants.FAST_INFOSET_SOAP12)) {
logger.log(Level.FINEST, "ChannelContext.configureCodec: FI Stateless");
StreamSOAPCodec streamSoapCodec = defaultCodec instanceof SOAPBindingCodec ?
((SOAPBindingCodec) defaultCodec).getXMLCodec() : null;
channelContext.setCodec(WSTCPFastInfosetStreamCodec.create(streamSoapCodec, soapVersion, channelContext, false));
return;
}
}
logger.log(Level.FINEST, "ChannelContext.configureCodec: default");
channelContext.setCodec(defaultCodec);
|
public java.lang.String | decodeMimeType(int contentId)
String mimeType = channelSettings.getNegotiatedMimeTypes().get(contentId);
if (mimeType != null) {
return mimeType;
}
throw new WSTCPException(WSTCPError.createNonCriticalError(TCPConstants.UNKNOWN_CONTENT_ID,
MessagesMessages.WSTCP_0011_UNKNOWN_CONTENT_TYPE(contentId)));
|
public java.lang.String | decodeParam(int paramId)
String paramStr = channelSettings.getNegotiatedParams().get(paramId);
if (paramStr != null) {
return paramStr;
}
throw new WSTCPException(WSTCPError.createNonCriticalError(TCPConstants.UNKNOWN_PARAMETER_ID,
MessagesMessages.WSTCP_0010_UNKNOWN_PARAMETER(paramId)));
|
public int | encodeMimeType(java.lang.String mimeType)
int contentId = channelSettings.getNegotiatedMimeTypes().indexOf(mimeType);
if (contentId != -1) {
return contentId;
}
throw new WSTCPException(WSTCPError.createNonCriticalError(TCPConstants.UNKNOWN_CONTENT_ID,
MessagesMessages.WSTCP_0011_UNKNOWN_CONTENT_TYPE(mimeType)));
|
public int | encodeParam(java.lang.String paramStr)
int paramId = channelSettings.getNegotiatedParams().indexOf(paramStr);
if (paramId != -1) {
return paramId;
}
throw new WSTCPException(WSTCPError.createNonCriticalError(TCPConstants.UNKNOWN_PARAMETER_ID,
MessagesMessages.WSTCP_0010_UNKNOWN_PARAMETER(paramStr)));
|
public int | getChannelId()Return channel id
return channelSettings.getChannelId();
|
public ChannelSettings | getChannelSettings()Return channel settings, which were aggreed during handshake phase
return channelSettings;
|
public com.sun.xml.ws.api.pipe.Codec | getCodec()Return message Codec, which is used for encoding/decoding messages
on this virtual channel
return codec;
|
public com.sun.xml.ws.transport.tcp.io.Connection | getConnection()Return TCP connection object, where this virtual channel is acting on
return connectionSession.getConnection();
|
public ConnectionSession | getConnectionSession()Return TCP session object where which this virual channel is open on
return connectionSession;
|
public java.lang.String | getContentType()Gets message's content type from TCP protocol specific representation
Connection connection = connectionSession.getConnection();
final int mimeId = connection.getContentId();
Map<Integer, String> params = connection.getContentProperties();
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, MessagesMessages.WSTCP_1122_CHANNEL_CONTEXT_DECODE_CT(mimeId, params));
}
String mimeType = decodeMimeType(mimeId);
String contentTypeStr = mimeType;
if (params.size() > 0) {
final StringBuffer ctBuf = new StringBuffer(contentTypeStr);
for(Map.Entry<Integer, String> parameter : params.entrySet()) {
ctBuf.append(';");
final String paramKey = decodeParam(parameter.getKey());
final String paramValue = parameter.getValue();
ctBuf.append(paramKey);
ctBuf.append('=");
ctBuf.append(paramValue);
}
contentTypeStr = ctBuf.toString();
}
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, MessagesMessages.WSTCP_1123_CHANNEL_CONTEXT_DECODED_CT(contentTypeStr));
}
return contentTypeStr;
|
public WSTCPURI | getTargetWSURI()Return correspondent WS's URI
return channelSettings.getTargetWSURI();
|
public javax.xml.namespace.QName | getWSServiceName()Return virtual channel's correspondent service name
return channelSettings.getWSServiceName();
|
public void | onRecycled()
connectionSession.onReadCompleted();
|
private void | setCodec(com.sun.xml.ws.api.pipe.Codec codec)
this.codec = codec;
|
public void | setContentType(java.lang.String contentTypeS)Sets message's content type to TCP protocol specific representation
Connection connection = connectionSession.getConnection();
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, MessagesMessages.WSTCP_1120_CHANNEL_CONTEXT_ENCODE_CT(contentTypeS));
}
contentType.parse(contentTypeS);
int mt = encodeMimeType(contentType.getMimeType());
connection.setContentId(mt);
final Map<String, String> parameters = contentType.getParameters();
for(Map.Entry<String, String> parameter : parameters.entrySet()) {
final int paramId = encodeParam(parameter.getKey());
connection.setContentProperty(paramId, parameter.getValue());
}
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, MessagesMessages.WSTCP_1121_CHANNEL_CONTEXT_ENCODED_CT(mt, parameters));
}
|
public void | setWSServiceName(javax.xml.namespace.QName wsServiceName)
channelSettings.setWSServiceName(wsServiceName);
|
public java.lang.String | toString()
return String.format("ID: %d\nURI: %s\nCodec:%s", new Object[] {getChannelId(), getTargetWSURI(), getCodec()});
|