Class HttpUserAgent


  • public class HttpUserAgent
    extends java.lang.Object
    Holder of value of default User-Agent for an agent or a server.
    Since:
    2018.1.2
    Author:
    Mikhail Khorkov
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends org.apache.commons.httpclient.HttpMethod>
      T
      addHeader​(T method)
      Add default user agent in header User-Agent
      static java.lang.String getUserAgent()
      Gets default User-Agent value.
      static void setAgentFlag()
      Sets flag that the code are executed in an agent context but not in a server.
      static void setServerFlag()
      Sets flag that the code are executed in a server context but not in an agent.
      • Methods inherited from class java.lang.Object

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

      • getUserAgent

        @NotNull
        public static java.lang.String getUserAgent()
        Gets default User-Agent value.
      • setServerFlag

        public static void setServerFlag()
        Sets flag that the code are executed in a server context but not in an agent.
      • setAgentFlag

        public static void setAgentFlag()
        Sets flag that the code are executed in an agent context but not in a server.
      • addHeader

        @NotNull
        public static <T extends org.apache.commons.httpclient.HttpMethod> T addHeader​(@NotNull
                                                                                       T method)
        Add default user agent in header User-Agent
        Returns:
        the same HttpMethod with the new header.