rewrite-config-servlet 2.0.0.Beta3

org.ocpsoft.rewrite.servlet.config
Class UserAgent

java.lang.Object
  extended by org.ocpsoft.rewrite.config.DefaultConditionBuilder
      extended by org.ocpsoft.rewrite.servlet.config.HttpCondition
          extended by org.ocpsoft.rewrite.servlet.config.UserAgent
All Implemented Interfaces:
Condition, ConditionBuilder

public abstract class UserAgent
extends HttpCondition

A Condition that inspects the value of HttpServletRequest.getHeader(String) "User-Agent"

Author:
Lincoln Baxter, III

Constructor Summary
UserAgent()
           
 
Method Summary
static org.ocpsoft.rewrite.servlet.config.UserAgent.ClassificationUserAgent isDesktop()
          Create a Condition asserting that the user-agent is a non-mobile device.
static org.ocpsoft.rewrite.servlet.config.UserAgent.ClassificationUserAgent isMobile()
          Create a Condition asserting that the user-agent is a mobile device.
static org.ocpsoft.rewrite.servlet.config.UserAgent.ClassificationUserAgent isTablet()
          Create a Condition asserting that the user-agent is a tablet device.
static UserAgent matches(String pattern)
          Create a Condition asserting that the user-agent matches the given pattern.
 
Methods inherited from class org.ocpsoft.rewrite.servlet.config.HttpCondition
evaluate, evaluateHttp
 
Methods inherited from class org.ocpsoft.rewrite.config.DefaultConditionBuilder
and, andNot, or, orNot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserAgent

public UserAgent()
Method Detail

matches

public static UserAgent matches(String pattern)
Create a Condition asserting that the user-agent matches the given pattern.

User agent expressions may be parameterized:

UserAgent.matches("BlackBerry PlayBook 3.4")
UserAgent.matches("BlackBerry PlayBook {version}")
UserAgent.matches("{agent}")
...

Parameters:
name - ParameterizedPattern matching the request parameter name.
See Also:
{@link HttpServletRequest#getParameterMap()}

isMobile

public static org.ocpsoft.rewrite.servlet.config.UserAgent.ClassificationUserAgent isMobile()
Create a Condition asserting that the user-agent is a mobile device.


isTablet

public static org.ocpsoft.rewrite.servlet.config.UserAgent.ClassificationUserAgent isTablet()
Create a Condition asserting that the user-agent is a tablet device.


isDesktop

public static org.ocpsoft.rewrite.servlet.config.UserAgent.ClassificationUserAgent isDesktop()
Create a Condition asserting that the user-agent is a non-mobile device.


rewrite-config-servlet 2.0.0.Beta3

Copyright © 2013 OCPsoft. All Rights Reserved.