|
Spring Web Services Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.xml.transform.TransformerObjectSupport org.springframework.ws.server.endpoint.interceptor.AbstractValidatingInterceptor
public abstract class AbstractValidatingInterceptor
Abstract base class for EndpointInterceptor
implementations that validate part of the message using a
schema. The exact message part is determined by the getValidationRequestSource
and
getValidationResponseSource
template methods.
validateRequest
and validateResponse
properties.
getValidationRequestSource(org.springframework.ws.WebServiceMessage)
,
getValidationResponseSource(org.springframework.ws.WebServiceMessage)
Field Summary |
---|
Fields inherited from class org.springframework.xml.transform.TransformerObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
AbstractValidatingInterceptor()
|
Method Summary | |
---|---|
void |
afterCompletion(MessageContext messageContext,
Object endpoint,
Exception ex)
Does nothing by default. |
void |
afterPropertiesSet()
|
String |
getSchemaLanguage()
|
Resource[] |
getSchemas()
Returns the schema resources to use for validation. |
protected abstract Source |
getValidationRequestSource(WebServiceMessage request)
Abstract template method that returns the part of the request message that is to be validated. |
protected abstract Source |
getValidationResponseSource(WebServiceMessage response)
Abstract template method that returns the part of the response message that is to be validated. |
boolean |
handleFault(MessageContext messageContext,
Object endpoint)
Does nothing by default. |
boolean |
handleRequest(MessageContext messageContext,
Object endpoint)
Validates the request message in the given message context. |
protected boolean |
handleRequestValidationErrors(MessageContext messageContext,
SAXParseException[] errors)
Template method that is called when the request message contains validation errors. |
boolean |
handleResponse(MessageContext messageContext,
Object endpoint)
Validates the response message in the given message context. |
protected boolean |
handleResponseValidationErrors(MessageContext messageContext,
SAXParseException[] errors)
Template method that is called when the response message contains validation errors. |
void |
setErrorHandler(ValidationErrorHandler errorHandler)
Sets the error handler to use for validation. |
void |
setSchema(Resource schema)
Sets the schema resource to use for validation. |
void |
setSchemaLanguage(String schemaLanguage)
Sets the schema language. |
void |
setSchemas(Resource[] schemas)
Sets the schema resources to use for validation. |
void |
setValidateRequest(boolean validateRequest)
Indicates whether the request should be validated against the schema. |
void |
setValidateResponse(boolean validateResponse)
Indicates whether the response should be validated against the schema. |
void |
setXsdSchema(XsdSchema schema)
Sets the XsdSchema to use for validation. |
void |
setXsdSchemaCollection(XsdSchemaCollection schemaCollection)
Sets the XsdSchemaCollection to use for validation. |
Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport |
---|
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractValidatingInterceptor()
Method Detail |
---|
public String getSchemaLanguage()
public void setSchemaLanguage(String schemaLanguage)
http://www.w3.org/2001/XMLSchema"
.
XmlValidatorFactory.SCHEMA_W3C_XML
,
XmlValidatorFactory.SCHEMA_RELAX_NG
public Resource[] getSchemas()
public void setSchema(Resource schema)
xsdSchemaCollection
, schema
, or schemas
is required.
public void setSchemas(Resource[] schemas)
xsdSchemaCollection
, schema
, or schemas
is required.
public void setXsdSchema(XsdSchema schema) throws IOException
XsdSchema
to use for validation. Setting this property, xsdSchemaCollection
, schema
, or schemas
is required.
schema
- the xsd schema to use
IOException
- in case of I/O errorspublic void setXsdSchemaCollection(XsdSchemaCollection schemaCollection) throws IOException
XsdSchemaCollection
to use for validation. Setting this property, xsdSchema
, schema
, or schemas
is required.
schemaCollection
- the xsd schema collection to use
IOException
- in case of I/O errorspublic void setErrorHandler(ValidationErrorHandler errorHandler)
errorHandler
- the error handler.public void setValidateRequest(boolean validateRequest)
true
.
public void setValidateResponse(boolean validateResponse)
false
.
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws IOException, SAXException, TransformerException
validateRequest
is set to true
, which is the default.
Returns true
if the request is valid, or false
if it isn't. Additionally, when the
request message is a SoapMessage
, a SoapFault
is added as response.
handleRequest
in interface EndpointInterceptor
messageContext
- the message contextendpoint
- chosen endpoint to invoke
true
if the message is valid; false
otherwise
IOException
SAXException
TransformerException
setValidateRequest(boolean)
protected boolean handleRequestValidationErrors(MessageContext messageContext, SAXParseException[] errors) throws TransformerException
false
, i.e. do not process the request.
messageContext
- the message contexterrors
- the validation errors
true
to continue processing the request, false
(the default) otherwise
TransformerException
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws IOException, SAXException
validateResponse
is set to true
, which is not the default.
Returns true
if the request is valid, or false
if it isn't.
handleResponse
in interface EndpointInterceptor
messageContext
- the message context.endpoint
- chosen endpoint to invoke
true
if the response is valid; false
otherwise
IOException
SAXException
setValidateResponse(boolean)
protected boolean handleResponseValidationErrors(MessageContext messageContext, SAXParseException[] errors)
false
, i.e. do not cot continue to process the response interceptor chain.
messageContext
- the message contexterrors
- the validation errors
true
to continue the response interceptor chain, false
(the default) otherwisepublic boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception
handleFault
in interface EndpointInterceptor
messageContext
- contains both request and response messages, the response should contains a Faultendpoint
- chosen endpoint to invoke
true
to continue processing of the response interceptor chain; false
to indicate
blocking of the response handler chain.
Exception
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex)
afterCompletion
in interface EndpointInterceptor
messageContext
- contains both request and response messages, the response should contains a Faultendpoint
- chosen endpoint to invokeex
- exception thrown on handler execution, if anyprotected abstract Source getValidationRequestSource(WebServiceMessage request)
request
- the request message
null
not to validate anythingprotected abstract Source getValidationResponseSource(WebServiceMessage response)
response
- the response message
null
not to validate anything
|
Spring Web Services Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |