org.mule.transport.http.components
Class RestServiceWrapper

java.lang.Object
  extended by org.mule.component.AbstractComponent
      extended by org.mule.transport.http.components.RestServiceWrapper
All Implemented Interfaces:
AnnotatedObject, Component, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor

public class RestServiceWrapper
extends AbstractComponent

This service can used to proxy REST style services as local Mule Components. It can be configured with a service URL plus a number of properties that allow you to configure the parameters and error conditions on the service.


Field Summary
static String CONTENT_TYPE_VALUE
           
static String DELETE
           
static String GET
           
static String HTTP_METHOD
           
protected  Log logger
          logger used by this class
 
Fields inherited from class org.mule.component.AbstractComponent
flowConstruct, interceptorChain, interceptors, lifecycleManager, muleContext, notificationHandler, statistics
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
RestServiceWrapper()
           
 
Method Summary
protected  void doInitialise()
           
 Object doInvoke(MuleEvent event)
           
 Filter getFilter()
           
 String getHttpMethod()
           
 Map getOptionalParams()
          Optional params that are pulled from the message.
 List getPayloadParameterNames()
           
 Map getRequiredParams()
           
 String getServiceUrl()
           
protected  void handleException(RestServiceException e, MuleMessage result)
           
protected  boolean isErrorPayload(MuleMessage message)
           
 void setFilter(Filter errorFilter)
           
 void setHttpMethod(String httpMethod)
           
 void setOptionalParams(Map optionalParams)
           
 void setPayloadParameterNames(List payloadParameterNames)
           
 void setRequiredParams(Map requiredParams)
          Required params that are pulled from the message.
 void setServiceUrl(String serviceUrl)
           
 
Methods inherited from class org.mule.component.AbstractComponent
createResultEvent, dispose, doDispose, doStart, doStop, fireComponentNotification, getAnnotation, getAnnotations, getFlowConstruct, getInterceptors, getName, getStatistics, initialise, process, release, setAnnotations, setFlowConstruct, setInterceptors, setMuleContext, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DELETE

public static final String DELETE
See Also:
Constant Field Values

GET

public static final String GET
See Also:
Constant Field Values

CONTENT_TYPE_VALUE

public static final String CONTENT_TYPE_VALUE
See Also:
Constant Field Values

HTTP_METHOD

public static final String HTTP_METHOD
See Also:
Constant Field Values

logger

protected transient Log logger
logger used by this class

Constructor Detail

RestServiceWrapper

public RestServiceWrapper()
Method Detail

getServiceUrl

public String getServiceUrl()

setServiceUrl

public void setServiceUrl(String serviceUrl)

getRequiredParams

public Map getRequiredParams()

setRequiredParams

public void setRequiredParams(Map requiredParams)
Required params that are pulled from the message. If these params don't exist the call will fail Note that you can use ExpressionEvaluator expressions such as xpath, header, xquery, etc

Parameters:
requiredParams -

getOptionalParams

public Map getOptionalParams()
Optional params that are pulled from the message. If these params don't exist execution will continue. Note that you can use ExpressionEvaluator expressions such as xpath, header, xquery, etc


setOptionalParams

public void setOptionalParams(Map optionalParams)

getHttpMethod

public String getHttpMethod()

setHttpMethod

public void setHttpMethod(String httpMethod)

getPayloadParameterNames

public List getPayloadParameterNames()

setPayloadParameterNames

public void setPayloadParameterNames(List payloadParameterNames)

getFilter

public Filter getFilter()

setFilter

public void setFilter(Filter errorFilter)

doInitialise

protected void doInitialise()
                     throws InitialisationException
Overrides:
doInitialise in class AbstractComponent
Throws:
InitialisationException

doInvoke

public Object doInvoke(MuleEvent event)
                throws Exception
Specified by:
doInvoke in class AbstractComponent
Throws:
Exception

isErrorPayload

protected boolean isErrorPayload(MuleMessage message)

handleException

protected void handleException(RestServiceException e,
                               MuleMessage result)
                        throws Exception
Throws:
Exception


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.