INT-1677 updated 2.1 schema with new 'payload-expression' attribute as well as 'header' element. Polished UriPathHandlerMapping to address comments from the review

This commit is contained in:
Oleg Zhurakousky
2011-09-01 16:28:09 -04:00
committed by Mark Fisher
parent 7b1b273393
commit 90a5936803
2 changed files with 49 additions and 8 deletions

View File

@@ -19,7 +19,6 @@ import java.util.Collections;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.util.ObjectUtils;
import org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping;
@@ -28,14 +27,18 @@ import org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMappin
* @author Oleg Zhurakousky
* @since 2.1
*/
public class UriPathHandlerMapping extends AbstractDetectingUrlHandlerMapping implements InitializingBean {
public class UriPathHandlerMapping extends AbstractDetectingUrlHandlerMapping {
public UriPathHandlerMapping(){
this.setOrder(Integer.MIN_VALUE);
}
protected void detectHandlers() throws BeansException {
if (logger.isDebugEnabled()) {
logger.debug("Looking for URL mappings in application context: " + getApplicationContext());
}
String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(getApplicationContext(), Object.class);
String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(getApplicationContext(), HttpRequestHandlingEndpointSupport.class);
for (String beanName : beanNames) {
String[] urls = determineUrlsForHandler(beanName);
@@ -58,8 +61,4 @@ public class UriPathHandlerMapping extends AbstractDetectingUrlHandlerMapping im
String path = handler.getPath();
return Collections.singletonList(path).toArray(new String[]{});
}
public void afterPropertiesSet() throws Exception {
this.setOrder(Integer.MIN_VALUE);
}
}

View File

@@ -20,6 +20,9 @@
Defines an inbound HTTP-based Channel Adapter.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="header" type="headerType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="channel" type="xsd:string" use="required">
@@ -57,6 +60,13 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="payload-expression" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Allows you to specify SpEL expression to construct a Message payload
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="error-code" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
@@ -116,6 +126,9 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="gatewayType">
<xsd:sequence>
<xsd:element name="header" type="headerType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="extract-reply-payload" type="xsd:string" default="true" />
<xsd:attribute name="supported-methods" type="xsd:string" />
@@ -135,6 +148,13 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="payload-expression" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Allows you to specify SpEL expression to construct a Message payload
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="error-code" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
@@ -493,6 +513,28 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="headerType">
<xsd:annotation>
<xsd:documentation><![CDATA[
Expression to be evaluated against the ServletRequest(makes BODY and Headers available) as well as URI Variables (e.g., foo/bar/{id}).
]]></xsd:documentation>
</xsd:annotation>
<xsd:attribute name="name" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
Name of the Message Header
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="expression" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
Expression to be evaluated to determine the value of the header.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:simpleType name="httpMethodEnumeration">
<xsd:restriction base="xsd:token">