Class VRequest

  • All Implemented Interfaces:
    Request

    public class VRequest
    extends java.lang.Object
    implements Request
    An implementation of HTTP request.
    Author:
    Maksim Tkachenko, Truong Quoc Tuan, Ween Jiann Lee
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected VRequest​(VRequest.Builder<?> builder)
      Constructs an instance of venom request.
        VRequest​(java.lang.String url)
      Constructs an instance of venom request.
        VRequest​(java.lang.String url, java.util.Map<java.lang.String,​java.lang.String> headers)
      Constructs an instance of venom request.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static VRequest.Builder build​(Request.Method method, java.lang.String url)
      Create a new instance of builder with a method and url.
      java.lang.String getBody()
      Returns the request body of the request or null if none specified.
      java.util.Map<java.lang.String,​java.lang.String> getHeaders()
      Returns the headers set for the request.
      Request.Method getMethod()
      Returns the method type of the request.
      org.apache.http.HttpHost getProxy()
      Returns the proxy set to be used for the request or default to fetcher if none specified.
      SleepScheduler getSleepScheduler()
      Returns information about the amount of sleep before this request is made.
      java.lang.String getUrl()
      Returns the url of the request.
      • Methods inherited from class java.lang.Object

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

      • VRequest

        public VRequest​(java.lang.String url)
        Constructs an instance of venom request.
        Parameters:
        url - The url for this request.
      • VRequest

        public VRequest​(java.lang.String url,
                        java.util.Map<java.lang.String,​java.lang.String> headers)
        Constructs an instance of venom request.
        Parameters:
        url - The url for this request
        headers - The headers to append for this request
      • VRequest

        protected VRequest​(VRequest.Builder<?> builder)
        Constructs an instance of venom request.
        Parameters:
        builder - An instance of builder
    • Method Detail

      • build

        public static VRequest.Builder build​(Request.Method method,
                                             java.lang.String url)
        Create a new instance of builder with a method and url.
        Parameters:
        method - Request method
        url - Request url
        Returns:
        A new instance of builder
      • getMethod

        public final Request.Method getMethod()
        Description copied from interface: Request
        Returns the method type of the request.
        Specified by:
        getMethod in interface Request
        Returns:
        method type
      • getBody

        public final java.lang.String getBody()
        Description copied from interface: Request
        Returns the request body of the request or null if none specified.
        Specified by:
        getBody in interface Request
        Returns:
        request body
      • getUrl

        public final java.lang.String getUrl()
        Description copied from interface: Request
        Returns the url of the request.
        Specified by:
        getUrl in interface Request
        Returns:
        url
      • getHeaders

        public final java.util.Map<java.lang.String,​java.lang.String> getHeaders()
        Description copied from interface: Request
        Returns the headers set for the request.
        Specified by:
        getHeaders in interface Request
        Returns:
        a map of the headers set
      • getProxy

        public final org.apache.http.HttpHost getProxy()
        Description copied from interface: Request
        Returns the proxy set to be used for the request or default to fetcher if none specified.
        Specified by:
        getProxy in interface Request
        Returns:
        proxy
      • getSleepScheduler

        public final SleepScheduler getSleepScheduler()
        Description copied from interface: Request
        Returns information about the amount of sleep before this request is made.
        Specified by:
        getSleepScheduler in interface Request
        Returns:
        an instance of SleepScheduler