本文整理汇总了Java中org.apache.axis.MessageContext类的典型用法代码示例。如果您正苦于以下问题:Java MessageContext类的具体用法?Java MessageContext怎么用?Java MessageContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageContext类属于org.apache.axis包,在下文中一共展示了MessageContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageAttachments
import org.apache.axis.MessageContext; //导入依赖的package包/类
/**
* extract attachments from the current request
*
* @return a list of attachmentparts or
* an empty array for no attachments support in this axis
* buid/runtime
* @throws AxisFault
*/
private AttachmentPart[] getMessageAttachments() throws AxisFault {
MessageContext msgContext = MessageContext.getCurrentContext();
Message reqMsg = msgContext.getRequestMessage();
Attachments messageAttachments = reqMsg.getAttachmentsImpl();
int attachmentCount =
messageAttachments.getAttachmentCount();
AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
Iterator it =
messageAttachments.getAttachments().iterator();
int count = 0;
while (it.hasNext()) {
AttachmentPart part = (AttachmentPart) it.next();
attachments[count++] = part;
}
return attachments;
}
示例2: getHostConfiguration
import org.apache.axis.MessageContext; //导入依赖的package包/类
@Override
protected HostConfiguration getHostConfiguration(HttpClient client,
MessageContext context, URL url) {
Proxy proxy = null;
String httpUser = null;
String httpPassword = null;
String serverUrl = url.getProtocol() + "://" + url.getHost();
TrackerWebServicesClient webServicesClient = TrackerClientManager
.getInstance().getClient(serverUrl);
proxy = webServicesClient.getProxy();
httpUser = webServicesClient.getHttpUser();
httpPassword = webServicesClient.getHttpPassword();
setupHttpClient(client, proxy, url.toString(), httpUser, httpPassword);
return client.getHostConfiguration();
}
示例3: getSocket
import org.apache.axis.MessageContext; //导入依赖的package包/类
/**
* Creates a socket connection to the SOAP server
*
* @param protocol "http" for standard, "https" for ssl.
* @param host host name
* @param port port to connect to
* @param otherHeaders buffer for storing additional headers that need to be sent
* @param useFullURL flag to indicate if the complete URL has to be sent
*
* @throws IOException
*/
protected void getSocket(SocketHolder sockHolder,
MessageContext msgContext,
String protocol,
String host, int port, int timeout,
StringBuffer otherHeaders,
BooleanHolder useFullURL)
throws Exception {
Hashtable options = getOptions();
if(timeout > 0) {
if(options == null) {
options = new Hashtable();
}
options.put(DefaultSocketFactory.CONNECT_TIMEOUT,Integer.toString(timeout));
}
SocketFactory factory = SocketFactoryFactory.getFactory(protocol, options);
if (factory == null) {
throw new IOException(Messages.getMessage("noSocketFactory", protocol));
}
Socket sock = factory.create(host, port, otherHeaders, useFullURL);
if(timeout > 0) {
sock.setSoTimeout(timeout);
}
sockHolder.setSocket(sock);
}
示例4: fillHeaders
import org.apache.axis.MessageContext; //导入依赖的package包/类
/**
* Get cookies from message context and add it to the headers
* @param msgContext
* @param header
* @param otherHeaders
*/
private void fillHeaders(MessageContext msgContext, String header, StringBuffer otherHeaders) {
Object ck1 = msgContext.getProperty(header);
if (ck1 != null) {
if (ck1 instanceof String[]) {
String [] cookies = (String[]) ck1;
otherHeaders.append(header).append(": ");
for (int i = 0; i < cookies.length; i++)
{
otherHeaders.append(cookies[i]);
// Append a ';' if not the last cookie
if (i < cookies.length -1)
otherHeaders.append("; ");
}
otherHeaders.append("\r\n");
} else {
addCookie(otherHeaders, header, (String) ck1);
}
}
}
示例5: invoke
import org.apache.axis.MessageContext; //导入依赖的package包/类
/**
* @see org.apache.axis.handlers.LogHandler#invoke(org.apache.axis.MessageContext)
*/
public void invoke(MessageContext arg0) throws AxisFault {
Date now = new Date();
Message m = arg0.getResponseMessage();
if (m!=null){
respMessage = m.getSOAPPartAsString();
if (baseDir!=null)
dumpToFile(sdf.format(now)+"_response",m.getSOAPPartAsBytes());
return;
}
else
respMessage = null;
m = arg0.getRequestMessage();
if (m!=null){
reqMessage = m.getSOAPPartAsString();
if (baseDir!=null)
dumpToFile(sdf.format(now)+"_request",m.getSOAPPartAsBytes());
}
else
reqMessage = null;
}
示例6: generateType
import org.apache.axis.MessageContext; //导入依赖的package包/类
public String generateType(CFCDescriptor d, MessageContext msgContext) throws IOException {
Map<String, CFCSourceInfo> sMap = new FastMap<String, CFCSourceInfo>();
Map<String, String> sBeanInfoMap = new FastMap<String, String>();
List<DynamicCacheClassLoader> clList = new ArrayList<DynamicCacheClassLoader>();
String name = UUID.generateKey();
// Populate the necessary lists
String dynClsName = prepareType(d, name, new FastMap<String, String>(false), sMap, sBeanInfoMap, clList);
// Build the classes (if necessary)
if (buildClasses(name, sMap, sBeanInfoMap, clList)) {
// Link the DynamicCacheClassLoaders together (as dependents)
linkClassLoaders(getClassLoader(dynClsName));
}
// Return the class name
return dynClsName;
}
示例7: invokeCFCFunction
import org.apache.axis.MessageContext; //导入依赖的package包/类
public Object invokeCFCFunction(MessageContext msgContext, cfSession session, String cfcName, cfStructData method, Object[] argValues) throws Exception {
// Create the cfc
cfComponentData cfc = new cfComponentData(session, cfcName);
if (cfc == null || cfc.getMetaData() == null || cfc.getMetaData().isEmpty())
throw new AxisFault(Messages.getMessage("noClassForService00", cfcName));
// Convert the params
cfArgStructData args = prepareArgs(session, method, argValues);
// Execute the cfc
cfData rtn = invokeComponentMethod(session, method, args, cfc);
if (rtn == null || rtn instanceof cfNullData)
return null;
else {
return tagUtils.getNatural(rtn, true, true, true);
}
}
示例8: logMessages
import org.apache.axis.MessageContext; //导入依赖的package包/类
private void logMessages(MessageContext msgContext) throws AxisFault {
try {
Message inMsg = msgContext.getRequestMessage();
Message outMsg = msgContext.getResponseMessage();
StringBuffer msg = new StringBuffer();
if (start != -1) {
msg.append("= " + Messages.getMessage("elapsed00", "" + (System.currentTimeMillis() - start))).append('\n');
}
msg.append("= " + Messages.getMessage("inMsg00", (inMsg == null ? "null" : inMsg.getSOAPPartAsString()))).append('\n');
msg.append("= " + Messages.getMessage("outMsg00", (outMsg == null ? "null" : outMsg.getSOAPPartAsString()))).append('\n');
switch (logLevel) {
case "debug": log.debug(msg); break;
case "info": log.info(msg); break;
case "warn": log.warn(msg); break;
case "error": log.error(msg); break;
default:
log.trace(msg);
}
} catch (Exception e) {
log.error(Messages.getMessage("exception00"), e);
throw AxisFault.makeFault(e);
}
}
示例9: serialize
import org.apache.axis.MessageContext; //导入依赖的package包/类
public static String serialize(Object obj) throws IOException {
TypeDesc desc = TypeDesc.getTypeDescForClass(obj.getClass());
BeanSerializer serializer = new BeanSerializer(obj.getClass(), desc.getXmlType(), desc);
MessageContext mctx = new MessageContext(null);
mctx.setProperty(AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION, true);
mctx.setProperty(AxisEngine.PROP_SEND_XSI, true);
mctx.setTypeMappingRegistry(new TypeMappingRegistryImpl());
StringWriter writer = new StringWriter();
SerializationContext ctx = new SerializationContext(writer, mctx);
ctx.setPretty(false);
ctx.setSendDecl(true);
ctx.setDoMultiRefs(false);
serializer.serialize(new QName("keha"), new AttributesImpl(), obj, ctx);
return writer.getBuffer().toString();
}
示例10: getConfiguration
import org.apache.axis.MessageContext; //导入依赖的package包/类
public CaArraySvcResourceConfiguration getConfiguration() {
if (this.configuration != null) {
return this.configuration;
}
MessageContext ctx = MessageContext.getCurrentContext();
String servicePath = ctx.getTargetService();
servicePath = servicePath.substring(0,servicePath.lastIndexOf("/"));
servicePath+="/CaArraySvc";
String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration";
logger.debug("Will read configuration from jndi name: " + jndiName);
try {
Context initialContext = new InitialContext();
this.configuration = (CaArraySvcResourceConfiguration) initialContext.lookup(jndiName);
} catch (Exception e) {
logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e);
}
return this.configuration;
}
示例11: getConfiguration
import org.apache.axis.MessageContext; //导入依赖的package包/类
public CaNanoLabServiceResourceConfiguration getConfiguration() {
if (this.configuration != null) {
return this.configuration;
}
MessageContext ctx = MessageContext.getCurrentContext();
String servicePath = ctx.getTargetService();
servicePath = servicePath.substring(0,servicePath.lastIndexOf("/"));
servicePath+="/CaNanoLabService";
String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration";
logger.debug("Will read configuration from jndi name: " + jndiName);
try {
Context initialContext = new InitialContext();
this.configuration = (CaNanoLabServiceResourceConfiguration) initialContext.lookup(jndiName);
} catch (Exception e) {
logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e);
}
return this.configuration;
}
示例12: getConfiguration
import org.apache.axis.MessageContext; //导入依赖的package包/类
public ResourceConfiguration getConfiguration() {
if (this.configuration != null) {
return this.configuration;
}
MessageContext ctx = MessageContext.getCurrentContext();
String servicePath = ctx.getTargetService();
String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration";
logger.debug("Will read configuration from jndi name: " + jndiName);
try {
Context initialContext = new InitialContext();
this.configuration = (ResourceConfiguration) initialContext.lookup(jndiName);
} catch (Exception e) {
logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e);
}
return this.configuration;
}
示例13: getConfiguration
import org.apache.axis.MessageContext; //导入依赖的package包/类
public static CaArraySvcConfiguration getConfiguration() throws Exception {
if (CaArraySvcConfiguration.configuration != null) {
return CaArraySvcConfiguration.configuration;
}
MessageContext ctx = MessageContext.getCurrentContext();
String servicePath = ctx.getTargetService();
String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/serviceconfiguration";
try {
javax.naming.Context initialContext = new InitialContext();
CaArraySvcConfiguration.configuration = (CaArraySvcConfiguration) initialContext.lookup(jndiName);
} catch (Exception e) {
throw new Exception("Unable to instantiate service configuration.", e);
}
return CaArraySvcConfiguration.configuration;
}
示例14: getConfiguration
import org.apache.axis.MessageContext; //导入依赖的package包/类
public MetadataConfiguration getConfiguration() {
if (this.configuration != null) {
return this.configuration;
}
MessageContext ctx = MessageContext.getCurrentContext();
String servicePath = ctx.getTargetService();
String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration";
logger.debug("Will read configuration from jndi name: " + jndiName);
try {
Context initialContext = new InitialContext();
this.configuration = (MetadataConfiguration) initialContext.lookup(jndiName);
} catch (Exception e) {
logger.error("when performing JNDI lookup for " + jndiName + ": " + e);
}
return this.configuration;
}
示例15: getConfiguration
import org.apache.axis.MessageContext; //导入依赖的package包/类
public static PhotoSharingRegistrationConfiguration getConfiguration() throws Exception {
if (PhotoSharingRegistrationConfiguration.configuration != null) {
return PhotoSharingRegistrationConfiguration.configuration;
}
MessageContext ctx = MessageContext.getCurrentContext();
String servicePath = ctx.getTargetService();
String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/serviceconfiguration";
try {
javax.naming.Context initialContext = new InitialContext();
PhotoSharingRegistrationConfiguration.configuration = (PhotoSharingRegistrationConfiguration) initialContext.lookup(jndiName);
} catch (Exception e) {
throw new Exception("Unable to instantiate service configuration.", e);
}
return PhotoSharingRegistrationConfiguration.configuration;
}