com.droplets.apix.servlet
Class DropletsHttpServletRequest

java.lang.Object
  |
  +--com.droplets.apix.servlet.DropletsHttpServletRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class DropletsHttpServletRequest
extends java.lang.Object
implements javax.servlet.http.HttpServletRequest

Implements HttpServletRequest for use in a Droplet calling a Servlet. Use it to call your Servlet's doGetService and doPostService. Be sure to use addParameter if the Servlet is expecting parameters. Many of the methods are marked as "Not implemented". This is because there is no Droplets alternative and probably depends on the specifics of the Servlet being used. It is expected that you subclass DropletsHttpServletRequest and provide an implementation that is appropriate for the Servlet you are trying to call. Most of the methods that are marked as "Not implemented" have a default implementation that may be appropriate, but are marked that way nonetheless to alert the developer to check to see if they need something else.

Copyright: Copyright (c) 2003

Company: Droplets


Constructor Summary
DropletsHttpServletRequest()
          Construct objects of DropletsHttpServletRequest to pass to your Servlet's doGetService() and doPostService()
 
Method Summary
 void addParameter(java.lang.String name, java.lang.String value)
          Use this method to set parameters that the Servlet can get with getParameter.
 java.lang.Object getAttribute(java.lang.String name)
          Gets an attribute previously set with setAttribute
 java.util.Enumeration getAttributeNames()
          Not implemented.
 java.lang.String getAuthType()
          Not implemented.
 java.lang.String getCharacterEncoding()
          Not implemented.
 int getContentLength()
          Not implemented.
 java.lang.String getContentType()
          Not implemented.
 java.lang.String getContextPath()
          Not implemented.
 javax.servlet.http.Cookie[] getCookies()
          Not implemented.
 long getDateHeader(java.lang.String name)
          Not implemented.
 java.lang.String getHeader(java.lang.String name)
          Not implemented.
 java.util.Enumeration getHeaderNames()
          Not implemented.
 java.util.Enumeration getHeaders(java.lang.String name)
          Not implemented.
 javax.servlet.ServletInputStream getInputStream()
          Not implemented.
 int getIntHeader(java.lang.String name)
          Not implemented.
 java.util.Locale getLocale()
          Not implemented.
 java.util.Enumeration getLocales()
          Not implemented.
 java.lang.String getMethod()
          Not implemented.
 java.lang.String getParameter(java.lang.String name)
          Gets parameters set with addParameter.
 java.util.Map getParameterMap()
          Returns the Map of parameters
 java.util.Enumeration getParameterNames()
          Returns an Enumeration of Strings with the names of all parameters
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns an array of the values of the parameter named 'name'
 java.lang.String getPathInfo()
          Not implemented.
 java.lang.String getPathTranslated()
          Not implemented.
 java.lang.String getProtocol()
          Not implemented.
 java.lang.String getQueryString()
          Not implemented.
 java.io.BufferedReader getReader()
          Not implemented.
 java.lang.String getRealPath(java.lang.String path)
          Not implemented.
 java.lang.String getRemoteAddr()
          Not implemented.
 java.lang.String getRemoteHost()
          Not implemented.
 java.lang.String getRemoteUser()
          Not implemented.
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
          Returns a DropletsRequestDispatcher which ignores requests.
 java.lang.String getRequestedSessionId()
          Not implemented.
 java.lang.String getRequestURI()
          Not implemented.
 java.lang.StringBuffer getRequestURL()
          Not implemented.
 java.lang.String getScheme()
          Not implemented.
 java.lang.String getServerName()
          Not implemented.
 int getServerPort()
          Not implemented.
 java.lang.String getServletPath()
          Not implemented.
 javax.servlet.http.HttpSession getSession()
          Returns an object of class DropletsHttpSession.
 javax.servlet.http.HttpSession getSession(boolean create)
          Returns an object of class DropletsHttpSession.
 java.security.Principal getUserPrincipal()
          Not implemented.
 boolean isRequestedSessionIdFromCookie()
          Not implemented.
 boolean isRequestedSessionIdFromUrl()
          Not implemented.
 boolean isRequestedSessionIdFromURL()
          Not implemented.
 boolean isRequestedSessionIdValid()
          Not implemented.
 boolean isSecure()
          Not implemented.
 boolean isUserInRole(java.lang.String role)
          Not implemented.
 void removeAttribute(java.lang.String name)
          Removes an attribute called 'name'.
 void removeParameter(java.lang.String name)
          Use this method to remove parameters previously set with add parameter
 void setAttribute(java.lang.String name, java.lang.Object o)
          Sets an attribute called 'name' to 'o'.
 void setCharacterEncoding(java.lang.String env)
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DropletsHttpServletRequest

public DropletsHttpServletRequest()
Construct objects of DropletsHttpServletRequest to pass to your Servlet's doGetService() and doPostService()
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Gets an attribute previously set with setAttribute
Specified by:
getAttribute in interface javax.servlet.ServletRequest
Parameters:
name - an attribute name
Returns:
the value of the attribute with the given name

getAttributeNames

public java.util.Enumeration getAttributeNames()
Not implemented. Always returns an empty Enumeration
Specified by:
getAttributeNames in interface javax.servlet.ServletRequest
Returns:
an empty Enumeration

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Not implemented. Always returns null. Subclasses may provide an implementation.
Specified by:
getCharacterEncoding in interface javax.servlet.ServletRequest
Returns:
null

setCharacterEncoding

public void setCharacterEncoding(java.lang.String env)
                          throws java.io.UnsupportedEncodingException
Not implemented. Always throws UnsupportedEncodingException. Subclasses may provide an implementation.
Parameters:
env - ignored. This method always throws UnsupportedEncodingException.

getContentLength

public int getContentLength()
Not implemented. This method always returns -1. Subclasses can provide an implementation
Specified by:
getContentLength in interface javax.servlet.ServletRequest
Returns:
-1

getContentType

public java.lang.String getContentType()
Not implemented. Always returns null. Subclasses may provide an implementation.
Specified by:
getContentType in interface javax.servlet.ServletRequest
Returns:
null

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Not implemented. Always throws IllegalStateException. Subclasses may provide an implementation.
Specified by:
getInputStream in interface javax.servlet.ServletRequest
Returns:
always throws IllegalStateException

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)
Use this method to set parameters that the Servlet can get with getParameter. This method should be used to fill in the FORM data that the Servlet is expecting
Parameters:
name - the name of the parameter
value - the value of the parameter

removeParameter

public void removeParameter(java.lang.String name)
Use this method to remove parameters previously set with add parameter
Parameters:
name - the name of the parameter

getParameter

public java.lang.String getParameter(java.lang.String name)
Gets parameters set with addParameter. Usually called by the Servlet
Specified by:
getParameter in interface javax.servlet.ServletRequest
Parameters:
the - name of a parameter
Returns:
the value of the parameter

getParameterNames

public java.util.Enumeration getParameterNames()
Returns an Enumeration of Strings with the names of all parameters
Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Returns:
the names of all of the parameters

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns an array of the values of the parameter named 'name'
Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Parameters:
name - the name of the parameter
Returns:
An array of the parameters named 'name'

getParameterMap

public java.util.Map getParameterMap()
Returns the Map of parameters

getProtocol

public java.lang.String getProtocol()
Not implemented. Always returns "HTTP/1.1"
Specified by:
getProtocol in interface javax.servlet.ServletRequest

getScheme

public java.lang.String getScheme()
Not implemented. Always returns "HTTP/1.1"
Specified by:
getScheme in interface javax.servlet.ServletRequest

getServerName

public java.lang.String getServerName()
Not implemented. Always returns localhost
Specified by:
getServerName in interface javax.servlet.ServletRequest

getServerPort

public int getServerPort()
Not implemented. Always returns 80
Specified by:
getServerPort in interface javax.servlet.ServletRequest

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Not implemented. Always throws IllegalStateException
Specified by:
getReader in interface javax.servlet.ServletRequest

getRemoteAddr

public java.lang.String getRemoteAddr()
Not implemented. Always returns "127.0.0.1"
Specified by:
getRemoteAddr in interface javax.servlet.ServletRequest

getRemoteHost

public java.lang.String getRemoteHost()
Not implemented. Always returns localhost
Specified by:
getRemoteHost in interface javax.servlet.ServletRequest

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object o)
Sets an attribute called 'name' to 'o'. Use getAttribute(name) to retrieve it
Specified by:
setAttribute in interface javax.servlet.ServletRequest
Parameters:
name - the name of the attribute
o - the value of the attribute

removeAttribute

public void removeAttribute(java.lang.String name)
Removes an attribute called 'name'.
Specified by:
removeAttribute in interface javax.servlet.ServletRequest
Parameters:
name - the name of the attribute

getLocale

public java.util.Locale getLocale()
Not implemented. Always returns Locale.getDefault()
Specified by:
getLocale in interface javax.servlet.ServletRequest

getLocales

public java.util.Enumeration getLocales()
Not implemented. Always returns an Enumeration containting just Locale.getDefault()
Specified by:
getLocales in interface javax.servlet.ServletRequest

isSecure

public boolean isSecure()
Not implemented. Always returns false.
Specified by:
isSecure in interface javax.servlet.ServletRequest

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
Returns a DropletsRequestDispatcher which ignores requests.
Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest

getRealPath

public java.lang.String getRealPath(java.lang.String path)
Not implemented. Always returns path
Specified by:
getRealPath in interface javax.servlet.ServletRequest

getAuthType

public java.lang.String getAuthType()
Not implemented. Always returns "BASIC"
Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest

getCookies

public javax.servlet.http.Cookie[] getCookies()
Not implemented. Always returns null
Specified by:
getCookies in interface javax.servlet.http.HttpServletRequest

getDateHeader

public long getDateHeader(java.lang.String name)
Not implemented. Always returns -1
Specified by:
getDateHeader in interface javax.servlet.http.HttpServletRequest

getHeader

public java.lang.String getHeader(java.lang.String name)
Not implemented. Always returns null
Specified by:
getHeader in interface javax.servlet.http.HttpServletRequest

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Not implemented. Always returns an empty enumeration
Specified by:
getHeaders in interface javax.servlet.http.HttpServletRequest

getHeaderNames

public java.util.Enumeration getHeaderNames()
Not implemented. Always returns an empty enumeration
Specified by:
getHeaderNames in interface javax.servlet.http.HttpServletRequest

getIntHeader

public int getIntHeader(java.lang.String name)
Not implemented. Always returns -1
Specified by:
getIntHeader in interface javax.servlet.http.HttpServletRequest

getMethod

public java.lang.String getMethod()
Not implemented. Always returns "POST"
Specified by:
getMethod in interface javax.servlet.http.HttpServletRequest

getPathInfo

public java.lang.String getPathInfo()
Not implemented. Always returns null
Specified by:
getPathInfo in interface javax.servlet.http.HttpServletRequest

getPathTranslated

public java.lang.String getPathTranslated()
Not implemented. Always returns null
Specified by:
getPathTranslated in interface javax.servlet.http.HttpServletRequest

getContextPath

public java.lang.String getContextPath()
Not implemented. Always returns ""
Specified by:
getContextPath in interface javax.servlet.http.HttpServletRequest

getQueryString

public java.lang.String getQueryString()
Not implemented. Always returns null
Specified by:
getQueryString in interface javax.servlet.http.HttpServletRequest

getRemoteUser

public java.lang.String getRemoteUser()
Not implemented. Always returns null
Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest

isUserInRole

public boolean isUserInRole(java.lang.String role)
Not implemented. Always returns false
Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest

getUserPrincipal

public java.security.Principal getUserPrincipal()
Not implemented. Always returns null
Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Not implemented. Always returns null
Specified by:
getRequestedSessionId in interface javax.servlet.http.HttpServletRequest

getRequestURI

public java.lang.String getRequestURI()
Not implemented. Always returns "/"
Specified by:
getRequestURI in interface javax.servlet.http.HttpServletRequest

getRequestURL

public java.lang.StringBuffer getRequestURL()
Not implemented. Always returns new StringBuffer("http://localhost/")

getServletPath

public java.lang.String getServletPath()
Not implemented. Always returns ""
Specified by:
getServletPath in interface javax.servlet.http.HttpServletRequest

getSession

public javax.servlet.http.HttpSession getSession(boolean create)
Returns an object of class DropletsHttpSession.
Specified by:
getSession in interface javax.servlet.http.HttpServletRequest

getSession

public javax.servlet.http.HttpSession getSession()
Returns an object of class DropletsHttpSession.
Specified by:
getSession in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Not implemented. Always returns true
Specified by:
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Not implemented. Always returns true
Specified by:
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Not implemented. Always returns false
Specified by:
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Not implemented. Always returns isRequestedSessionIdFromURL() (which always returns false)
Specified by:
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequest


Copyright © Droplets, 2001. All Rights Reserved.