Class WsdlDefinitionHandlerAdapter
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,org.springframework.web.servlet.HandlerAdapter
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.
- Since:
- 1.0.0
- Author:
- Arjen Poutsma
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
long
getLastModified
(jakarta.servlet.http.HttpServletRequest request, Object handler) org.springframework.web.servlet.ModelAndView
handle
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) void
setLocationExpression
(String locationExpression) Sets the XPath expression used for extracting thelocation
attributes from the WSDL 1.1 definition.void
setSchemaLocationExpression
(String schemaLocationExpression) Sets the XPath expression used for extracting theschemaLocation
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 incomingHttpServletRequest
.void
setTransformSchemaLocations
(boolean transformSchemaLocations) Sets whether relative address schema locations in the WSDL are to be transformed using the request URI of the incomingHttpServletRequest
.boolean
protected void
transformLocations
(Document definitionDocument, jakarta.servlet.http.HttpServletRequest request) Transforms alllocation
attributes to reflect the server name givenHttpServletRequest
.protected void
transformSchemaLocations
(Document definitionDocument, jakarta.servlet.http.HttpServletRequest request) Transforms allschemaLocation
attributes to reflect the server name givenHttpServletRequest
.Methods inherited from class org.springframework.ws.transport.http.LocationTransformerObjectSupport
transformLocation, transformLocations
Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
-
Field Details
-
DEFAULT_LOCATION_EXPRESSION
Default XPath expression used for extracting alllocation
attributes from the WSDL definition.- See Also:
-
DEFAULT_SCHEMA_LOCATION_EXPRESSION
Default XPath expression used for extracting allschemaLocation
attributes from the WSDL definition.- See Also:
-
-
Constructor Details
-
WsdlDefinitionHandlerAdapter
public WsdlDefinitionHandlerAdapter()
-
-
Method Details
-
setLocationExpression
Sets the XPath expression used for extracting thelocation
attributes from the WSDL 1.1 definition.Defaults to
DEFAULT_LOCATION_EXPRESSION
. -
setSchemaLocationExpression
Sets the XPath expression used for extracting theschemaLocation
attributes from the WSDL 1.1 definition.Defaults to
DEFAULT_SCHEMA_LOCATION_EXPRESSION
. -
setTransformLocations
public void setTransformLocations(boolean transformLocations) Sets whether relative address locations in the WSDL are to be transformed using the request URI of the incomingHttpServletRequest
. Defaults tofalse
. -
setTransformSchemaLocations
public void setTransformSchemaLocations(boolean transformSchemaLocations) Sets whether relative address schema locations in the WSDL are to be transformed using the request URI of the incomingHttpServletRequest
. Defaults tofalse
. -
getLastModified
- Specified by:
getLastModified
in interfaceorg.springframework.web.servlet.HandlerAdapter
-
handle
public org.springframework.web.servlet.ModelAndView handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) throws Exception - Specified by:
handle
in interfaceorg.springframework.web.servlet.HandlerAdapter
- Throws:
Exception
-
supports
- Specified by:
supports
in interfaceorg.springframework.web.servlet.HandlerAdapter
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
transformLocations
protected void transformLocations(Document definitionDocument, jakarta.servlet.http.HttpServletRequest request) throws Exception Transforms alllocation
attributes to reflect the server name givenHttpServletRequest
. Determines the suitable attributes by evaluating the defined XPath expression, and delegates totransformLocation
to do the transformation for all attributes that match.This method is only called when the
transformLocations
property is true. -
transformSchemaLocations
protected void transformSchemaLocations(Document definitionDocument, jakarta.servlet.http.HttpServletRequest request) throws Exception Transforms allschemaLocation
attributes to reflect the server name givenHttpServletRequest
. Determines the suitable attributes by evaluating the defined XPath expression, and delegates totransformLocation
to do the transformation for all attributes that match.This method is only called when the
transformSchemaLocations
property is true.
-