[ 
https://issues.apache.org/activemq/browse/SMXCOMP-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52700#action_52700
 ] 

Ron Gavlin commented on SMXCOMP-78:
-----------------------------------

Now that the smx-utils refactoring is complete, would it be possible to 
re-apply the patch in this JIRA. Also, would it be possible to backport this 
patch to the 3.2.x branch? 

REST support is becoming a major issue and the camel-rest component cannot be 
used within smx 3.2.x since it requires Spring 2.5.x.

> Rest provide marshaler
> ----------------------
>
>                 Key: SMXCOMP-78
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-78
>             Project: ServiceMix Components
>          Issue Type: Improvement
>          Components: servicemix-http
>    Affects Versions: 3.2.1
>            Reporter: Tom Purcell
>            Assignee: Guillaume Nodet
>             Fix For: servicemix-http-2009.02
>
>         Attachments: RestProviderMarshaler.java, RestProviderMarshaler.java, 
> RestProviderMarshaler.java, servicemixRestSupport.tar.gz
>
>
> The current implementation of DefaultHttpProviderMarshaler the it is possible 
> to construct the location URI by specifying an XPath 
> expression(locationURIExpression). Make it possible to extract the XML 
> content as well. In order to do this JAXPXPathExpression must change.
> In the SMX JAXPXPathExpression class the evaluateXPath(Object object) method 
> calls the javax.xml.xpath.XPathExpression evaluate(object) method. There are 
> four implementations of that method in XPathExpression. The one being called 
> in the SMX JAXPXPathExpression class returns a String. This String contains 
> the VALUEs only, not the tags. This is great when you need a value to build a 
> URL but not when you need the actual XML. You need the NodeSet. Another 
> version of the XPathExpression evaluate method, evaluate(object, returnType), 
> allows you to control the return type by specifing one of the 
> javax.xml.xpath.XPathConstants but the SMX JAXPXPathExpression does not 
> expose a way to call it. 
> The attached file contains the following
> An SVN diff of JAXPXPathExpression in which:
> - Changed:
>       protected Object evaluateXPath(Object object) throws 
> XPathExpressionException
>   To:
>       protected Object evaluateXPath(Object object, QName returnType) throws 
> XPathExpressionException
> - Added:
>       public Object evaluate(MessageExchange exchange, NormalizedMessage 
> message, QName returnType) throws MessagingException
> - Changed:
>       public Object evaluate(MessageExchange exchange, NormalizedMessage 
> message) throws MessagingException
>   To call the new version above. It passes in XPathConstants.STRING as the 
> QName to provide backward compatibility. 
> The RestProviderMarshaler which:
> - Extends DefaultHttpProviderMarshaler and makes use of the nes functionality
> - Adds HttpStatus.SC_CREATED to the check for valid response codes in 
> handleResponse(MessageExchange exchange, SmxHttpExchange httpExchange). This 
> is to support valid responses to a RESTful POST call.
> Below is a sample XBean config for the new http:provder:
>    <http:provider service="wile:wileRestService"
>                    interfaceName="wileCreate"
>                    endpoint="wileRestCreate"
>                    marshaler="#createMarshaler"/>
>     <bean id="createMarshaler" class="com.jbi.marshal.RestProviderMarshaler">
>         <property name="locationURIExpression">
>             <bean 
> class="org.apache.servicemix.expression.JAXPStringXPathExpression">
>                 <constructor-arg
>                         
> value="concat('http://localhost:8080/wile-www/assetmanagement/assetservice/',/assetRequest/perspective)"/>
>             </bean>
>         </property>
>         <property name="method"
>                   value="POST"/>
>         <property name="contentType"
>                   value="application/x-www-form-urlencoded"/>
>         <property name="contentExpression">
>             <bean 
> class="org.apache.servicemix.expression.JAXPStringXPathExpression">
>                 <constructor-arg value="//asset"/>
>             </bean>
>         </property>
>     </bean>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to