T285 javadoc added
This commit is contained in:
		@@ -1,6 +1,14 @@
 | 
			
		||||
package r11.mltx.restxslt;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Application initializer
 | 
			
		||||
 * @author Wojciech Czop
 | 
			
		||||
 */
 | 
			
		||||
public class Main {
 | 
			
		||||
    /**
 | 
			
		||||
     * Initializes the application
 | 
			
		||||
     * @param args
 | 
			
		||||
     */
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
        SparkInitializer.run();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,14 @@ import spark.*;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class contains spark configuration and method initializing spark framework
 | 
			
		||||
 * @author Wojciech Czop
 | 
			
		||||
 */
 | 
			
		||||
public class SparkInitializer {
 | 
			
		||||
    /**
 | 
			
		||||
     * Initializes spark framework
 | 
			
		||||
     */
 | 
			
		||||
    public static void run(){
 | 
			
		||||
        Spark.port(8081);
 | 
			
		||||
 | 
			
		||||
@@ -27,6 +34,9 @@ public class SparkInitializer {
 | 
			
		||||
        System.out.println("Server is online");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handler that returns processor version
 | 
			
		||||
     */
 | 
			
		||||
    private static Route procinfoHandler = (Request req, Response resp) -> {
 | 
			
		||||
        try {
 | 
			
		||||
            resp.header("processor", "Saxon " + Saxon.getVersion() + " over s9api");
 | 
			
		||||
@@ -36,6 +46,10 @@ public class SparkInitializer {
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handler that returns info if document is valid
 | 
			
		||||
     * Also provides info about request time and processor
 | 
			
		||||
     */
 | 
			
		||||
    private static Route xsdHandler = (Request req, Response resp) -> {
 | 
			
		||||
        String body = req.body();
 | 
			
		||||
        System.out.println("Request: " + body);
 | 
			
		||||
@@ -73,6 +87,9 @@ public class SparkInitializer {
 | 
			
		||||
        return resp;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handler that returns output of xpath query and processor data
 | 
			
		||||
     */
 | 
			
		||||
    private static Route xpathHandler = (Request req, Response resp) -> {
 | 
			
		||||
 | 
			
		||||
        String body = req.body();
 | 
			
		||||
@@ -149,6 +166,9 @@ public class SparkInitializer {
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handler that returns outcome of xslt transformation and processor data
 | 
			
		||||
     */
 | 
			
		||||
    private static Route xsltHandler = (Request req, Response resp) -> {
 | 
			
		||||
        String body = req.body();
 | 
			
		||||
        ObjectMapper mapper = new ObjectMapper();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user