RequestHandlers

Request handlers are used in the gateway component.

For each site configuration, multiple request handlers can be configured. This way extra functions are available.

Currently, following request handlers are deployed:

  • AuthenticationCookieHandler: checks for authentication cookie and redirects to login

  • ResourceExpirationHandler: sets expiration headers for a pattern

  • SetHeaderHandler : sets headers

  • RemoveWWWHandler: if url with www is asked, strip it

Crafting your own request handler

You can create your own generator implementation by creating a new java maven project and include following dependency:

<dependency>
    <groupId>be.personify</groupId>
    <artifactId>personify-util</artifactId>
    <version>1.4.1.RELEASE</version>
</dependency>

This will give you the possibility of implementing the class HttpRequestHandler.

....
import be.personify.util.http.HttpRequestHandler;
....

public class CustomHandler extends HttpRequestHandler {
  
  @Override
  public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ....
  }
  
  @Override
  public Map<String, String> collectHeaderOverrides() {
	return null;
  }

}

The handle method gives you access to the request and the response.

collectHeaderOverrides lets you override the headers.

Last updated