当前位置: 首页>>代码示例>>Java>>正文


Java MessageContext类代码示例

本文整理汇总了Java中javax.xml.rpc.handler.MessageContext的典型用法代码示例。如果您正苦于以下问题:Java MessageContext类的具体用法?Java MessageContext怎么用?Java MessageContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageContext类属于javax.xml.rpc.handler包,在下文中一共展示了MessageContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleRequest

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
/**
 * Adds an "Access" element to the SOAP header
 */
public boolean handleRequest(MessageContext msgct) {
	if (msgct instanceof SOAPMessageContext) {
		SOAPMessageContext smsgct = (SOAPMessageContext) msgct;
		try {
			SOAPMessage msg = smsgct.getMessage();
			SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
			SOAPHeader header = msg.getSOAPHeader();

			if (header == null)
				header = envelope.addHeader(); // add an header if non exists

			SOAPHeaderElement accessElement = header.addHeaderElement(envelope.createName("Access", "ns0", JPLAG_TYPES_NS));
			SOAPElement usernameelem = accessElement.addChildElement("username");
			usernameelem.addTextNode(username);
			SOAPElement passwordelem = accessElement.addChildElement("password");
			passwordelem.addTextNode(password);
			SOAPElement compatelem = accessElement.addChildElement("compatLevel");
			compatelem.addTextNode(compatibilityLevel + "");
		} catch (SOAPException x) {
			System.out.println("Unable to create access SOAP header!");
			x.printStackTrace();
		}
	}
	return true;
}
 
开发者ID:jplag,项目名称:jplag,代码行数:29,代码来源:JPlagClientAccessHandler.java

示例2: handleRequest

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean handleRequest(MessageContext context) {
//		System.out.println("Entering LoggingHandler::handleRequest()");
/*		try
		{
			SOAPMessageContext smsgct=(SOAPMessageContext) context;
			SOAPMessage msg=smsgct.getMessage();
			SOAPEnvelope envelope=msg.getSOAPPart().getEnvelope();
			SOAPHeader header=msg.getSOAPHeader();
			if(header==null)
			{
				header=envelope.addHeader();
			}
		
			SOAPHeaderElement accessElement=header.addHeaderElement(
					envelope.createName("logged","ns1",
					"http://example.com/jplag"));
			accessElement.addTextNode("You got logged!!");
		}
		catch(SOAPException e)
		{
			e.printStackTrace();
		}*/
		logMessage("request", context);
//		System.out.println("Leaving LoggingHandler::handleRequest()");
		return true;
	}
 
开发者ID:jplag,项目名称:jplag,代码行数:27,代码来源:LoggingHandler.java

示例3: logMessage

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
private void logMessage(String method, MessageContext context) {
     FileOutputStream fout = createFile();
     if(fout==null) return;
     LogOutputStream out = new LogOutputStream(fout, true);
     try {
         out.println("<" + method + ">");
         //Uncomment this statement to log the SOAP messages.
         out.println(logSOAPMessage(context));
         out.println("</" + method + ">");
     } catch (Exception ex) {
         ex.printStackTrace(System.out);
throw new JAXRPCException("LoggingHandler: Unable to log the message in " + method + " - {" + ex.getClass().getName() + "}"
		+ ex.getMessage());
     } finally {
         out.flush();
out.close();
     }
 }
 
开发者ID:jplag,项目名称:jplag,代码行数:19,代码来源:LoggingHandler.java

示例4: logSOAPMessage

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
private String logSOAPMessage(MessageContext context) {
		StringBuffer stringBuffer = new StringBuffer();
		SOAPMessageContext smc = (SOAPMessageContext) context;
		SOAPMessage soapMessage = smc.getMessage();
/*		try
		{
			SOAPBody soapBody = soapMessage.getSOAPBody();
			NodeList list=soapBody.getElementsByTagName("inputZipFile");
		}
		catch(Exception e)
		{
			// ignore filtering
		}*/

		ByteArrayOutputStream bout= new ByteArrayOutputStream();
		try {
			soapMessage.writeTo(bout);
		} catch(Exception e) {
			e.printStackTrace(System.out);
		}
		stringBuffer.append(bout.toString() + "\n");

		return stringBuffer.toString();
	}
 
开发者ID:jplag,项目名称:jplag,代码行数:25,代码来源:LoggingHandler.java

示例5: handleRequest

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
/**
 * Adds an "Access" element to the SOAP header
 */
public boolean handleRequest(MessageContext msgct) {
	if(msgct instanceof SOAPMessageContext) {
		SOAPMessageContext smsgct=(SOAPMessageContext) msgct;
		try	{
			SOAPMessage msg=smsgct.getMessage();
			SOAPEnvelope envelope=msg.getSOAPPart().getEnvelope();
			SOAPHeader header=msg.getSOAPHeader();
			
			if(header==null)
				header=envelope.addHeader(); // add an header if non exists
			
			SOAPHeaderElement accessElement=header.addHeaderElement(
					envelope.createName("Access","ns0",
							"http://www.ipd.uni-karlsruhe.de/jplag/types"));
			SOAPElement usernameelem=accessElement.addChildElement(
                       "username");
			usernameelem.addTextNode(username);
			SOAPElement passwordelem=accessElement.addChildElement(
                       "password");
			passwordelem.addTextNode(password);
               SOAPElement compatelem=accessElement.addChildElement(
                       "compatLevel");
               compatelem.addTextNode(compatibilityLevel+"");
		} catch (SOAPException x) {
			System.out.println("Unable to create access SOAP header!");
			x.printStackTrace();
		}
	}
	return true;
}
 
开发者ID:jplag,项目名称:jplag,代码行数:34,代码来源:JPlagClientAccessHandler.java

示例6: handleRequest

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean handleRequest(MessageContext mc) {
    mc.setProperty(ALLOW_FORM_OPTIMIZATION,
        Boolean.TRUE);
    try {
        return processMessage(mc, true);
    } catch (WSSecurityException e) {
        if (doDebug) {
            log.debug(e.getMessage(), e);
        }
        throw new JAXRPCException(e);
    }
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:13,代码来源:WSS4JHandler.java

示例7: handleResponse

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean handleResponse(MessageContext mc) {
    mc.setProperty(ALLOW_FORM_OPTIMIZATION,
        Boolean.TRUE);
    try {
        return processMessage(mc, false);
    } catch (WSSecurityException e) {
        if (doDebug) {
            log.debug(e.getMessage(), e);
        }
        throw new JAXRPCException(e);
    }
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:13,代码来源:WSS4JHandler.java

示例8: handleFault

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
/**
 * Handles SOAP Faults that may occur during message processing
 */
public boolean handleFault(MessageContext mc) {
    if (doDebug) {
        log.debug("Entered handleFault");
    }
    return true;
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:10,代码来源:WSS4JHandler.java

示例9: processMessage

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
/**
 * Switch for transferring control to doReceiver and doSender
 */
public boolean processMessage(MessageContext mc, boolean isRequestMessage) throws WSSecurityException {

    RequestData reqData = new RequestData();
    reqData.setMsgContext(mc);

    doDebug = log.isDebugEnabled();
    String deployment = null;
    String handleFlow = null;

    if ((deployment = (String) getOption(DEPLOYMENT)) == null) {
        deployment = (String) mc.getProperty(DEPLOYMENT);
    }
    if (deployment == null) {
        throw new JAXRPCException("WSS4JHandler.processMessage: No deployment defined");
    }
    if ((handleFlow = (String) getOption(FLOW)) == null) {
        handleFlow = (String) mc.getProperty(FLOW);
    }
    if (handleFlow == null) {
        handleFlow = "";
    }

    // call doSender if we are -
    // (handling request and client-side deployment) or (handling response and server-side deployment).
    // call doReceiver if we are -
    // (handling request and server-side deployment) or (handling response and client-side deployment).

    boolean needsHandling = ( isRequestMessage && !handleFlow.equals(RESPONSE_ONLY)) ||
                            (!isRequestMessage && !handleFlow.equals(REQUEST_ONLY));
    try {
        if (deployment.equals(CLIENT_DEPLOYMENT) ^ isRequestMessage) {
            if (needsHandling) {
                return doReceiver(mc, reqData, isRequestMessage);
            }
        } else {
            if (needsHandling) {
                return doSender(mc, reqData, isRequestMessage);
            }
        }
    } finally {
        reqData.clear();
        reqData = null;
    }
    return true;
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:49,代码来源:WSS4JHandler.java

示例10: isPermitted

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
	throws AuthorizationException {
	
	if(!operation.getNamespaceURI().equals(getServiceNamespace())){
	  return false;
	}
	if(operation.getLocalPart().equals("getMultipleResourceProperties")){
		authorizeGetMultipleResourceProperties(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("getResourceProperty")){
		authorizeGetResourceProperty(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("queryResourceProperties")){
		authorizeQueryResourceProperties(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
		authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("getQuote")){
		authorizeGetQuote(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("getChart")){
		authorizeGetChart(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("createPortfolio")){
		authorizeCreatePortfolio(peerSubject, context, operation);
		return true;
	} 		
	return false;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:31,代码来源:StockManagerAuthorization.java

示例11: isPermitted

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
	throws AuthorizationException {
	
	if(!operation.getNamespaceURI().equals(getServiceNamespace())){
	  return false;
	}
	if(operation.getLocalPart().equals("getMultipleResourceProperties")){
		authorizeGetMultipleResourceProperties(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("getResourceProperty")){
		authorizeGetResourceProperty(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("queryResourceProperties")){
		authorizeQueryResourceProperties(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
		authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("query")){
		authorizeQuery(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("executeQuery")){
		authorizeExecuteQuery(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("transferQuery")){
		authorizeTransferQuery(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("executeTransferQuery")){
		authorizeExecuteTransferQuery(peerSubject, context, operation);
		return true;
	} else if(operation.getLocalPart().equals("extractCBMdata")){
		authorizeExtractCBMdata(peerSubject, context, operation);
		return true;
	} 		
	return false;
}
 
开发者ID:NCIP,项目名称:common-biorepository-model,代码行数:37,代码来源:CBMAuthorization.java

示例12: getMessageContext

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
@Override
public MessageContext getMessageContext() throws IllegalStateException {
    throw new UnsupportedOperationException();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:5,代码来源:TestSessionContext.java

示例13: handleResponse

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean handleResponse(MessageContext context) {
	logMessage("response", context);
	return true;
}
 
开发者ID:jplag,项目名称:jplag,代码行数:5,代码来源:LoggingHandler.java

示例14: handleFault

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean handleFault(MessageContext context) {
	logMessage("fault", context);
	return true;
}
 
开发者ID:jplag,项目名称:jplag,代码行数:5,代码来源:LoggingHandler.java

示例15: handleRequest

import javax.xml.rpc.handler.MessageContext; //导入依赖的package包/类
public boolean handleRequest(MessageContext context)
{
    return true;
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:5,代码来源:JaxRpcGenericHandlerTest.java


注:本文中的javax.xml.rpc.handler.MessageContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。