Class StatusCodeTranslator


  • public class StatusCodeTranslator
    extends Object
    Helps to translate status codes.
    Author:
    https://github.com/ljucam [Mario Aerni]
    • Constructor Detail

      • StatusCodeTranslator

        public StatusCodeTranslator()
    • Method Detail

      • translateStatusCode

        public static int translateStatusCode​(int statusCode,
                                              io.vertx.core.MultiMap headers)
        Checks if there exists a handling for the given statusCode in the headers of the request. The header is checked for a pattern matching x-translate-status- and the given statusCode.
        Parameters:
        statusCode - the original status code
        headers - the headers of the request
        Returns:
        the translated status or if no translation was carried out the original status code.
      • getTranslateFreeHeaders

        public static io.vertx.core.MultiMap getTranslateFreeHeaders​(io.vertx.core.MultiMap headers)
        Creates a new MultiMap based on the given headers but without any 'x-translate-status-xxx' entries.
        Parameters:
        headers - original headers
        Returns:
        a copy of the original headers without any translate headers