axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Takahide Nogayama <NOGAY...@jp.ibm.com>
Subject Re: Request for XML Filter (AXIS2-1085)
Date Mon, 20 Nov 2006 13:08:15 GMT
Look back at original solution, Filter configuration , filter is 
enabled/disabled, is written in axis2.xml and stored in 
axis2configuration.
At transport layer compornent, Filter configuration is read and filter 
instance is created, if it is enabled. MessageContext and XMLStreamReader
are passed to the filter, and XMLStreamReader is replaced by the filter. 
Then, StAXOMBuilder is created from the filter. 

Original solution solves an issue of Handler solution "need to change 
StAXBuilder." In Handler solution, filter is inserted after builder is 
created.
So StAXBuilder is needed to change to replace XMLStreamReader, In original 
solution, filter is inserted before builder is created. filter is passed 
to StAXBuilder constructor instead of XMLStreamReader. We can avoid to add 
setParser(XMLStreamReader) method to StAXBuilder. And original
 solution solves an issue of XMLInputFactory solution, MessageContext is 
passed to filter explicitly by using input parameter. It is easy to 
understand
and keeps consistency because there is no use of static reference or 
Thread Local strage. I believe this origianal solution is most reasnable 
if we introduce
filter framework.

The following is code snippet of transport layer compornent.
    // replace xmlreader by filter if filter is enabled.
    xmlreader = 
msgContext.getConfigurationContext().getAxisConfiguration().getFilterRegistry().enableFilter(xmlreader,

msgContext);
    builder = new StAXSOAPModelBuilder(xmlreader, 
SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    envelope = (SOAPEnvelope) builder.getDocumentElement();

The points of original solution are
    - Pass MessageContext to filter at transport layer components 
explicitly. (write the passing code on each transport layer components)
    - Insert filter at transport layer components explicitly. (write 
inserting code on each transport layer components)
    - Filter configuration is stored in axis2.xml

pros)
    - Filter can see all StAXEvents of the message. Because filter is 
inserted before OM tree is built.
    - It is easy to understand about passing MessageContext. because it is 
passed explicitly as an input parameter to filter.
    - We can avoid to change StAXBuilder (add setParser(XMLStreamReader) 
method to StAXBuilder).

cons)
    - There is layer mixing. (User can do QOS related processing in 
parsing layer.)
    - Need to change AXIS2 transport layer components.

Regards,

---------------------------
Takahide Nogayama
Mime
View raw message