servicemix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré (JIRA) <j...@apache.org>
Subject [jira] Updated: (SMXCOMP-78) Rest provide marshaler
Date Sun, 06 Feb 2011 09:51:31 GMT

     [ https://issues.apache.org/jira/browse/SMXCOMP-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jean-Baptiste Onofré updated SMXCOMP-78:
----------------------------------------

    Fix Version/s:     (was: 2011.01)
                   2011.02

> Rest provide marshaler
> ----------------------
>
>                 Key: SMXCOMP-78
>                 URL: https://issues.apache.org/jira/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: 2011.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.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message