Class DeviceIdentificatorService


  • public class DeviceIdentificatorService
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String extractClientSideCookieValue​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Returns the DA cookie value from the headers list
      java.util.Map getDeviceData​(java.lang.String userAgent)
      Deprecated. 
      java.util.Map getDeviceData​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Deprecated. 
      java.util.Map getDeviceData​(javax.servlet.http.HttpServletRequest request)
      Deprecated. 
      java.util.Map getDeviceDataByHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Deprecated. 
      java.util.Map getDeviceDataByUserAgent​(java.lang.String userAgent)
      Deprecated. 
      java.lang.String getLicenceKey()
      Gets the licence key in the identificator's level
      Result getResult​(java.lang.String userAgent)
      Get device data from DeviceAtlas Cloud service.
      Result getResult​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Get device data from DeviceAtlas Cloud service.
      Result getResult​(javax.servlet.http.HttpServletRequest request)
      Get device data from DeviceAtlas Cloud service.
      Result getResultByHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Get device data from DeviceAtlas Cloud service.
      Result getResultByUserAgent​(java.lang.String userAgent)
      Get device data from DeviceAtlas Cloud service.
      boolean getSendExtraHeaders()
      Deprecated.
      boolean getUseClientCookie()
      Getter for the useClientCookie setting.
      java.util.Map<java.lang.String,​java.lang.Object> prepareDataHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Treats the various headers, creates the user agent and cookie
      java.util.Map<java.lang.String,​java.lang.String> prepareHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers, java.lang.String daClientSideCookie)
      Extract headers to be send to the cloud service from a header Map object.
      java.util.Map<java.lang.String,​java.lang.String> prepareHeadersForServletRequest​(javax.servlet.http.HttpServletRequest request)
      Treats the headers from a servlet request
      void setCacheData​(java.lang.Object results, java.lang.String userAgent, java.lang.String daClientSideCookie, java.util.Map<java.lang.String,​java.lang.String> headers)
      Sets the cloud service data to the cache's layer
      void setLicenceKey​(java.lang.String licenceKey)
      Sets the licence key in the identificator's level
      void setSendExtraHeaders​(boolean sendExtraHeaders)
      Deprecated.
      void setUseClientCookie​(boolean useClientCookie)
      Setter for the useClientCookie setting.
      • Methods inherited from class java.lang.Object

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

      • DeviceIdentificatorService

        public DeviceIdentificatorService​(EndPointService endPointService)
    • Method Detail

      • getLicenceKey

        public java.lang.String getLicenceKey()
        Gets the licence key in the identificator's level
        Returns:
        String
      • setLicenceKey

        public void setLicenceKey​(java.lang.String licenceKey)
        Sets the licence key in the identificator's level
        Parameters:
        licenceKey -
      • getUseClientCookie

        public boolean getUseClientCookie()
        Getter for the useClientCookie setting. Defaults to true. If TRUE then if device data which is created by the DeviceAtlas client side component (JS library) exists it will be used
        Returns:
        The sendExtraHeaders setting. Defaults to false
      • setUseClientCookie

        public void setUseClientCookie​(boolean useClientCookie)
        Setter for the useClientCookie setting. Defaults to true. If TRUE then if device data which is created by the DeviceAtlas client side component (JS library) exists it will be used
        Parameters:
        useClientCookie - true = use device data which is created by the DeviceAtlas client side component if exists
      • getSendExtraHeaders

        @Deprecated
        public boolean getSendExtraHeaders()
        Deprecated.
        Getter for the sendExtraHeaders setting. Defaults to false. If this TRUE then extra client headers are sent with each request to the service. If this is FALSE then only select headers essential for detection are sent.
        Returns:
        The sendExtraHeaders setting. Defaults to false.
      • setSendExtraHeaders

        @Deprecated
        public void setSendExtraHeaders​(boolean sendExtraHeaders)
        Deprecated.
        Setter for the sendExtraHeaders setting. Defaults to false. If this TRUE then extra client headers are sent with each request to the service. If this is FALSE then only select headers essential for detection are sent.
        Parameters:
        sendExtraHeaders - TRUE if to send extra headers, FALSE to just send essential headers.
      • getDeviceData

        @Deprecated
        public java.util.Map getDeviceData​(javax.servlet.http.HttpServletRequest request)
                                    throws ClientException
        Deprecated.
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. If device data provided by "DeviceAtlas Client Side Component" exists in a cookie then cloud data will be merged with the cookie data.
        Parameters:
        request - The HttpServletRequest request object
        Returns:
        A Map of device data as { Client.KEY_USERAGENT: "UA", Client.KEY_SOURCE: "data source", Client.KEY_PROPERTIES: {"propertyName": "PropertyVal",}, } Note that Client.KEY_PROPERTIES will not exists for not detectable data and on failures.
        Throws:
        ClientException - When any part of detection or the API fails.
      • getDeviceData

        @Deprecated
        public java.util.Map getDeviceData​(java.lang.String userAgent)
                                    throws ClientException
        Deprecated.
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. NOTE: it is recommended to use getDeviceDataByUserAgent() to get device data when passing a user-agent string. Because "getDeviceData(String)" is an overload for "getDeviceData(HttpServletRequest)" so the JavaEE lib would be required when compiling your project. But If you use "getDeviceDataByUserAgent(String)" instead, the JavaEE will not be required.
        Parameters:
        userAgent - User-agent string
        Returns:
        A Map of device data as { Client.KEY_USERAGENT: "UA", Client.KEY_SOURCE: "data source", Client.KEY_PROPERTIES: {"propertyName": "PropertyVal",}, } Note that Client.KEY_PROPERTIES will not exists for not detectable data and on failures.
        Throws:
        ClientException - When any part of detection or the API fails.
      • getDeviceData

        @Deprecated
        public java.util.Map getDeviceData​(java.util.Map<java.lang.String,​java.lang.String> headers)
                                    throws ClientException
        Deprecated.
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. NOTE: it is recommended to use getDeviceDataByHeaders() to get device data when passing a Map of headers. Because getDeviceData(Map<String, String>) is an overload for "getDeviceData(HttpServletRequest)" the JavaEE lib would be required when compiling your project. But if you use getDeviceDataByHeaders(Map<String, String>) instead, the JavaEE will not be required.
        Parameters:
        headers - A Map of http headers {"header-name": "header-value",}
        Returns:
        A Map of device data as { Client.KEY_USERAGENT: "UA", Client.KEY_SOURCE: "data source", Client.KEY_PROPERTIES: {"propertyName": "PropertyVal",}, } Note that Client.KEY_PROPERTIES will not exists for not detectable data and on failures.
        Throws:
        ClientException - When any part of detection or the API fails.
      • getDeviceDataByUserAgent

        @Deprecated
        public java.util.Map getDeviceDataByUserAgent​(java.lang.String userAgent)
                                               throws ClientException
        Deprecated.
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud.
        Parameters:
        userAgent - User-agent string
        Returns:
        A Map of device data as { Client.KEY_USERAGENT: "UA", Client.KEY_SOURCE: "data source", Client.KEY_PROPERTIES: {"propertyName": "PropertyVal",}, } Note that Client.KEY_PROPERTIES will not exists for not detectable data and on failures.
        Throws:
        ClientException - When any part of detection or the API fails.
      • getDeviceDataByHeaders

        @Deprecated
        public java.util.Map getDeviceDataByHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
                                             throws ClientException
        Deprecated.
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud.
        Parameters:
        headers - A Map of http headers {"header-name": "header-value",}
        Returns:
        A Map of device data as { Client.KEY_USERAGENT: "UA", Client.KEY_SOURCE: "data source", Client.KEY_PROPERTIES: {"propertyName": "PropertyVal",}, } Note that Client.KEY_PROPERTIES will not exists for not detectable data and on failures.
        Throws:
        ClientException - When any part of detection or the API fails.
      • getResult

        public Result getResult​(javax.servlet.http.HttpServletRequest request)
                         throws ClientException
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. If device data provided by "DeviceAtlas Client Side Component" exists in a cookie then cloud data will be merged with the cookie data.
        Parameters:
        request - The HttpServletRequest request object
        Returns:
        Result
        Throws:
        ClientException - When any part of detection or the API fails.
      • getResult

        public Result getResult​(java.lang.String userAgent)
                         throws ClientException
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. NOTE: it is recommended to use getDeviceDataByUserAgent() to get device data when passing a user-agent string. Because "getDeviceData(String)" is an overload for "getDeviceData(HttpServletRequest)" so the JavaEE lib would be required when compiling your project. But If you use "getDeviceDataByUserAgent(String)" instead, the JavaEE will not be required.
        Parameters:
        userAgent - User-agent string
        Returns:
        Result
        Throws:
        ClientException - When any part of detection or the API fails.
      • getResult

        public Result getResult​(java.util.Map<java.lang.String,​java.lang.String> headers)
                         throws ClientException
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. NOTE: it is recommended to use getDeviceDataByHeaders() to get device data when passing a Map of headers. Because getDeviceData(Map<String, String>) is an overload for "getDeviceData(HttpServletRequest)" the JavaEE lib would be required when compiling your project. But if you use getDeviceDataByHeaders(Map<String, String>) instead, the JavaEE will not be required.
        Parameters:
        headers - A Map of http headers {"header-name": "header-value",}
        Returns:
        Result
        Throws:
        ClientException - When any part of detection or the API fails.
      • getResultByUserAgent

        public Result getResultByUserAgent​(java.lang.String userAgent)
                                    throws ClientException
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud.
        Parameters:
        userAgent - User-agent string
        Returns:
        Result
        Throws:
        ClientException - When any part of detection or the API fails.
      • getResultByHeaders

        public Result getResultByHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
                                  throws ClientException
        Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud.
        Parameters:
        headers - A Map of http headers {"header-name": "header-value",}
        Returns:
        A Map of device data as { Client.KEY_USERAGENT: "UA", Client.KEY_SOURCE: "data source", Client.KEY_PROPERTIES: {"propertyName": "PropertyVal",}, } Note that Client.KEY_PROPERTIES will not exists for not detectable data and on failures.
        Throws:
        ClientException - When any part of detection or the API fails.
      • prepareHeadersForServletRequest

        public java.util.Map<java.lang.String,​java.lang.String> prepareHeadersForServletRequest​(javax.servlet.http.HttpServletRequest request)
        Treats the headers from a servlet request
        Parameters:
        request -
        Returns:
        Map
      • prepareDataHeaders

        public java.util.Map<java.lang.String,​java.lang.Object> prepareDataHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
        Treats the various headers, creates the user agent and cookie
        Parameters:
        headers -
        Returns:
        Map
      • extractClientSideCookieValue

        public java.lang.String extractClientSideCookieValue​(java.util.Map<java.lang.String,​java.lang.String> headers)
        Returns the DA cookie value from the headers list
        Parameters:
        headers -
        Returns:
        cookie
      • setCacheData

        public void setCacheData​(java.lang.Object results,
                                 java.lang.String userAgent,
                                 java.lang.String daClientSideCookie,
                                 java.util.Map<java.lang.String,​java.lang.String> headers)
                          throws ClientException
        Sets the cloud service data to the cache's layer
        Parameters:
        results -
        userAgent -
        daClientSideCookie -
        headers -
        Throws:
        ClientException
      • prepareHeaders

        public java.util.Map<java.lang.String,​java.lang.String> prepareHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers,
                                                                                     java.lang.String daClientSideCookie)
        Extract headers to be send to the cloud service from a header Map object.
        Parameters:
        headers - headers
        daClientSideCookie -
        Returns:
        Map