org.apache.lucene.gdata.server
Class GDataRequest

java.lang.Object
  extended by org.apache.lucene.gdata.server.GDataRequest

public class GDataRequest
extends Object

The GDataRequest Class wraps the incoming HttpServletRequest. Needed information coming with the HttpServletRequest can be accessed directly. It represents an abstraction on the plain HttpServletRequest. Every GData specific data coming from the client will be available and can be accessed via the GDataRequest.

GDataRequest instances will be passed to any action requested by the client. This class also holds the logic to retrieve important information like response format, the requested feed instance and query parameters.

Author:
Simon Willnauer

Nested Class Summary
static class GDataRequest.GDataRequestType
          Indicates the request type
static class GDataRequest.OutputFormat
          This enum represents the OutputFormat of the GDATA Server
 
Constructor Summary
GDataRequest(javax.servlet.http.HttpServletRequest requst, GDataRequest.GDataRequestType type)
          Creates a new FeedRequest
 
Method Summary
 javax.servlet.http.Cookie getAuthCookie()
           
 String getAuthToken()
           
 ProvidedService getConfigurator()
           
 String getContextPath()
          Returns the requested path including the domain name and the requested resource http://www.apache.org/path/resource/
 javax.servlet.http.Cookie[] getCookies()
           
 String getEntryId()
           
 String getEntryVersion()
           
 String getFeedId()
           
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
           
 int getItemsPerPage()
           
 String getModifiedSince()
           
 String getNextId()
          The href id of the next page of the requested resource.
 String getPreviousId()
          The previous id is the feeds href pointing to the previous result of the requested resource
 Map<String,String[]> getQueryParameter()
          Returns the HttpServletRequest parameter map containing all GET request parameters.
 Enumeration<String> getQueryParameterNames()
          The HttpServletRequest request parameter names
 String getQueryString()
          This will return the current query string including all parameters.
 Reader getReader()
          A Reader instance to read form the client input stream
 String getRemoteAddress()
           
 GDataRequest.OutputFormat getRequestedResponseFormat()
          Either Atom or RSS
 String getSelfId()
          The self id is the feeds href pointing to the requested resource
 int getStartIndex()
          Start index represents the number of the first entry of the query - result.
protected  String getTranslatedQuery()
           
 GDataRequest.GDataRequestType getType()
          GDataRequest.GDataRequestType
 void initializeRequest()
          Initialize the GDataRequest.
 boolean isEntryRequested()
          * If the request is a GDataRequest.GDataRequestType.GET request and there is an entry id specified, the requested resource is an entry.
 boolean isFeedRequested()
          If the request is a GDataRequest.GDataRequestType.GET request and there is no entry id specified, the requested resource is a feed.
 boolean isSearchRequested()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GDataRequest

public GDataRequest(javax.servlet.http.HttpServletRequest requst,
                    GDataRequest.GDataRequestType type)
Creates a new FeedRequest

Parameters:
requst - - the incoming HttpServletReqeust
type - - the request type
Method Detail

initializeRequest

public void initializeRequest()
                       throws GDataRequestException
Initialize the GDataRequest. This will initialize all needed values / attributes in this request.

Throws:
GDataRequestException

getFeedId

public String getFeedId()
Returns:
- the id of the requested feed

getEntryId

public String getEntryId()
Returns:
- the entry id of the requested Entry if specified, otherwise null

getEntryVersion

public String getEntryVersion()
Returns:
the version Id of the requested Entry if specified, otherwise null

getReader

public Reader getReader()
                 throws IOException
A Reader instance to read form the client input stream

Returns:
- the HttpServletRequest Reader
Throws:
IOException - - if an I/O Exception occurs

getQueryParameter

public Map<String,String[]> getQueryParameter()
Returns the HttpServletRequest parameter map containing all GET request parameters.

Returns:
the parameter map

getQueryParameterNames

public Enumeration<String> getQueryParameterNames()
The HttpServletRequest request parameter names

Returns:
parameter names enumeration

getRequestedResponseFormat

public GDataRequest.OutputFormat getRequestedResponseFormat()
Either Atom or RSS

Returns:
- The output format requested by the client

getItemsPerPage

public int getItemsPerPage()
Returns:
- the number of returned items per page

getStartIndex

public int getStartIndex()
Start index represents the number of the first entry of the query - result. The order depends on the query. Is the query a search query the this value will be assigned to the score in a common feed query the value will be assigned to the update time of the entries.

Returns:
- the requested start index

getSelfId

public String getSelfId()
The self id is the feeds href pointing to the requested resource

Returns:
- the self id

getPreviousId

public String getPreviousId()
The previous id is the feeds href pointing to the previous result of the requested resource

Returns:
- the self id

getNextId

public String getNextId()
The href id of the next page of the requested resource.

Returns:
the id of the next page

getQueryString

public String getQueryString()
This will return the current query string including all parameters. Additionally the max-resul parameter will be added if not specified.

max-resul indicates the number of results returned to the client. The default value is 25.

Returns:
- the query string including all parameters

getContextPath

public String getContextPath()
Returns the requested path including the domain name and the requested resource http://www.apache.org/path/resource/

Returns:
the context path

getType

public GDataRequest.GDataRequestType getType()
GDataRequest.GDataRequestType

Returns:
the current request type

isFeedRequested

public boolean isFeedRequested()
If the request is a GDataRequest.GDataRequestType.GET request and there is no entry id specified, the requested resource is a feed.

Returns:
- true if an only if the requested resource is a feed

isEntryRequested

public boolean isEntryRequested()
* If the request is a GDataRequest.GDataRequestType.GET request and there is an entry id specified, the requested resource is an entry.

Returns:
- true if an only if the requested resource is an entry

isSearchRequested

public boolean isSearchRequested()
Returns:
- true if an only if the user request is a search request, otherwise false

getConfigurator

public ProvidedService getConfigurator()
Returns:
the configuration for this request

getRemoteAddress

public String getRemoteAddress()
Returns:
- Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.

getAuthToken

public String getAuthToken()
Returns:
- the value for the send auth token. The auth token will be send as a request Authentication header.

getCookies

public javax.servlet.http.Cookie[] getCookies()
Returns:
- Returns an array containing all of the Cookie objects the client sent with underlying HttpServletRequest.

getAuthCookie

public javax.servlet.http.Cookie getAuthCookie()
Returns:
- the cookie set instead of the authentication token or null if no auth cookie is set

getModifiedSince

public String getModifiedSince()
Returns:
- the date string of the If-Modified-Since HTTP request header, or null if header is not set

getHttpServletRequest

public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Returns:
- the underlying HttpServletRequest

getTranslatedQuery

protected String getTranslatedQuery()


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.