Various servets and filters

Steinar Bang d7cec7b32b Add version 1.0.0 to the release history in the README and change the version number in the examples in the README to 1.0.0 1 week ago
servlet.frontend 43133fc1e8 [maven-release-plugin] prepare for next development iteration 1 week ago
src b8b3a8dbc1 Add servlet implementing common operations for serving out webpack'ed JavaScript frontends 2 weeks ago
.editorconfig b8b3a8dbc1 Add servlet implementing common operations for serving out webpack'ed JavaScript frontends 2 weeks ago
.gitignore b8b3a8dbc1 Add servlet implementing common operations for serving out webpack'ed JavaScript frontends 2 weeks ago
.travis.yml b8b3a8dbc1 Add servlet implementing common operations for serving out webpack'ed JavaScript frontends 2 weeks ago
LICENSE b8b3a8dbc1 Add servlet implementing common operations for serving out webpack'ed JavaScript frontends 2 weeks ago
README.org d7cec7b32b Add version 1.0.0 to the release history in the README and change the version number in the examples in the README to 1.0.0 1 week ago
pom.xml 43133fc1e8 [maven-release-plugin] prepare for next development iteration 1 week ago

README.org

Java servlet common code

Servlet and filter classes that are intended to be inherited to cut down on boilerplate code

Status of the project

file:https://travis-ci.org/steinarb/servlet.svg?branch=master file:https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.servlet%3Aservlet&metric=alert_status#.svg file:https://maven-badges.herokuapp.com/maven-central/no.priv.bang.servlet/servlet/badge.svg file:https://www.javadoc.io/badge/no.priv.bang.servlet/servlet.svg

Sonarqube

file:https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.servlet%3Aservlet&metric=ncloc#.svg file:https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.servlet%3Aservlet&metric=bugs#.svg file:https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.servlet%3Aservlet&metric=vulnerabilities#.svg file:https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.servlet%3Aservlet&metric=code_smells#.svg file:https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.servlet%3Aservlet&metric=coverage#.svg

Release history

Date Version Comment
<2020-01-12 Sun 23:26> 1.0.0 First release of the FrontendServlet

Overview of the project

Frontend

This is a servlet that's intened to be extended by a servlet serving out a JS frontend packed by webpack.

The servlet will search for resources matching the pathInfo (minus the webcontext) on the classpath and serve them out, setting the content type based on the file name extension.

The servlet will try serving the file "index.html" (that must exist on the classpath) for a list of routes, that can be set by a subclass. This is to handle reloads of URLs set by e.g. the react router.

To use the servlet in an application built with maven, add the maven dependency:

no.priv.bang.servlet servlet.frontend 1.0.0

    To use the servlet in a webapp running in the apache karaf web whiteboard apache:
  1. Add a maven dependency
  2. #+begin_src xml no.priv.bang.servlet servlet.frontend 1.0.0 provided #+end_src
  3. Create an OSGi bundle containing a DS component registering with the web whiteboard
  4. #+begin_src java @Component(service={Servlet.class}) public class ReactServlet extends FrontendServlet {

// The paths used by the react router all needs to return the HTML wrapping the bundle.js private final List routes = Arrays.asList("/", "/counter", "/about");

    @Reference public void setLogservice(LogService logservice) { super.setLogService(logservice); } } #+end_src
  1. Add a runtime dependency to the bundle project's template feature repository (i.e. src/main/feature/feature.xml in the bundle project):
  2. #+begin_src xml mvn:no.priv.bang.servlet/servlet/1.0.0/xml/features frontend-servlet #+end_src

License

This code is licensed under the Apache license v. 2. See the LICENSE file for details.