Class Request<T>

  • Type Parameters:
    T -
    Direct Known Subclasses:
    ProxyRequest, ServiceRequest

    public abstract class Request<T>
    extends Exchange<T>
    The root class for implementing a Request providing the implementation for common methods
    Author:
    Andrea Di Cesare <andrea@softinstigate.com>
    • Constructor Detail

      • Request

        protected Request​(io.undertow.server.HttpServerExchange exchange)
    • Method Detail

      • of

        public static Request of​(io.undertow.server.HttpServerExchange exchange)
      • getContentType

        public static String getContentType​(io.undertow.server.HttpServerExchange exchange)
      • getPath

        public String getPath()
      • setContentType

        public void setContentType​(String responseContentType)
        Parameters:
        responseContentType - the responseContentType to set
      • setContentTypeAsJson

        public void setContentTypeAsJson()
        sets Content-Type=application/json
      • setContentLength

        protected void setContentLength​(int length)
      • getStartTime

        public Long getStartTime()
        Returns:
        the requestStartTime
      • setStartTime

        public void setStartTime​(Long requestStartTime)
        Parameters:
        requestStartTime - the requestStartTime to set
      • getAuthenticatedAccount

        public io.undertow.security.idm.Account getAuthenticatedAccount()
        Returns:
        the authenticatedAccount
      • addXForwardedHeader

        public void addXForwardedHeader​(String key,
                                        String value)
        Add the header X-Forwarded-[key] to the proxied request; use it to pass to the backend information otherwise lost proxying the request.
        Parameters:
        key -
        value -
      • getPipelineInfo

        public PipelineInfo getPipelineInfo()
        Returns:
        the PipelineInfo that allows to know which pipeline (service, proxy or static resource) is handling the exchange
      • setPipelineInfo

        public void setPipelineInfo​(PipelineInfo pipelineInfo)
        Parameters:
        pipelineInfo - the pipelineInfo to set
      • isContentTypeJson

        public static boolean isContentTypeJson​(io.undertow.server.HttpServerExchange exchange)
        helper method to check if the request content is Json
        Parameters:
        exchange -
        Returns:
        true if Content-Type request header is application/json
      • isContentTypeFormOrMultipart

        public static boolean isContentTypeFormOrMultipart​(io.undertow.server.HttpServerExchange exchange)
      • isContentTypeFormOrMultipart

        public boolean isContentTypeFormOrMultipart()
      • isDelete

        public boolean isDelete()
        helper method to check request method
        Returns:
        true if method is METHOD.DELETE
      • isGet

        public boolean isGet()
        helper method to check request method
        Returns:
        true if method is METHOD.GET
      • isOptions

        public boolean isOptions()
        helper method to check request method
        Returns:
        true if method is METHOD.OPTIONS
      • isPatch

        public boolean isPatch()
        helper method to check request method
        Returns:
        true if method is METHOD.PATCH
      • isPost

        public boolean isPost()
        helper method to check request method
        Returns:
        true if method is METHOD.POST
      • isPut

        public boolean isPut()
        helper method to check request method
        Returns:
        true if method is METHOD.PUT