Author: ashakirin
Date: Thu Nov 15 15:19:38 2012
New Revision: 1409830
URL: http://svn.apache.org/viewvc?rev=1409830&view=rev
Log:
Added default constructor to XSLTIn/Out interceptors
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTFeature.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTInInterceptor.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java
cxf/trunk/rt/core/src/test/java/org/apache/cxf/feature/transform/XSLTInterceptorsTest.java
cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/transform/feature/TransformFeatureTest.java
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTFeature.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTFeature.java?rev=1409830&r1=1409829&r2=1409830&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTFeature.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTFeature.java
Thu Nov 15 15:19:38 2012
@@ -22,9 +22,6 @@ import org.apache.cxf.Bus;
import org.apache.cxf.common.injection.NoJSR250Annotations;
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.interceptor.InterceptorProvider;
-import org.apache.cxf.interceptor.StaxInInterceptor;
-import org.apache.cxf.interceptor.StaxOutInterceptor;
-import org.apache.cxf.phase.Phase;
/**
* This class defines a feature is used to transform message using XSLT
script.
@@ -41,13 +38,12 @@ public class XSLTFeature extends Abstrac
@Override
protected void initializeProvider(InterceptorProvider provider, Bus bus) {
if (inXSLTPath != null) {
- XSLTInInterceptor in = new XSLTInInterceptor(Phase.POST_STREAM,
StaxInInterceptor.class, null, inXSLTPath);
+ XSLTInInterceptor in = new XSLTInInterceptor(inXSLTPath);
provider.getInInterceptors().add(in);
}
if (outXSLTPath != null) {
- XSLTOutInterceptor out = new XSLTOutInterceptor(Phase.PRE_STREAM,
StaxOutInterceptor.class, null,
- outXSLTPath);
+ XSLTOutInterceptor out = new XSLTOutInterceptor(outXSLTPath);
provider.getOutInterceptors().add(out);
provider.getOutFaultInterceptors().add(out);
}
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTInInterceptor.java?rev=1409830&r1=1409829&r2=1409830&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTInInterceptor.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTInInterceptor.java
Thu Nov 15 15:19:38 2012
@@ -30,8 +30,10 @@ import javax.xml.stream.XMLStreamReader;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.StaxInInterceptor;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.StaxUtils;
@@ -41,6 +43,10 @@ import org.apache.cxf.staxutils.StaxUtil
public class XSLTInInterceptor extends AbstractXSLTInterceptor {
private static final Logger LOG =
LogUtils.getL7dLogger(XSLTInInterceptor.class);
+ public XSLTInInterceptor(String xsltPath) {
+ super(Phase.POST_STREAM, StaxInInterceptor.class, null, xsltPath);
+ }
+
public XSLTInInterceptor(String phase, Class<?> before, Class<?> after,
String xsltPath) {
super(phase, before, after, xsltPath);
}
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java?rev=1409830&r1=1409829&r2=1409830&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java
Thu Nov 15 15:19:38 2012
@@ -35,10 +35,12 @@ import org.apache.cxf.common.logging.Log
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.io.CachedOutputStreamCallback;
import org.apache.cxf.io.CachedWriter;
import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.DelegatingXMLStreamWriter;
import org.apache.cxf.staxutils.StaxUtils;
@@ -48,6 +50,10 @@ import org.apache.cxf.staxutils.StaxUtil
public class XSLTOutInterceptor extends AbstractXSLTInterceptor {
private static final Logger LOG =
LogUtils.getL7dLogger(XSLTOutInterceptor.class);
+ public XSLTOutInterceptor(String xsltPath) {
+ super(Phase.PRE_STREAM, StaxOutInterceptor.class, null, xsltPath);
+ }
+
public XSLTOutInterceptor(String phase, Class<?> before, Class<?> after,
String xsltPath) {
super(phase, before, after, xsltPath);
}
Modified:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/feature/transform/XSLTInterceptorsTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/feature/transform/XSLTInterceptorsTest.java?rev=1409830&r1=1409829&r2=1409830&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/test/java/org/apache/cxf/feature/transform/XSLTInterceptorsTest.java
(original)
+++
cxf/trunk/rt/core/src/test/java/org/apache/cxf/feature/transform/XSLTInterceptorsTest.java
Thu Nov 15 15:19:38 2012
@@ -36,6 +36,7 @@ import javax.xml.transform.stream.Stream
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
+
import junit.framework.Assert;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
@@ -45,7 +46,6 @@ import org.apache.cxf.io.CachedOutputStr
import org.apache.cxf.io.CachedWriter;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.StaxUtils;
import org.junit.Before;
import org.junit.Test;
@@ -70,8 +70,8 @@ public class XSLTInterceptorsTest {
throw new IllegalArgumentException("Cannot load message from path:
" + MESSAGE_FILE);
}
message = new MessageImpl();
- inInterceptor = new XSLTInInterceptor(Phase.POST_STREAM, null, null,
TRANSFORMATION_XSL);
- outInterceptor = new XSLTOutInterceptor(Phase.PRE_STREAM, null, null,
TRANSFORMATION_XSL);
+ inInterceptor = new XSLTInInterceptor(TRANSFORMATION_XSL);
+ outInterceptor = new XSLTOutInterceptor(TRANSFORMATION_XSL);
}
@Test
Modified:
cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/transform/feature/TransformFeatureTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/transform/feature/TransformFeatureTest.java?rev=1409830&r1=1409829&r2=1409830&view=diff
==============================================================================
---
cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/transform/feature/TransformFeatureTest.java
(original)
+++
cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/transform/feature/TransformFeatureTest.java
Thu Nov 15 15:19:38 2012
@@ -31,9 +31,6 @@ import org.apache.cxf.endpoint.Client;
import org.apache.cxf.feature.transform.XSLTInInterceptor;
import org.apache.cxf.feature.transform.XSLTOutInterceptor;
import org.apache.cxf.frontend.ClientProxy;
-import org.apache.cxf.interceptor.StaxInInterceptor;
-import org.apache.cxf.interceptor.StaxOutInterceptor;
-import org.apache.cxf.phase.Phase;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -59,8 +56,7 @@ public class TransformFeatureTest extend
Echo port = service.getPort(PORT_NAME, Echo.class);
Client client = ClientProxy.getClient(port);
- XSLTOutInterceptor outInterceptor = new
XSLTOutInterceptor(Phase.PRE_STREAM, StaxOutInterceptor.class, null,
-
XSLT_REQUEST_PATH);
+ XSLTOutInterceptor outInterceptor = new
XSLTOutInterceptor(XSLT_REQUEST_PATH);
client.getOutInterceptors().add(outInterceptor);
String response = port.echo("test");
Assert.assertTrue("Request was not transformed",
response.contains(TRANSFORMED_CONSTANT));
@@ -74,8 +70,7 @@ public class TransformFeatureTest extend
Echo port = service.getPort(PORT_NAME, Echo.class);
Client client = ClientProxy.getClient(port);
- XSLTInInterceptor inInterceptor = new
XSLTInInterceptor(Phase.POST_STREAM, StaxInInterceptor.class, null,
-
XSLT_RESPONSE_PATH);
+ XSLTInInterceptor inInterceptor = new
XSLTInInterceptor(XSLT_RESPONSE_PATH);
client.getInInterceptors().add(inInterceptor);
String response = port.echo("test");
Assert.assertTrue(response.contains(TRANSFORMED_CONSTANT));