Interface Response


  • public interface Response
    • Method Detail

      • getContentLength

        Long getContentLength()
        Returns:
        - the content length which might have been set by a handler, or null if none has been set
      • setExpiresHeader

        void setExpiresHeader​(Date expiresAt)
      • setLockTokenHeader

        void setLockTokenHeader​(String tokenId)
      • setAuthenticateHeader

        void setAuthenticateHeader​(List<String> challenges)
        Must set multiple Authenticate headers, one for each challenge This will usually be one each for basic, digest, ntlm, etc Note that order might be significant to some clients, so should be preserved. ie list item zero should be first.
        Parameters:
        challenges - - a list of http authentication challenges
      • setEtag

        void setEtag​(String uniqueId)
      • setContentRangeHeader

        void setContentRangeHeader​(long start,
                                   long finish,
                                   Long totalLength)
      • setContentLengthHeader

        void setContentLengthHeader​(Long totalLength)
      • setContentTypeHeader

        void setContentTypeHeader​(String string)
      • getContentTypeHeader

        String getContentTypeHeader()
      • setCacheControlMaxAgeHeader

        void setCacheControlMaxAgeHeader​(Long deltaSeconds)
        Set the cache control header to allow the resource to be cached for the given number of seconds
        Parameters:
        deltaSeconds - - must not be null
      • setCacheControlPrivateMaxAgeHeader

        void setCacheControlPrivateMaxAgeHeader​(Long deltaSeconds)
      • setCacheControlNoCacheHeader

        void setCacheControlNoCacheHeader()
        Set the cache control header to indicate that the resource should not be cached
      • setLastModifiedHeader

        void setLastModifiedHeader​(Date date)
      • setDavHeader

        void setDavHeader​(String string)
      • setNonStandardHeader

        void setNonStandardHeader​(String code,
                                  String value)
      • getNonStandardHeader

        String getNonStandardHeader​(String code)
      • setAllowHeader

        void setAllowHeader​(List<String> methodsAllowed)
      • setLocationHeader

        void setLocationHeader​(String redirectUrl)
      • setVaryHeader

        void setVaryHeader​(String string)
        Sets the Vary response header, necessary for response compression
        Parameters:
        string -
      • setDateHeader

        void setDateHeader​(Date date)
      • getAccessControlAllowOrigin

        String getAccessControlAllowOrigin()
        Used for CORS responses
        Returns:
      • setAccessControlAllowOrigin

        void setAccessControlAllowOrigin​(String s)
      • getAcceptRanges

        String getAcceptRanges()
      • setAcceptRanges

        void setAcceptRanges​(String s)
      • close

        void close()
        Called to indicate that the request is completed. Some response implementations might choose to close the http connection, while others which implement pipelining might not
      • sendError

        void sendError​(Response.Status status,
                       String message)
        Called by milton when an error occurs. The underlying HTTP provider should choose to close the HTTP connection, because the amount of data already sent might not be consistent with the content length header which may have already been sent
        Parameters:
        status -
        message -
      • sendRedirect

        void sendRedirect​(String url)
        Will set the status to moved_temporaruly and set the location header to the given url
        Parameters:
        url -
      • setCookie

        Cookie setCookie​(Cookie cookie)
        The setCookie method is used to set a cookie value with the cookie name. This will add a cookie to the response stored under the name of the cookie, when this is committed it will be added as a Set-Cookie header to the resulting response.
        Parameters:
        cookie - this is the cookie to be added to the response
        Returns:
        returns the cookie that has been set in the response
      • setCookie

        Cookie setCookie​(String name,
                         String value)
        The setCookie method is used to set a cookie value with the cookie name. This will add a cookie to the response stored under the name of the cookie, when this is committed it will be added as a Set-Cookie header to the resulting response. This is a convenience method that avoids cookie creation.
        Parameters:
        name - this is the cookie to be added to the response
        value - this is the cookie value that is to be used
        Returns:
        returns the cookie that has been set in the response