com.google.visualization.datasource
Class DataSourceRequest

java.lang.Object
  extended by com.google.visualization.datasource.DataSourceRequest

public class DataSourceRequest
extends java.lang.Object

This class contains all information concerning a data source request. The information in this class is used to create a data table and return a corresponding response to the user.

Author:
Yaniv S.

Field Summary
static java.lang.String DATASOURCE_REQUEST_PARAMETER
          The name of the request parameter that specifies the data source parameters.
static java.lang.String QUERY_REQUEST_PARAMETER
          The name of the request parameter that specifies the query to execute.
static java.lang.String SAME_ORIGIN_HEADER
          A request header name.
 
Constructor Summary
DataSourceRequest(javax.servlet.http.HttpServletRequest req)
          Builds a DataSource request from an HttpServletRequest.
DataSourceRequest(Query query, DataSourceParameters dsParams, com.ibm.icu.util.ULocale userLocale)
          Constructor.
 
Method Summary
static boolean determineSameOrigin(javax.servlet.http.HttpServletRequest req)
          Determines whether the given request is from the same origin (based on request headers set by the ).
 DataSourceParameters getDataSourceParameters()
          Returns the data source parameters.
static DataSourceRequest getDefaultDataSourceRequest(javax.servlet.http.HttpServletRequest req)
          Returns a default data source request.
 Query getQuery()
          Returns the query.
 com.ibm.icu.util.ULocale getUserLocale()
          Returns the user locale.
 boolean isSameOrigin()
          Returns true if the request is same-origin.
 void setUserLocale(com.ibm.icu.util.ULocale userLocale)
          Sets the user locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAME_ORIGIN_HEADER

public static final java.lang.String SAME_ORIGIN_HEADER
A request header name. Used to determine if the request was sent from the same domain as the server.

See Also:
Constant Field Values

QUERY_REQUEST_PARAMETER

public static final java.lang.String QUERY_REQUEST_PARAMETER
The name of the request parameter that specifies the query to execute.

See Also:
Constant Field Values

DATASOURCE_REQUEST_PARAMETER

public static final java.lang.String DATASOURCE_REQUEST_PARAMETER
The name of the request parameter that specifies the data source parameters.

See Also:
Constant Field Values
Constructor Detail

DataSourceRequest

public DataSourceRequest(Query query,
                         DataSourceParameters dsParams,
                         com.ibm.icu.util.ULocale userLocale)
Constructor. Useful for debugging and testing. Do not use it for production.

Parameters:
query - The query.
dsParams - The data source parameters.
userLocale - The user locale.

DataSourceRequest

public DataSourceRequest(javax.servlet.http.HttpServletRequest req)
                  throws DataSourceException
Builds a DataSource request from an HttpServletRequest.

Parameters:
req - The HttpServletRequest.
Throws:
DataSourceException - In case of an invalid 'tq' or 'tqx' parameter.
Method Detail

getDefaultDataSourceRequest

public static DataSourceRequest getDefaultDataSourceRequest(javax.servlet.http.HttpServletRequest req)
Returns a default data source request. Used in case no data source request is available (i.e., because of invalid input). Parses the input 'tq' and 'tqx' strings and, if it fails, uses default values.

Parameters:
req - The http servlet request.
Returns:
A default data source request.

determineSameOrigin

public static boolean determineSameOrigin(javax.servlet.http.HttpServletRequest req)
Determines whether the given request is from the same origin (based on request headers set by the ).

Parameters:
req - The http servlet request.
Returns:
True if this is a same origin request false otherwise.

getQuery

public Query getQuery()
Returns the query.

Returns:
The query.

getDataSourceParameters

public DataSourceParameters getDataSourceParameters()
Returns the data source parameters.

Returns:
The data source parameters.

setUserLocale

public void setUserLocale(com.ibm.icu.util.ULocale userLocale)
Sets the user locale.

Parameters:
userLocale - The user locale.

getUserLocale

public com.ibm.icu.util.ULocale getUserLocale()
Returns the user locale.

Returns:
The user locale.

isSameOrigin

public boolean isSameOrigin()
Returns true if the request is same-origin.

Returns:
True if the request is same-origin.


Copyright © 2009 Google. All Rights Reserved.