private StringBuilder getGatewayEndpoint() {
        String endpoint = WarGateway.config.getConfigProperty(APIMAN_GATEWAY_ENDPOINT, null);
        StringBuilder builder = new StringBuilder();
        if (endpoint == null) {
            HttpServletRequest currentRequest = HttpRequestThreadLocalFilter.getCurrentRequest();
            if (currentRequest == null) {
                throw new RuntimeException("No current request available.  Missing HttpRequestThreadLocalFilter from the web.xml?"); //$NON-NLS-1$
            }
            builder.append(currentRequest.getScheme());
            builder.append("://"); //$NON-NLS-1$
            builder.append(currentRequest.getServerName());
            int serverPort = currentRequest.getServerPort();
            if (serverPort != 80 && serverPort != 443) {
                builder.append(":").append(serverPort); //$NON-NLS-1$
            }
            builder.append("/apiman-gateway/"); //$NON-NLS-1$
        } else {
            builder.append(endpoint);
            if (!endpoint.endsWith("/")) { //$NON-NLS-1$
                builder.append("/"); //$NON-NLS-1$
            }
        }
        return builder;
    }
Determine gateway endpoint
@return gateway endpoint as StringBuilder
gateway/platforms/war/src/main/java/io/apiman/gateway/platforms/war/WarPlatform.java