{#========================================== Spincast Undertow plugin ==========================================#} {% extends "../../layout.html" %} {% block sectionClasses %}plugins hasBreadCrumb plugins-spincast-undertow{% endblock %} {% block meta_title %}Plugins - Spincast Undertow{% endblock %} {% block meta_description %}Spincast Undertow plugin provides the default HTTP server for a Spincast application.{% endblock %} {% block scripts %} {% endblock %} {% block body %}

Overview

The Spincast Undertow plugin provides an implementation of the Server interface using the Undertow server.

Installation

If you use the spincast-default artifact, this plugin is already installed so you have nothing more to do!

If you start from scratch using the spincast-core artifact, you can use the plugin by adding this artifact to your project:

<dependency>
    <groupId>org.spincast</groupId>
    <artifactId>spincast-plugins-undertow</artifactId>
    <version>{{spincast.spincastCurrrentVersion}}</version>
</dependency>

You then install the plugin's Guice module, by passing it to the Guice.createInjector(...) method:

Injector guice = Guice.createInjector(
        new SpincastCoreGuiceModule(args),
        new SpincastUndertowPluginGuiceModule(AppRequestContext.class, AppWebsocketContext.class)
        // other modules...
        );

... or by using the install(...) method from your custom Guice module:

public class AppModule extends SpincastCoreGuiceModule {

    @Override
    protected void configure() {
        super.configure();
        install(new SpincastUndertowPluginGuiceModule(getRequestContextType(), 
                                                      getWebsocketContextType()));
        // other modules...
    }
    
    // ...
}

Javadoc

Configuration

You can bind a SpincastUndertowConfig component if you want to change some default configurations. The default implementation class for those configurations is SpincastUndertowConfigDefault.

Reverse Proxy

If you use a reverse proxy, such as Nginx or Apache, make sure it sets those HTTP headers if the forwarded scheme, host or port are different then the original ones :

  • X-Forwarded-Proto: The original scheme (http or https)
  • X-Forwarded-Host: The original host.
  • X-Forwarded-Port: The original port.

The Spincast Undertow plugin will use those headers to provide the correct information when getFullUrlOriginal() is called.

{% endblock %}