com.h3c.util.rs

## Class AgentAwareResource

- java.lang.Object
- - com.h3c.util.rs.BaseResource
  - - com.h3c.util.rs.AgentAwareResource

-     public abstract class AgentAwareResource
      extends BaseResource

  Base REST resource implementation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected javax.servlet.http.HttpServletRequest` | `hreq`

    - ### Fields inherited from class com.h3c.util.rs.BaseResource

      `DATE_FORMAT, DATETIME_FORMAT, DEFAULT_USER, log, NAME, NO_CACHE, REF, security, UID, uriInfo`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AgentAwareResource(org.slf4j.Logger log)` Create a resource capable of logging to the specified logger.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `isDataResourceRequested()` Attempts to deduce whether data resource is being requested.
    `protected boolean` | `isFull()` Determines whether the request comes from a supported full browser.
    `protected boolean` | `isMobile()` Determines whether the request comes from a supported mobile browser.
    `protected boolean` | `isMobileResourceRequested()` Attempts to deduce whether mobile URL is being requested.

    - ### Methods inherited from class com.h3c.util.rs.BaseResource

      `accepted, accepted, created, created, date, datetime, deleted, format, format, getData, getUserName, id, integer, notFound, ok, ok, redirect, ref, safeCamelCase, safeToString, serverError, serviceUnavailableError, setDefaultUserName, sid, tag, tag, tag, uid, uid, url, validate, validate, validate, warn, warn`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### hreq

          @Context
          protected javax.servlet.http.HttpServletRequest hreq

  - ### Constructor Detail

    - #### AgentAwareResource

          protected AgentAwareResource(org.slf4j.Logger log)

      Create a resource capable of logging to the specified logger.
      Parameters:
        `log` - logger

  - ### Method Detail

    - #### isMobileResourceRequested

          protected boolean isMobileResourceRequested()

      Attempts to deduce whether mobile URL is being requested. This is based on the application following the convention where the mobile resources are mapped to URL containing `/m/` in the path.
      Returns:
        true if mobile URL was being requested

    - #### isDataResourceRequested

          protected boolean isDataResourceRequested()

      Attempts to deduce whether data resource is being requested. This is based on the application following the convention where the data resources are mapped to URL containing `/rs/` in the path.
      Returns:
        true if data resource was being requested

    - #### isMobile

          protected boolean isMobile()

      Determines whether the request comes from a supported mobile browser.
      Returns:
        true of client is identified as a supported mobile browser

    - #### isFull

          protected boolean isFull()

      Determines whether the request comes from a supported full browser.
      Returns:
        true of client is identified as a supported full browser

Copyright © 2014. All Rights Reserved.