⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messageheaderexpressionevaluator.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: MessageHeaderExpressionEvaluator.java 13054 2008-10-10 21:45:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.util.expression;import org.mule.RequestContext;import org.mule.api.transport.MessageAdapter;/** * Looks up the property on the message using the property name given.  If the call on the messgae returns null, * parameters on the inbound endpoint will also be checked. * * @see MessageHeadersListExpressionEvaluator * @see MessageHeadersExpressionEvaluator * @see ExpressionEvaluator * @see ExpressionEvaluatorManager */public class MessageHeaderExpressionEvaluator implements ExpressionEvaluator{    public static final String NAME = "header";    public Object evaluate(String expression, Object message)    {        Object result = null;        if (message instanceof MessageAdapter)        {            result = ((MessageAdapter) message).getProperty(expression);            //Should this fallback be in its own expression evaluator i.e. #[endpoint-param:foo] ??            //I'm not sure becaus ethis way there is a fallback where the message doesn't have a value the            //endpoint can define a default            if (result == null && RequestContext.getEventContext() != null)            {                result = RequestContext.getEventContext().getEndpointURI().getParams().get(expression);            }        }        return result;    }    /**     * {@inheritDoc}     */    public String getName()    {        return NAME;    }    /**     * {@inheritDoc}     */    public void setName(String name)    {        throw new UnsupportedOperationException("setName");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -