Class AdaptiveHttpRequest

java.lang.Object
ee.jakarta.tck.ws.rs.common.webclient.http.HttpRequest
ee.jakarta.tck.ws.rs.jaxrs21.ee.patch.server.AdaptiveHttpRequest

public class AdaptiveHttpRequest extends HttpRequest
Represents an HTTP client Request
  • Constructor Details

    • AdaptiveHttpRequest

      public AdaptiveHttpRequest(String requestLine, String host, int port)
      Creates new HttpRequest based of the passed request line. The request line provied must be in the form of:
           METHOD PATH HTTP-VERSION
           Ex.  GET /index.html HTTP/1.0
       
  • Method Details

    • getRequestPath

      public String getRequestPath()
      getRequestPath returns the request path for this particular request.
      Overrides:
      getRequestPath in class HttpRequest
      Returns:
      String request path
    • getRequestMethod

      public String getRequestMethod()
      getRequestMethod returns the request type, i.e., GET, POST, etc.
      Overrides:
      getRequestMethod in class HttpRequest
      Returns:
      String request type
    • isSecureRequest

      public boolean isSecureRequest()
      isSecureConnection() indicates if the Request is secure or not.
      Overrides:
      isSecureRequest in class HttpRequest
      Returns:
      boolean whether Request is using SSL or not.
    • setSecureRequest

      public void setSecureRequest(boolean secure)
      setSecureRequest configures this request to use SSL.
      Overrides:
      setSecureRequest in class HttpRequest
      Parameters:
      secure - - whether the Request uses SSL or not.
    • setContent

      public void setContent(String content)
      setContent will set the body for this request. Note, this is only valid for POST and PUT operations, however, if called and the request represents some other HTTP method, it will be no-op'd.
      Overrides:
      setContent in class HttpRequest
      Parameters:
      content - request content
    • setAuthenticationCredentials

      public void setAuthenticationCredentials(String username, String password, int authType, String realm)
      setAuthenticationCredentials configures the request to perform authentication.

      username and password cannot be null.

      It is legal for realm to be null.

      Overrides:
      setAuthenticationCredentials in class HttpRequest
      Parameters:
      username - the user
      password - the user's password
      authType - authentication type
      realm - authentication realm
    • addRequestHeader

      public void addRequestHeader(String headerName, String headerValue)
      addRequestHeader adds a request header to this request. If a request header of the same name already exists, the new value, will be added to the set of already existing values. NOTE: that header names are not case-sensitive.
      Overrides:
      addRequestHeader in class HttpRequest
      Parameters:
      headerName - request header name
      headerValue - request header value
    • addRequestHeader

      public void addRequestHeader(String header)
      Overrides:
      addRequestHeader in class HttpRequest
    • setRequestHeader

      public void setRequestHeader(String headerName, String headerValue)
      setRequestHeader sets a request header for this request overwritting any previously existing header/values with the same name. NOTE: Header names are not case-sensitive.
      Overrides:
      setRequestHeader in class HttpRequest
      Parameters:
      headerName - request header name
      headerValue - request header value
    • setFollowRedirects

      public void setFollowRedirects(boolean followRedirects)
      setFollowRedirects indicates whether HTTP redirects are followed. By default, redirects are not followed.
      Overrides:
      setFollowRedirects in class HttpRequest
    • getFollowRedirects

      public boolean getFollowRedirects()
      getFollowRedirects indicates whether HTTP redirects are followed.
      Overrides:
      getFollowRedirects in class HttpRequest
    • setState

      public void setState(org.apache.commons.httpclient.HttpState state)
      setState will set the HTTP state for the current request (i.e. session tracking). This has the side affect
      Overrides:
      setState in class HttpRequest
    • execute

      public HttpResponse execute() throws IOException, org.apache.commons.httpclient.HttpException
      execute will dispatch the current request to the target server.
      Overrides:
      execute in class HttpRequest
      Returns:
      HttpResponse the server's response.
      Throws:
      IOException - if an I/O error occurs during dispatch.
      org.apache.commons.httpclient.HttpException
    • getState

      public org.apache.commons.httpclient.HttpState getState()
      Returns the current state for this request.
      Overrides:
      getState in class HttpRequest
      Returns:
      HttpState current state
    • toString

      public String toString()
      Overrides:
      toString in class HttpRequest