HTTPS with Undertow

This guide will help you generate a certificate and configure Undertow to use it for HTTPS.

Web

SeedStack on WebSphere

IBM WebSphere Application Server (WAS) is a complex Web application server that can pose some challenges to developers. The goal of this guide is to aggregate useful information about deploying SeedStack application on WAS successfully.

Web

Conversion to WAR

SeedStack projects created by the generate goal of the SeedStack Maven plugin are designed to be run from command-line with an embedded Web server. You can convert this kind of project to a classic WAR.

CORS

Cross-Origin Resource Sharing (CORS) is supported through a Java filter and can be enabled in any SeedStack application. Seed integrates the CORS filter from dzhuvinov software. There is no need to install and configure the filter manually, it is automatically registered by Seed. All filter options can be specified through configuration properties. Configuration CORS can be enabled and configuration as below: Configuration Tool web: cors: # The servlet path mapping on which CORS will be active path: (String) # If true, Cross-Origin-Resource-Sharing (CORS) will be enabled enabled: (boolean) # Allows to specify custom properties to the CORS filter (see below) properties: key: (String) To dump the web.

REST

The seed-rest-core and its companion modules provides support for exposing REST resources using JAX-RS. SeedStack implements the JAX-RS standard through the Jersey 2 implementation.

REST API

We already have a minimal REST API that says Hello World! in our demo application. In this page we will enrich the API with some SeedStack A Swagger descriptor Swagger is a popular API description format. It helps in discovering API, whereas by humans or by machines. To add a Swagger descriptor to our project, we just need to add the following dependency: Maven Gradle <dependency> <groupId>org.seedstack.addons.swagger</groupId> <artifactId>swagger</artifactId><version>2.

Running Web applications

The seed-web-core and its companion modules provide support for Web technologies, such as Servlets, WebSockets, embedded Web servers, serving static resources, etc…

Servlet, filters and listeners

Servlets, filters and listeners can be detected and registered by SeedStack which makes them injectable and interceptable. Servlets You can register a servlet by annotating your servlet class with @WebServlet: @WebServlet("/my-servlet") public class MyServlet extends HttpServlet { ... } You can specify a priority on each listener to order them in the context initialization and destruction sequences: add a @Priority annotation to the listener class with the absolute priority as value.

Static resources

SeedStack provides static resource serving from the classpath and the document root with some benefits over the container default resource serving: Automatic serving of pre-minified and/or pre-gzipped versions of resources, On-the-fly gzipping of resources, Cache friendly. Behavior The behavior is to serve resources located under the document root folder and, if not found, under the META-INF/resources classpath location on the /* path. For example, consider the following folder tree:

Testing

Testing is a crucial part of application development and should not be overlooked. SeedStack can help you to test your application by providing the necessary tools. Unit testing SeedStack doesn’t provide specific tools for unit-testing. Just write your unit tests as usual. Integration testing SeedStack provides several features to do integration testing. You can do things like altering configuration, defining launch arguments or set system properties. This can be done either for the execution of a full test class, for a specific test only, or both.

Web security

In a Web application, security can be enforced at the HTTP-level by a servlet filter using URL filtering patterns. This feature requires the following dependency in your project: Maven Gradle <dependency> <groupId>org.seedstack.seed</groupId> <artifactId>seed-web-security</artifactId><version>3.14.0</version> </dependency> Specifying versions manually is error-prone, use dependency management instead. Show version dependencies { compile("org.seedstack.seed:seed-web-security:3.14.0") } The security servlet filter is automatically added on /* and has the ability to intercept all application URLs.

WebSockets

Seed also integrates the Java API for WebSocket (JSR 356), allowing server and client endpoints to be injected. WebSocket support requires Java 7 and a compatible server to work. Server endpoints Server endpoints have to explicitly specify a SeedBaseEndpointConfigurator to be managed by Seed. @ServerEndpoint(value = "/chat", configurator = BaseServerEndpointConfigurator.class) public class ChatEndpoint { @Logging private Logger logger; @Inject EchoService echoService; @OnOpen public void onOpen(Session session) { logger.info("Connected ... " + session.