Hi Folks,
You have an XSLT program and an input XML file. You can run the transformation
locally using Java and an XSLT processor such as Saxon.
Now you want to make that transformation available to others. Instead of
running it yourself, you want users (or other programs) to send XML to your
application and receive the transformed XML in return.
In other words, you want to create a web application that exposes your XSLT
program as a service.
Without Spring Boot, doing that requires a significant amount of
infrastructure work.
You would need to:
* set up a web server (such as Apache Tomcat), install it, and configure
it
* write low-level code to handle HTTP requests (parse requests, extract
URLs and parameters)
* convert incoming XML data into a form your program can use
* manually create and connect your application components (controllers,
services, etc.)
* implement consistent error handling, validation, and HTTP response
behavior
So before you can even run your XSLT program, you first have to build a large
amount of supporting "plumbing."
This is what I call the infrastructure problem.
Spring Boot lets you avoid all that. It provides the infrastructure needed to
build a web application, so you can focus on your application logic instead of
building and configuring the underlying system yourself.
For example, using Spring Boot, you can write something as simple as:
@GetMapping("/hello")
public Map<String,String> hello(...) { ... }
and Spring Boot automatically handles:
* providing and automatically starting a web server
* receiving HTTP requests
* mapping request data to your code
* generating HTTP responses
In this way, Spring Boot removes the need to manually build the plumbing of a
web application.
Important: Spring Boot does not perform your application logic. It provides
the infrastructure in which your application runs. In this example, Spring
Boot receives the XML request, your Java code invokes Saxon, and Saxon runs
the XSLT transformation.
Below is a detailed, step-by-step guide showing exactly how to create an
XML/XSLT web application using Spring Boot.
________________________________
My guide is too long for the mailing list. Email me if you want it.
|