public class WsdlDefinitionHandlerAdapter extends LocationTransformerObjectSupport implements HandlerAdapter, InitializingBean
WsdlDefinition
interface with the generic DispatcherServlet
.
Reads the source from the mapped WsdlDefinition
implementation, and writes that as the result to the
HttpServletResponse
.
If the property transformLocations
is set to true
, this adapter will change
location
attributes in the WSDL definition to reflect the URL of the incoming request. If the location
field in the original WSDL is an absolute path, the scheme, hostname, and port will be changed. If the location is a
relative path, the scheme, hostname, port, and context path will be prepended. This behavior can be customized by
overriding the transformLocation()
method.
For instance, if the location attribute defined in the WSDL is http://localhost:8080/context/services/myService
,
and the request URI for the WSDL is http://example.com/context/myService.wsdl
, the location will be
changed to http://example.com/context/services/myService
.
If the location attribute defined in the WSDL is /services/myService
, and the request URI for the WSDL
is http://example.com:8080/context/myService.wsdl
, the location will be changed to
http://example.com:8080/context/services/myService
.
When transformLocations
is enabled, all location
attributes found in the WSDL definition
are changed by default. This behavior can be customized by changing the locationExpression
property,
which is an XPath expression that matches the attributes to change.
WsdlDefinition
,
setTransformLocations(boolean)
,
setLocationExpression(String)
,
LocationTransformerObjectSupport.transformLocation(String,javax.servlet.http.HttpServletRequest)
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LOCATION_EXPRESSION
Default XPath expression used for extracting all
location attributes from the WSDL definition. |
static String |
DEFAULT_SCHEMA_LOCATION_EXPRESSION
Default XPath expression used for extracting all
schemaLocation attributes from the WSDL definition. |
Constructor and Description |
---|
WsdlDefinitionHandlerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
long |
getLastModified(HttpServletRequest request,
Object handler) |
ModelAndView |
handle(HttpServletRequest request,
HttpServletResponse response,
Object handler) |
void |
setLocationExpression(String locationExpression)
Sets the XPath expression used for extracting the
location attributes from the WSDL 1.1 definition. |
void |
setSchemaLocationExpression(String schemaLocationExpression)
Sets the XPath expression used for extracting the
schemaLocation attributes from the WSDL 1.1 definition. |
void |
setTransformLocations(boolean transformLocations)
Sets whether relative address locations in the WSDL are to be transformed using the request URI of the incoming
HttpServletRequest . |
void |
setTransformSchemaLocations(boolean transformSchemaLocations)
Sets whether relative address schema locations in the WSDL are to be transformed using the request URI of the
incoming
HttpServletRequest . |
boolean |
supports(Object handler) |
protected void |
transformLocations(Document definitionDocument,
HttpServletRequest request)
Transforms all
location attributes to reflect the server name given HttpServletRequest . |
protected void |
transformSchemaLocations(Document definitionDocument,
HttpServletRequest request)
Transforms all
schemaLocation attributes to reflect the server name given HttpServletRequest . |
transformLocation, transformLocations
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
public static final String DEFAULT_LOCATION_EXPRESSION
location
attributes from the WSDL definition.public static final String DEFAULT_SCHEMA_LOCATION_EXPRESSION
schemaLocation
attributes from the WSDL definition.public void setLocationExpression(String locationExpression)
location
attributes from the WSDL 1.1 definition.
Defaults to DEFAULT_LOCATION_EXPRESSION
.
public void setSchemaLocationExpression(String schemaLocationExpression)
schemaLocation
attributes from the WSDL 1.1 definition.
Defaults to DEFAULT_SCHEMA_LOCATION_EXPRESSION
.
public void setTransformLocations(boolean transformLocations)
HttpServletRequest
. Defaults to false
.public void setTransformSchemaLocations(boolean transformSchemaLocations)
HttpServletRequest
. Defaults to false
.public long getLastModified(HttpServletRequest request, Object handler)
getLastModified
in interface HandlerAdapter
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
handle
in interface HandlerAdapter
Exception
public boolean supports(Object handler)
supports
in interface HandlerAdapter
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
protected void transformLocations(Document definitionDocument, HttpServletRequest request) throws Exception
location
attributes to reflect the server name given HttpServletRequest
.
Determines the suitable attributes by evaluating the defined XPath expression, and delegates to
transformLocation
to do the transformation for all attributes that match.
This method is only called when the transformLocations
property is true.
protected void transformSchemaLocations(Document definitionDocument, HttpServletRequest request) throws Exception
schemaLocation
attributes to reflect the server name given HttpServletRequest
.
Determines the suitable attributes by evaluating the defined XPath expression, and delegates to
transformLocation
to do the transformation for all attributes that match.
This method is only called when the transformSchemaLocations
property is true.