com.ideo.sweetdevria.mock
Class MockServletRequest

java.lang.Object
  extended by com.ideo.sweetdevria.mock.MockServletRequest
All Implemented Interfaces:
javax.servlet.ServletRequest
Direct Known Subclasses:
MockHttpServletRequest

public class MockServletRequest
extends java.lang.Object
implements javax.servlet.ServletRequest

Mock ServletRequest object used for "non web" context (exemple : the excel export in batch mode). This object implements only getter/setter methods for attributes.

Author:
Vitaliy Shevchuk, Gregory Paul

Field Summary
static java.lang.String LOCALE_KEY
          Key used to set locale in attributes hastable.
 
Constructor Summary
MockServletRequest(MockHttpSession mockHttpSession)
          Default constructor.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String attrName)
          Get an attribute.
 java.util.Enumeration getAttributeNames()
          Get attributes names.
 java.lang.String getCharacterEncoding()
          Not implemented !
 int getContentLength()
          Not implemented !
 java.lang.String getContentType()
          Not implemented !
 javax.servlet.ServletInputStream getInputStream()
          Not implemented !
 java.lang.String getLocalAddr()
          Not implemented !
 java.util.Locale getLocale()
          Getting default locale.
 java.util.Enumeration getLocales()
          Not implemented !
 java.lang.String getLocalName()
          Not implemented !
 int getLocalPort()
          Not implemented !
 java.lang.String getParameter(java.lang.String string)
           
 java.util.Map getParameterMap()
           
 java.util.Enumeration getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String string)
           
 java.lang.String getProtocol()
          Not implemented !
 java.io.BufferedReader getReader()
          Not implemented !
 java.lang.String getRealPath(java.lang.String string)
          Not implemented !
 java.lang.String getRemoteAddr()
          Not implemented !
 java.lang.String getRemoteHost()
          Not implemented !
 int getRemotePort()
          Not implemented !
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String string)
          Not implemented !
 java.lang.String getScheme()
          Not implemented !
 java.lang.String getServerName()
          Not implemented !
 int getServerPort()
          Not implemented !
 javax.servlet.http.HttpSession getSession()
          Get session.
 boolean isSecure()
          Not implemented !
 void removeAttribute(java.lang.String attrName)
          Remove an attribute.
 void setAttribute(java.lang.String attrName, java.lang.Object object)
          Set an attribute.
 void setCharacterEncoding(java.lang.String string)
          Not implemented !
 void setLocale(java.util.Locale locale)
          Setting locale.
 void setSession(MockHttpSession mockHttpSession)
          Set session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALE_KEY

public static final java.lang.String LOCALE_KEY
Key used to set locale in attributes hastable.

See Also:
Constant Field Values
Constructor Detail

MockServletRequest

public MockServletRequest(MockHttpSession mockHttpSession)
Default constructor.

Parameters:
mockHttpSession - mockHttpSession
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String attrName)
Get an attribute.

Specified by:
getAttribute in interface javax.servlet.ServletRequest
Parameters:
attrName - Attribute name
Returns:
Attribute value

getAttributeNames

public java.util.Enumeration getAttributeNames()
Get attributes names.

Specified by:
getAttributeNames in interface javax.servlet.ServletRequest
Returns:
Enumeration of attributes names

setAttribute

public void setAttribute(java.lang.String attrName,
                         java.lang.Object object)
Set an attribute.

Specified by:
setAttribute in interface javax.servlet.ServletRequest
Parameters:
attrName - Attribute name
object - Attribute value

removeAttribute

public void removeAttribute(java.lang.String attrName)
Remove an attribute.

Specified by:
removeAttribute in interface javax.servlet.ServletRequest
Parameters:
attrName - Attribute name

getSession

public javax.servlet.http.HttpSession getSession()
Get session.

Returns:
mockHttpSession

setSession

public void setSession(MockHttpSession mockHttpSession)
Set session.

Parameters:
mockHttpSession - mockHttpSession

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Not implemented !

Specified by:
getCharacterEncoding in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

setCharacterEncoding

public void setCharacterEncoding(java.lang.String string)
                          throws java.io.UnsupportedEncodingException
Not implemented !

Specified by:
setCharacterEncoding in interface javax.servlet.ServletRequest
Parameters:
string - string
Throws:
java.io.UnsupportedEncodingException - UnsupportedEncodingException

getContentLength

public int getContentLength()
Not implemented !

Specified by:
getContentLength in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getContentType

public java.lang.String getContentType()
Not implemented !

Specified by:
getContentType in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Not implemented !

Specified by:
getInputStream in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)
Throws:
java.io.IOException - IOException

getParameter

public java.lang.String getParameter(java.lang.String string)
Specified by:
getParameter in interface javax.servlet.ServletRequest
Parameters:
-
Returns:

getParameterNames

public java.util.Enumeration getParameterNames()
Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Returns:

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String string)
Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Parameters:
-
Returns:

getParameterMap

public java.util.Map getParameterMap()
Specified by:
getParameterMap in interface javax.servlet.ServletRequest
Returns:

getProtocol

public java.lang.String getProtocol()
Not implemented !

Specified by:
getProtocol in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getScheme

public java.lang.String getScheme()
Not implemented !

Specified by:
getScheme in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getServerName

public java.lang.String getServerName()
Not implemented !

Specified by:
getServerName in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getServerPort

public int getServerPort()
Not implemented !

Specified by:
getServerPort in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Not implemented !

Specified by:
getReader in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)
Throws:
java.io.IOException - IOException

getRemoteAddr

public java.lang.String getRemoteAddr()
Not implemented !

Specified by:
getRemoteAddr in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getRemoteHost

public java.lang.String getRemoteHost()
Not implemented !

Specified by:
getRemoteHost in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

setLocale

public void setLocale(java.util.Locale locale)
Setting locale.

Parameters:
locale - Locale.

getLocale

public java.util.Locale getLocale()
Getting default locale.

Specified by:
getLocale in interface javax.servlet.ServletRequest
Returns:
Locale or null.

getLocales

public java.util.Enumeration getLocales()
Not implemented !

Specified by:
getLocales in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

isSecure

public boolean isSecure()
Not implemented !

Specified by:
isSecure in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String string)
Not implemented !

Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest
Parameters:
string - string
Returns:
nothing (RuntimeException)

getRealPath

public java.lang.String getRealPath(java.lang.String string)
Not implemented !

Specified by:
getRealPath in interface javax.servlet.ServletRequest
Parameters:
string - string
Returns:
nothing (RuntimeException)

getRemotePort

public int getRemotePort()
Not implemented !

Specified by:
getRemotePort in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getLocalName

public java.lang.String getLocalName()
Not implemented !

Specified by:
getLocalName in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getLocalAddr

public java.lang.String getLocalAddr()
Not implemented !

Specified by:
getLocalAddr in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)

getLocalPort

public int getLocalPort()
Not implemented !

Specified by:
getLocalPort in interface javax.servlet.ServletRequest
Returns:
nothing (RuntimeException)


Copyright © 2010 Ideo Technologies. All Rights Reserved.