Class HttpServerRequestUtil


  • public class HttpServerRequestUtil
    extends java.lang.Object
    Class HttpServerRequestUtil.
    Author:
    https://github.com/mcweba [Marc-Andre Weber]
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void increaseRequestHops​(io.vertx.core.http.HttpServerRequest request)
      Increases the value of the HttpRequestHeader.X_HOPS header.
      static boolean isRemoteAddressLoopbackAddress​(io.vertx.core.http.HttpServerRequest request)  
      static boolean isRequestHopsLimitExceeded​(io.vertx.core.http.HttpServerRequest request, java.lang.Integer hopsLimit)
      Checks whether the request hops limit is reached based on the HttpRequestHeader.X_HOPS header.
      static void prepareResponse​(io.vertx.core.http.HttpServerRequest request, io.vertx.core.http.HttpClientResponse response)
      Prepares the request's response by copying values from response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isRemoteAddressLoopbackAddress

        public static boolean isRemoteAddressLoopbackAddress​(io.vertx.core.http.HttpServerRequest request)
      • increaseRequestHops

        public static void increaseRequestHops​(io.vertx.core.http.HttpServerRequest request)
        Increases the value of the HttpRequestHeader.X_HOPS header. Adds the header when not already present.
        Parameters:
        request - the request to increase the header value
      • isRequestHopsLimitExceeded

        public static boolean isRequestHopsLimitExceeded​(io.vertx.core.http.HttpServerRequest request,
                                                         java.lang.Integer hopsLimit)
        Checks whether the request hops limit is reached based on the HttpRequestHeader.X_HOPS header.
        Parameters:
        request - the request to check
        hopsLimit - the request hops limit
        Returns:
        returns true when the HttpRequestHeader.X_HOPS header value is greater than the hopsLimit parameter
      • prepareResponse

        public static void prepareResponse​(io.vertx.core.http.HttpServerRequest request,
                                           io.vertx.core.http.HttpClientResponse response)
        Prepares the request's response by copying values from response.
        Parameters:
        request - the request to modify
        response - the response containing needed values