Java Doc for MockHttpServletRequest.java in  » J2EE » wicket » org » apache » wicket » protocol » http » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » wicket » org.apache.wicket.protocol.http 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.wicket.protocol.http.MockHttpServletRequest

MockHttpServletRequest
public class MockHttpServletRequest implements HttpServletRequest(Code)
Mock servlet request. Implements all of the methods from the standard HttpServletRequest class plus helper methods to aid setting up a request.
author:
   Chris Turner



Constructor Summary
public  MockHttpServletRequest(Application application, HttpSession session, ServletContext context)
     Create the request using the supplied session object.

Method Summary
public  voidaddCookie(Cookie cookie)
     Add a new cookie.
public  voidaddFile(String fieldName, File file, String contentType)
     Add an uploaded file to the request.
public  voidaddHeader(String name, String value)
     Add a header to the request.
public  ObjectgetAttribute(String name)
     Get an attribute.
public  EnumerationgetAttributeNames()
     Get the names of all of the values.
public  StringgetAuthType()
     Get the auth type.
public  StringgetCharacterEncoding()
     Get the current character encoding.
public  intgetContentLength()
     Return the length of the content.
public  StringgetContentType()
     If there has been added uploaded files return the correct content-type. The correct multipart content-type if there has been addeduploaded files.
public  StringgetContextPath()
     Get the context path.
public  Cookie[]getCookies()
     Get all of the cookies for this request.
public  longgetDateHeader(String name)
     Get the given header as a date.
public  StringgetHeader(String name)
     Get the given header value.
public  EnumerationgetHeaderNames()
     Get the names of all of the headers.
public  EnumerationgetHeaders(String name)
     Get enumeration of all header values with the given name.
public  ServletInputStreamgetInputStream()
     Returns an input stream if there has been added some uploaded files.
public  intgetIntHeader(String name)
     Get the given header as an int.
public  LocalegetLocale()
     Get the locale of the request.
public  EnumerationgetLocales()
     Return all the accepted locales.
public  StringgetMethod()
     Get the method.
public  StringgetParameter(String name)
     Get the request parameter with the given name.
public  MapgetParameterMap()
     Get the map of all of the parameters.
public  EnumerationgetParameterNames()
     Get the names of all of the parameters.
public  String[]getParameterValues(String name)
     Get the values for the given parameter.
public  StringgetPathInfo()
     Get the path info.
public  StringgetPathTranslated()
     Always returns null.
public  StringgetProtocol()
     Get the protocol.
public  StringgetQueryString()
     Get the query string part of the request.
public  BufferedReadergetReader()
     This feature is not implemented at this time as we are not supporting binary servlet input.
public  StringgetRealPath(String name)
     Deprecated method - should not be used.
public  StringgetRemoteAddr()
     Get the remote address of the client.
public  StringgetRemoteHost()
     Get the remote host.
public  StringgetRemoteUser()
     Get the name of the remote user from the REMOTE_USER header.
public  RequestDispatchergetRequestDispatcher(String name)
     Return a dummy dispatcher that just records that dispatch has occured without actually doing anything.
public  StringgetRequestURI()
    
public  StringBuffergetRequestURL()
     Try to build a rough URL.
public  StringgetRequestedSessionId()
     Get the requested session id.
public  StringgetScheme()
     Get the scheme.
public  StringgetServerName()
     Get the server name.
public  intgetServerPort()
     Get the server port.
public  StringgetServletPath()
     The servlet path may either be the application name or /.
public  HttpSessiongetSession()
     Get the sessions.
public  HttpSessiongetSession(boolean b)
     Get the session.
public  PrincipalgetUserPrincipal()
     Get the user principal.
public  booleanhasUploadedFiles()
    
public  voidinitialize()
     Reset the request back to a default state.
public  booleanisRequestedSessionIdFromCookie()
     Check whether session id is from a cookie.
public  booleanisRequestedSessionIdFromURL()
     Check whether session id is from a url rewrite.
public  booleanisRequestedSessionIdFromUrl()
     Check whether session id is from a url rewrite.
public  booleanisRequestedSessionIdValid()
     Check whether the session id is valid.
public  booleanisSecure()
     Always returns false.
public  booleanisUserInRole(String name)
     NOT IMPLEMENTED.
public  voidremoveAttribute(String name)
     Remove the given attribute.
public  voidsetAttribute(String name, Object o)
     Set the given attribute.
public  voidsetAuthType(String authType)
     Set the auth type.
public  voidsetCharacterEncoding(String encoding)
     Set the character encoding.
public  voidsetCookies(Cookie[] theCookies)
     Set the cookies.
public  voidsetMethod(String method)
     Set the method.
public  voidsetParameter(String name, String value)
     Set a parameter.
public  voidsetParameters(Map parameters)
     Sets a map of parameters.
public  voidsetPath(String path)
     Set the path that this request is supposed to be serving.
public  voidsetRequestToBookmarkablePage(Page page, Map params)
     Initialise the request parameters to point to the given bookmarkable page.
public  voidsetRequestToComponent(Component component)
     Initialise the request parameters to point to the given component.
public  voidsetRequestToFormComponent(Form form, Map values)
     Initialise the request parameters to point to the given form component.
public  voidsetRequestToRedirectString(String redirect)
     Initialise the request parameters from the given redirect string that redirects back to a particular component for display.
public  voidsetURL(String url)
     Set the complete url for this request.


Constructor Detail
MockHttpServletRequest
public MockHttpServletRequest(Application application, HttpSession session, ServletContext context)(Code)
Create the request using the supplied session object.
Parameters:
  application - The application that this request is for
Parameters:
  session - The session object
Parameters:
  context - The current servlet context




Method Detail
addCookie
public void addCookie(Cookie cookie)(Code)
Add a new cookie.
Parameters:
  cookie - The cookie



addFile
public void addFile(String fieldName, File file, String contentType)(Code)
Add an uploaded file to the request. Use this to simulate a file that has been uploaded to a field.
Parameters:
  fieldName - The fieldname of the upload field.
Parameters:
  file - The file to upload.
Parameters:
  contentType - The content type of the file. Must be a correct mimetype.



addHeader
public void addHeader(String name, String value)(Code)
Add a header to the request.
Parameters:
  name - The name of the header to add
Parameters:
  value - The value



getAttribute
public Object getAttribute(String name)(Code)
Get an attribute.
Parameters:
  name - The attribute name The value, or null



getAttributeNames
public Enumeration getAttributeNames()(Code)
Get the names of all of the values. The names



getAuthType
public String getAuthType()(Code)
Get the auth type. The auth type



getCharacterEncoding
public String getCharacterEncoding()(Code)
Get the current character encoding. The character encoding



getContentLength
public int getContentLength()(Code)
Return the length of the content. This is always -1 except if there has been added uploaded files. Then the length will be the length of the generated request. -1 if no uploaded files has been added. Else the length of thegenerated request.



getContentType
public String getContentType()(Code)
If there has been added uploaded files return the correct content-type. The correct multipart content-type if there has been addeduploaded files. Else null.



getContextPath
public String getContextPath()(Code)
Get the context path. For this mock implementation the name of the application is always returned. The context path



getCookies
public Cookie[] getCookies()(Code)
Get all of the cookies for this request. The cookies



getDateHeader
public long getDateHeader(String name) throws IllegalArgumentException(Code)
Get the given header as a date.
Parameters:
  name - The header name The date, or -1 if header not found
throws:
  IllegalArgumentException - If the header cannot be converted



getHeader
public String getHeader(String name)(Code)
Get the given header value.
Parameters:
  name - The header name The header value or null



getHeaderNames
public Enumeration getHeaderNames()(Code)
Get the names of all of the headers. The header names



getHeaders
public Enumeration getHeaders(String name)(Code)
Get enumeration of all header values with the given name.
Parameters:
  name - The name The header values



getInputStream
public ServletInputStream getInputStream() throws IOException(Code)
Returns an input stream if there has been added some uploaded files. Use MockHttpServletRequest.addFile(String,File,String) to add some uploaded files. The input stream
throws:
  IOException - If an I/O related problem occurs



getIntHeader
public int getIntHeader(String name)(Code)
Get the given header as an int.
Parameters:
  name - The header name The header value or -1 if header not found
throws:
  NumberFormatException - If the header is not formatted correctly



getLocale
public Locale getLocale()(Code)
Get the locale of the request. Attempts to decode the Accept-Language header and if not found returns the default locale of the JVM. The locale



getLocales
public Enumeration getLocales()(Code)
Return all the accepted locales. This implementation always returns just one. The locales



getMethod
public String getMethod()(Code)
Get the method. The method



getParameter
public String getParameter(String name)(Code)
Get the request parameter with the given name.
Parameters:
  name - The parameter name The parameter value, or null



getParameterMap
public Map getParameterMap()(Code)
Get the map of all of the parameters. The parameters



getParameterNames
public Enumeration getParameterNames()(Code)
Get the names of all of the parameters. The parameter names



getParameterValues
public String[] getParameterValues(String name)(Code)
Get the values for the given parameter.
Parameters:
  name - The name of the parameter The return values



getPathInfo
public String getPathInfo()(Code)
Get the path info. The path info



getPathTranslated
public String getPathTranslated()(Code)
Always returns null. null



getProtocol
public String getProtocol()(Code)
Get the protocol. Always HTTP/1.1



getQueryString
public String getQueryString()(Code)
Get the query string part of the request. The query string



getReader
public BufferedReader getReader() throws IOException(Code)
This feature is not implemented at this time as we are not supporting binary servlet input. This functionality may be added in the future. The reader
throws:
  IOException - If an I/O related problem occurs



getRealPath
public String getRealPath(String name)(Code)
Deprecated method - should not be used.
Parameters:
  name - The name The path



getRemoteAddr
public String getRemoteAddr()(Code)
Get the remote address of the client. Always 127.0.0.1



getRemoteHost
public String getRemoteHost()(Code)
Get the remote host. Always localhost



getRemoteUser
public String getRemoteUser()(Code)
Get the name of the remote user from the REMOTE_USER header. The name of the remote user



getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String name)(Code)
Return a dummy dispatcher that just records that dispatch has occured without actually doing anything.
Parameters:
  name - The name to dispatch to The dispatcher



getRequestURI
public String getRequestURI()(Code)
Returns context path and servlet path concatenated, typically /applicationClassName/applicationClassName The path value
See Also:   javax.servlet.http.HttpServletRequest.getRequestURI



getRequestURL
public StringBuffer getRequestURL()(Code)
Try to build a rough URL. The url



getRequestedSessionId
public String getRequestedSessionId()(Code)
Get the requested session id. Always returns the id of the current session. The session id



getScheme
public String getScheme()(Code)
Get the scheme. Always http



getServerName
public String getServerName()(Code)
Get the server name. Always localhost



getServerPort
public int getServerPort()(Code)
Get the server port. Always 80



getServletPath
public String getServletPath()(Code)
The servlet path may either be the application name or /. For test purposes we always return the servlet name. The servlet path



getSession
public HttpSession getSession()(Code)
Get the sessions. The session



getSession
public HttpSession getSession(boolean b)(Code)
Get the session.
Parameters:
  b - Ignored, there is always a session The session



getUserPrincipal
public Principal getUserPrincipal()(Code)
Get the user principal. A user principal



hasUploadedFiles
public boolean hasUploadedFiles()(Code)
True if there has been added files to this request usingMockHttpServletRequest.addFile(String,File,String)



initialize
public void initialize()(Code)
Reset the request back to a default state.



isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()(Code)
Check whether session id is from a cookie. Always returns true. Always true



isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()(Code)
Check whether session id is from a url rewrite. Always returns false. Always false



isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()(Code)
Check whether session id is from a url rewrite. Always returns false. Always false



isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()(Code)
Check whether the session id is valid. Always true



isSecure
public boolean isSecure()(Code)
Always returns false. Always false



isUserInRole
public boolean isUserInRole(String name)(Code)
NOT IMPLEMENTED.
Parameters:
  name - The role name Always false



removeAttribute
public void removeAttribute(String name)(Code)
Remove the given attribute.
Parameters:
  name - The name of the attribute



setAttribute
public void setAttribute(String name, Object o)(Code)
Set the given attribute.
Parameters:
  name - The attribute name
Parameters:
  o - The value to set



setAuthType
public void setAuthType(String authType)(Code)
Set the auth type.
Parameters:
  authType - The auth type



setCharacterEncoding
public void setCharacterEncoding(String encoding) throws UnsupportedEncodingException(Code)
Set the character encoding.
Parameters:
  encoding - The character encoding
throws:
  UnsupportedEncodingException - If encoding not supported



setCookies
public void setCookies(Cookie[] theCookies)(Code)
Set the cookies.
Parameters:
  theCookies - The cookies



setMethod
public void setMethod(String method)(Code)
Set the method.
Parameters:
  method - The method



setParameter
public void setParameter(String name, String value)(Code)
Set a parameter.
Parameters:
  name - The name
Parameters:
  value - The value



setParameters
public void setParameters(Map parameters)(Code)
Sets a map of parameters.
Parameters:
  parameters - the parameters to set



setPath
public void setPath(String path)(Code)
Set the path that this request is supposed to be serving. The path is relative to the web application root and should start with a / charater
Parameters:
  path -



setRequestToBookmarkablePage
public void setRequestToBookmarkablePage(Page page, Map params)(Code)
Initialise the request parameters to point to the given bookmarkable page.
Parameters:
  page - The page to point to
Parameters:
  params - Additional parameters



setRequestToComponent
public void setRequestToComponent(Component component)(Code)
Initialise the request parameters to point to the given component.
Parameters:
  component - The component



setRequestToFormComponent
public void setRequestToFormComponent(Form form, Map values)(Code)
Initialise the request parameters to point to the given form component. The additional map should contain mappings between individual components that appear in the form and the string value that should be submitted for each of these components.
Parameters:
  form - The for to send the request to
Parameters:
  values - The values for each of the form components



setRequestToRedirectString
public void setRequestToRedirectString(String redirect)(Code)
Initialise the request parameters from the given redirect string that redirects back to a particular component for display.
Parameters:
  redirect - The redirect string to display from



setURL
public void setURL(String url)(Code)
Set the complete url for this request. The url will be analyzed.
Parameters:
  url -



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.