org.enhydra.barracuda.core.view
Class ViewCapabilities

java.lang.Object
  |
  +--org.enhydra.barracuda.core.view.ViewCapabilities

public class ViewCapabilities
extends java.lang.Object

This class defines the the cpabilities & preferences of the client view. Specifically, it provides the component with 4 useful pieces of information:

  1. FormatType - what format is the output expected to be in (HTML, WML, XMLC, etc.)
  2. ScriptingType - what scripting capabilities does the client support (JavaScript, VBScript, WMLScript, etc)
  3. ClientType - what browser is the client using (HTML_3x, HTML_4x, WML_1_2, etc)
  4. ClientLocale - what Locale does the client prefer content in?

Note that it's up to the components to actually respond to this. Just because a client supports HTML 4.0 doesn't mean the component can't render in HTML 3.2 (although the component does have an implicit responsibility to be well behaved and send back meaningful content that will work in the clients configuration)

It should also be noted that the FormatType, ScriptingType, and ClientType classes are all defined hierarchically. This is particularly important because it allows components to support a given range of functionality...if a component supports HTML 4x and HTML 4.1 comes out, the component should still work just fine.

Note that we don't determine the various types from the source until they are actually requested (unless of course they are manually specified).


Field Summary
protected  java.util.Locale clientLocale
           
protected  ClientType clientType
           
protected  FormatType formatType
           
protected  javax.servlet.http.HttpServletRequest req
           
protected  javax.servlet.http.HttpServletResponse resp
           
protected  ScriptingType scriptingType
           
 
Constructor Summary
ViewCapabilities()
          Create an empty ViewCapabilities object.
ViewCapabilities(FormatType formatType, ClientType clientType, ScriptingType scriptingType, java.util.Locale clientLocale)
          This constructor allows you to manually specify the various types for a ViewCapabilities object.
ViewCapabilities(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          This constructor creates a ViewCapabilities object from the servlet response and request objects.
 
Method Summary
 java.util.Locale getClientLocale()
          Get the current target locale
 ClientType getClientType()
          Get the current client type
 FormatType getFormatType()
          Get the current format type
 ScriptingType getScriptingType()
          Get the current scripting type
 void setClientLocale(java.util.Locale iclientLocale)
          Manually specify a target locale
 void setClientType(ClientType iclientType)
          Manually specify a client type
 void setFormatType(FormatType iformatType)
          Manually specify a format type
 void setScriptingType(ScriptingType iscriptingType)
          Manually specify a scripting type
 void setSource(javax.servlet.http.HttpServletRequest ireq, javax.servlet.http.HttpServletResponse iresp)
          This convenience method allows you to specify the servlet req/resp source objects (from which the types will be automagically determined)
 java.lang.String toString()
          get a string representation of the ViewCapabilities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

req

protected javax.servlet.http.HttpServletRequest req

resp

protected javax.servlet.http.HttpServletResponse resp

formatType

protected FormatType formatType

scriptingType

protected ScriptingType scriptingType

clientType

protected ClientType clientType

clientLocale

protected java.util.Locale clientLocale
Constructor Detail

ViewCapabilities

public ViewCapabilities()
Create an empty ViewCapabilities object. In order to use this class, you will either need to manually set the req/resp source, or manually specify the various type properties.


ViewCapabilities

public ViewCapabilities(javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse resp)
This constructor creates a ViewCapabilities object from the servlet response and request objects.

Parameters:
req - the servlet request
resp - the servlet response

ViewCapabilities

public ViewCapabilities(FormatType formatType,
                        ClientType clientType,
                        ScriptingType scriptingType,
                        java.util.Locale clientLocale)
This constructor allows you to manually specify the various types for a ViewCapabilities object.

Parameters:
formatType - the format type for the view
clientType - the actual client view type
scriptingType - the scripting type supported by the view
clientLocale - the target client locale
Method Detail

setSource

public void setSource(javax.servlet.http.HttpServletRequest ireq,
                      javax.servlet.http.HttpServletResponse iresp)
This convenience method allows you to specify the servlet req/resp source objects (from which the types will be automagically determined)


setFormatType

public void setFormatType(FormatType iformatType)
Manually specify a format type


getFormatType

public FormatType getFormatType()
Get the current format type

Returns:
the current format type

setClientType

public void setClientType(ClientType iclientType)
Manually specify a client type


getClientType

public ClientType getClientType()
Get the current client type

Returns:
the current client type

setScriptingType

public void setScriptingType(ScriptingType iscriptingType)
Manually specify a scripting type


getScriptingType

public ScriptingType getScriptingType()
Get the current scripting type

Returns:
the current scripting type

setClientLocale

public void setClientLocale(java.util.Locale iclientLocale)
Manually specify a target locale


getClientLocale

public java.util.Locale getClientLocale()
Get the current target locale

Returns:
the current target locale

toString

public java.lang.String toString()
get a string representation of the ViewCapabilities

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the ViewCapabilities


Copyright © 2001 Enhydra.org