當前位置: 首頁>>代碼示例>>Java>>正文


Java MuleEventContext類代碼示例

本文整理匯總了Java中org.mule.api.MuleEventContext的典型用法代碼示例。如果您正苦於以下問題:Java MuleEventContext類的具體用法?Java MuleEventContext怎麽用?Java MuleEventContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MuleEventContext類屬於org.mule.api包,在下文中一共展示了MuleEventContext類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCall

import org.mule.api.MuleEventContext; //導入依賴的package包/類
public Object onCall(MuleEventContext eventContext) throws Exception
{
    if (logger.isDebugEnabled())
    {
        logger.debug(eventContext);
    }

    // if http request
    String requestPath = parseHttpRequestProperty(
        eventContext.getMessage().getStringProperty(HttpConnector.HTTP_REQUEST_PROPERTY,
            StringUtils.EMPTY));
    

    if (requestPath.indexOf('?') > -1)
    {
        return generateWSDLOrXSD(eventContext, requestPath);
    }
    else
    {
        return sendToDestination(eventContext);
    }
}
 
開發者ID:mprins,項目名稱:muleebmsadapter,代碼行數:23,代碼來源:CxfServiceComponent.java

示例2: getMessageStream

import org.mule.api.MuleEventContext; //導入依賴的package包/類
/**
 * Gets the stream representation of the current message.
 * 
 * @param context the event context
 * @return The inputstream for the current message
 * @throws MuleException
 */
protected InputStream getMessageStream(MuleEventContext context) throws MuleException
{
    InputStream is;
    Object eventMsgPayload = context.transformMessage();

    if (eventMsgPayload instanceof InputStream)
    {
        is = (InputStream) eventMsgPayload;
    }
    else
    {
        is = (InputStream) context.transformMessage(InputStream.class);
    }
    return is;
}
 
開發者ID:mprins,項目名稱:muleebmsadapter,代碼行數:23,代碼來源:CxfServiceComponent.java

示例3: getWsdlUri

import org.mule.api.MuleEventContext; //導入依賴的package包/類
private String getWsdlUri(MuleEventContext eventContext, String reqPath) 
{
    EndpointURI epUri = eventContext.getEndpointURI();
    String host = (String) eventContext.getMessage().getProperty("Host", epUri.getHost());
    String ctx = (String) eventContext.getMessage().getProperty(HttpConnector.HTTP_REQUEST_PROPERTY);
    return epUri.getScheme() + "://" + host + ctx;
}
 
開發者ID:mprins,項目名稱:muleebmsadapter,代碼行數:8,代碼來源:CxfServiceComponent.java

示例4: setPayload

import org.mule.api.MuleEventContext; //導入依賴的package包/類
private void setPayload(MuleEventContext ctx, final MessageImpl m, Object payload)
    throws TransformerException
{
    if (payload instanceof InputStream)
    {
        m.put(Message.ENCODING, ctx.getEncoding());
        m.setContent(InputStream.class, payload);
    }
    else if (payload instanceof Reader)
    {
        m.setContent(XMLStreamReader.class, StaxUtils.createXMLStreamReader((Reader) payload));
    }
    else if (payload instanceof byte[])
    {
        m.setContent(InputStream.class, new ByteArrayInputStream((byte[]) payload));
    }
    else if (payload instanceof StaxSource)
    {
        m.setContent(XMLStreamReader.class, ((StaxSource) payload).getXMLStreamReader());
    }
    else if (payload instanceof Source)
    {
        m.setContent(XMLStreamReader.class, StaxUtils.createXMLStreamReader((Source) payload));
    }
    else if (payload instanceof XMLStreamReader)
    {
        m.setContent(XMLStreamReader.class, (XMLStreamReader) payload);
    }
    else if (payload instanceof Document)
    {
        DOMSource source = new DOMSource((Node) payload);
        m.setContent(XMLStreamReader.class, StaxUtils.createXMLStreamReader(source));
    }
    else
    {
        InputStream is = (InputStream) ctx.transformMessage(InputStream.class);
        m.put(Message.ENCODING, ctx.getEncoding());
        m.setContent(InputStream.class, is);
    }
}
 
開發者ID:mprins,項目名稱:muleebmsadapter,代碼行數:41,代碼來源:CxfServiceComponent.java

示例5: onCall

import org.mule.api.MuleEventContext; //導入依賴的package包/類
@Override
public Object onCall(MuleEventContext context) throws Exception
{
	context.transformMessage();
	return onCall(context.getMessage());
}
 
開發者ID:mprins,項目名稱:muleebmsadapter,代碼行數:7,代碼來源:Callable.java

示例6: generateWSDLOrXSD

import org.mule.api.MuleEventContext; //導入依賴的package包/類
protected Object generateWSDLOrXSD(MuleEventContext eventContext, String req)
    throws EndpointNotFoundException, IOException
{
    // TODO: Is there a way to make this not so ugly?       
    String ctxUri = (String) eventContext.getMessage().getProperty(HttpConnector.HTTP_CONTEXT_PATH_PROPERTY);
    String wsdlUri = getWsdlUri(eventContext, req);
    String serviceUri = wsdlUri.substring(0, wsdlUri.indexOf('?'));
    
    EndpointInfo ei = receiver.getServer().getEndpoint().getEndpointInfo();

    if (serviceUri != null) 
    {
        ei.setAddress(serviceUri);
        
        if (ei.getExtensor(AddressType.class) != null) 
        {
            ei.getExtensor(AddressType.class).setLocation(serviceUri);
        }
    }

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    String ct = null;

    for (QueryHandler qh : bus.getExtension(QueryHandlerRegistry.class).getHandlers())
    {
        if (qh.isRecognizedQuery(wsdlUri, ctxUri, ei))
        {
            ct = qh.getResponseContentType(wsdlUri, ctxUri);
            qh.writeResponse(wsdlUri, ctxUri, ei, out);
            out.flush();
        }
    }

    String msg;
    if (ct == null)
    {
        ct = "text/plain";
        msg = "No query handler found for URL.";
    }
    else
    {
        msg = out.toString();
    }

    MuleMessage result = new DefaultMuleMessage(msg);
    result.setProperty(HttpConstants.HEADER_CONTENT_TYPE, ct);

    return result;
}
 
開發者ID:mprins,項目名稱:muleebmsadapter,代碼行數:50,代碼來源:CxfServiceComponent.java

示例7: onCall

import org.mule.api.MuleEventContext; //導入依賴的package包/類
/**
 *
 * @param eventContext
 * @return
 * @throws Exception
 */
@Override
public Object onCall(MuleEventContext eventContext) throws Exception {

    InputStream is = eventContext.getMessage().getPayload(InputStream.class);

    ExecutionContext smooksExecutionContext = smooks.createExecutionContext();
    smooksExecutionContext.getBeanContext().addBean(MULE_CONTEXT_BEAN_ID, eventContext.getMuleContext());

    smooks.filterSource(smooksExecutionContext, new StreamSource(is));

    return EMPTY_STRING;

}
 
開發者ID:guido-n,項目名稱:mule-useful-experiments,代碼行數:20,代碼來源:XmlStreamSplitterComponent.java

示例8: onCall

import org.mule.api.MuleEventContext; //導入依賴的package包/類
@Override
public Object onCall(MuleEventContext eventContext) throws Exception {

    return tool.saySomething();

}
 
開發者ID:guido-n,項目名稱:mule-useful-experiments,代碼行數:7,代碼來源:ExampleComponent.java


注:本文中的org.mule.api.MuleEventContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。