Added template for new operation
This commit is contained in:
@@ -50,7 +50,10 @@ public class XmlController implements RestController {
|
||||
public void acceptRequestXslt(Request request, Response response) {
|
||||
acceptRequest(request, response, XmlJobType.XSLT);
|
||||
}
|
||||
|
||||
@ScopedControllerManifest(method = HandlerType.POST, path = "/xslt/addParam")
|
||||
public void acceptRequestXsltAddParam(Request request, Response response) {
|
||||
acceptRequest(request, response, XmlJobType.XSLT_PARAM);
|
||||
}
|
||||
private void acceptRequest(Request request, Response response, XmlJobType xmlJobType) {
|
||||
XMLRequestBody requestBody;
|
||||
try {
|
||||
@@ -129,6 +132,8 @@ public class XmlController implements RestController {
|
||||
|
||||
String result = null;
|
||||
switch (xmlJob.getXmlJobType()) {
|
||||
case XSLT_PARAM:
|
||||
result = engine.addParam(requestBody.getData(), requestBody.getProcessorData());
|
||||
case XSLT:
|
||||
result = engine.processXSLT(requestBody.getData(), requestBody.getProcessorData());
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.r11.tools.controller.internal;
|
||||
|
||||
public enum XmlJobType {
|
||||
XPath("XPath"), XSD("XSD"), XQuery("XQuery"), XSLT("XSLT");
|
||||
XPath("XPath"), XSD("XSD"), XQuery("XQuery"), XSLT("XSLT"), XSLT_PARAM("PARAM");
|
||||
|
||||
XmlJobType(String type) {
|
||||
}
|
||||
|
||||
@@ -164,4 +164,9 @@ public class Saxon implements XmlEngine{
|
||||
public String getVersion() {
|
||||
return "Saxon " + new Processor(false).getSaxonProductVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addParam(String data, String processorData) throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,11 @@ public class Xalan implements XmlEngine{
|
||||
return org.apache.xalan.Version.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addParam(String data, String processorData) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates string representation of the xml document against xsd schema
|
||||
* @param data xml document
|
||||
|
||||
@@ -9,9 +9,7 @@ public interface XmlEngine {
|
||||
XPathQueryResult processXPath(String data, String query, String version) throws Exception;
|
||||
String processXSLT(String data, String transform) throws Exception;
|
||||
String validate(String data, String xsd) throws Exception;
|
||||
|
||||
String executeXQuery(String data, String xquery, String version) throws Exception;
|
||||
|
||||
public String getVersion();
|
||||
|
||||
String addParam(String data, String processorData) throws Exception;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user