Java Doc for RequestContext.java in  » Forum » JForum-2.1.8 » net » jforum » context » 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 » Forum » JForum 2.1.8 » net.jforum.context 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


net.jforum.context.RequestContext

All known Subclasses:   net.jforum.context.web.WebRequestContext,  net.jforum.context.standard.StandardRequestContext,
RequestContext
public interface RequestContext (Code)
User: SergeMaslyukov Date: 20.08.2006 Time: 17:18:03

$Id: WebContextRequest.java,v 1.1 2006/08/20 15:30:29 sergemaslyukov Exp $





Method Summary
public  voidaddOrReplaceParameter(String name, Object value)
     Replace or add a parameter.
public  voidaddParameter(String name, Object value)
     Adds a new parameter to the request. If there is already one parameter which name is equals to the value of the "name" parameter, a set of values associated to that name will be generated, thus requiring a call to getParameterValues() to retrieve them all.
public  StringgetAction()
     Gets the action of the current request. An Action is the parameter name which specifies what next action should be done by the system.
public  ObjectgetAttribute(String name)
     Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.

Attributes can be set two ways.

public  StringgetContextPath()
     Returns the portion of the request URI that indicates the context of the request.
public  Cookie[]getCookies()
     Returns an array containing all of the Cookie objects the client sent with this request.
public  StringgetHeader(String name)
     Returns the value of the specified request header as a String.
public  intgetIntParameter(String parameter)
     Gets an parameter that is a number.
public  LocalegetLocale()
     Gets user browser's locale.
public  StringgetModule()
     Gets the module of the current request. A Module is the parameter name which specifies what module the user is requesting.
public  ObjectgetObjectParameter(String parameter)
     Gets some request parameter as Object.
public  StringgetParameter(String name)
     Returns the value of a request parameter as a String, or null if the parameter does not exist.
public  EnumerationgetParameterNames()
     Returns an Enumeration of String objects containing the names of the parameters contained in this request.
public  String[]getParameterValues(String name)
     Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
public  StringgetQueryString()
     Returns the query string that is contained in the request URL after the path.
public  StringgetRemoteAddr()
     Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
public  StringgetRemoteUser()
     Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
public  StringgetRequestURI()
     Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
public  StringgetScheme()
     Returns the name of the scheme used to make this request, for example, http, https, or ftp.
public  StringgetServerName()
     Returns the host name of the server to which the request was sent.
public  intgetServerPort()
     Returns the port number to which the request was sent.
public  SessionContextgetSessionContext(boolean create)
     Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.

If create is false and the request has no valid HttpSession, this method returns null.

To make sure the session is properly maintained, you must call this method before the response is committed.

public  SessionContextgetSessionContext()
     Returns the current session associated with this request, or if the request does not have a session, creates one.
public  voidremoveAttribute(String name)
     Removes an attribute from this request.
public  voidsetAttribute(String name, Object o)
     Stores an attribute in this request.
public  voidsetCharacterEncoding(String env)
     Overrides the name of the character encoding used in the body of this request.



Method Detail
addOrReplaceParameter
public void addOrReplaceParameter(String name, Object value)(Code)
Replace or add a parameter. If it does not exist, it is added to the list, otherwise the existing value will be replaced by the new value.
Parameters:
  name -
Parameters:
  value -



addParameter
public void addParameter(String name, Object value)(Code)
Adds a new parameter to the request. If there is already one parameter which name is equals to the value of the "name" parameter, a set of values associated to that name will be generated, thus requiring a call to getParameterValues() to retrieve them all. If you want to replace a possible existing value, use RequestContext.addOrReplaceParameter(String,Object)
Parameters:
  name - Parameter name
Parameters:
  value - Parameter value



getAction
public String getAction()(Code)
Gets the action of the current request. An Action is the parameter name which specifies what next action should be done by the system. It may be add or edit a post, editing the groups, whatever. In the URL, the Action can the represented in two forms:

http://www.host.com/webapp/servletName?module=groups&action=list

or

http://www.host.com/webapp/servletName/groups/list

In both situations, the action's name is "list". String representing the action name




getAttribute
public Object getAttribute(String name)(Code)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.

Attributes can be set two ways. The servlet container may set attributes to make available custom information about a request. For example, for requests made using HTTPS, the attribute javax.servlet.request.X509Certificate can be used to retrieve information on the certificate of the client. Attributes can also be set programatically using RequestContext.setAttribute . This allows information to be embedded into a request before a javax.servlet.RequestDispatcher call.

Attribute names should follow the same conventions as package names. This specification reserves names matching java.*, javax.*, and sun.*.
Parameters:
  name - a String specifying the name of the attribute an Object containing the value of the attribute, or null if the attribute does not exist




getContextPath
public String getContextPath()(Code)
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string. a String specifying the portion of the request URI that indicates thecontext of the request



getCookies
public Cookie[] getCookies()(Code)
Returns an array containing all of the Cookie objects the client sent with this request. This method returns null if no cookies were sent. an array of all the Cookies included with this request, ornull if the request has no cookies



getHeader
public String getHeader(String name)(Code)
Returns the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. If there are multiple headers with the same name, this method returns the first head in the request. The header name is case insensitive. You can use this method with any request header.
Parameters:
  name - a String specifying the header name a String containing the value of the requested header, ornull if the request does not have a header of that name



getIntParameter
public int getIntParameter(String parameter)(Code)
Gets an parameter that is a number. A call to Integer#parseInt(String) is made to do the conversion
Parameters:
  parameter - The parameter name to get the value int



getLocale
public Locale getLocale()(Code)
Gets user browser's locale. This method may be used during first installation to automatically switch to corresponding language I18N resource. Locale



getModule
public String getModule()(Code)
Gets the module of the current request. A Module is the parameter name which specifies what module the user is requesting. It may be the group administration, the topics or anything else configured module. In the URL, the Module can the represented in two forms:

http://www.host.com/webapp/servletName?module=groups&action=list

or

http://www.host.com/webapp/servletName/groups/list

In both situations, the module's name is "groups". String representing the module name




getObjectParameter
public Object getObjectParameter(String parameter)(Code)
Gets some request parameter as Object. This method may be used when you have to get some value of a multipart/form-data request, like a image of file.

Parameters:
  parameter - String Object



getParameter
public String getParameter(String name)(Code)
Returns the value of a request parameter as a String, or null if the parameter does not exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.

You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use RequestContext.getParameterValues .

If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.

If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via RequestContext.getInputStream or RequestContext.getReader can interfere with the execution of this method.
Parameters:
  name - a String specifying the name of the parameter a String representing the single value of the parameter
See Also:   RequestContext.getParameterValues




getParameterNames
public Enumeration getParameterNames()(Code)
Returns an Enumeration of String objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration. an Enumeration of String objects, eachString containing the name of a request parameter; or an emptyEnumeration if the request has no parameters



getParameterValues
public String[] getParameterValues(String name)(Code)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

If the parameter has a single value, the array has a length of 1.
Parameters:
  name - a String containing the name of the parameter whose value is requested an array of String objects containing the parameter's values
See Also:   RequestContext.getParameter




getQueryString
public String getQueryString()(Code)
Returns the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string. Same as the value of the CGI variable QUERY_STRING. a String containing the query string or null if the URLcontains no query string. The value is not decoded by the container.



getRemoteAddr
public String getRemoteAddr()(Code)
Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR. a String containing the IP address of the client that sent the request



getRemoteUser
public String getRemoteUser()(Code)
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER. a String specifying the login of the user making this request, ornull if the user login is not known



getRequestURI
public String getRequestURI()(Code)
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. The web container does not decode this String. For example:
First line of HTTP request Returned Value
POST /some/path.html HTTP/1.1 /some/path.html
GET http://foo.bar/a.html HTTP/1.0 /a.html
HEAD /xyz?a=b HTTP/1.1 /xyz

To reconstruct an URL with a scheme and host, use javax.servlet.http.HttpUtils.getRequestURL . a String containing the part of the URL from the protocol name up tothe query string
See Also:   javax.servlet.http.HttpUtils.getRequestURL




getScheme
public String getScheme()(Code)
Returns the name of the scheme used to make this request, for example, http, https, or ftp. Different schemes have different rules for constructing URLs, as noted in RFC 1738. a String containing the name of the scheme used to make this request



getServerName
public String getServerName()(Code)
Returns the host name of the server to which the request was sent. It is the value of the part before ":" in the Host header value, if any, or the resolved server name, or the server IP address. a String containing the name of the server



getServerPort
public int getServerPort()(Code)
Returns the port number to which the request was sent. It is the value of the part after ":" in the Host header value, if any, or the server port where the client connection was accepted on. an integer specifying the port number



getSessionContext
public SessionContext getSessionContext(boolean create)(Code)
Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.

If create is false and the request has no valid HttpSession, this method returns null.

To make sure the session is properly maintained, you must call this method before the response is committed. If the container is using cookies to maintain session integrity and is asked to create a new session when the response is committed, an IllegalStateException is thrown.
Parameters:
  create - true to create a new session for this request if necessary;false to return null if there's no current session the HttpSession associated with this request or null ifcreate is false and the request has no valid session
See Also:   RequestContext.getSessionContext()




getSessionContext
public SessionContext getSessionContext()(Code)
Returns the current session associated with this request, or if the request does not have a session, creates one. the HttpSession associated with this request
See Also:   RequestContext.getSessionContext(boolean)



removeAttribute
public void removeAttribute(String name)(Code)
Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.

Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems.
Parameters:
  name - a String specifying the name of the attribute to remove




setAttribute
public void setAttribute(String name, Object o)(Code)
Stores an attribute in this request. Attributes are reset between requests. This method is most often used in conjunction with javax.servlet.RequestDispatcher .

Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems.
If the object passed in is null, the effect is the same as calling RequestContext.removeAttribute .
It is warned that when the request is dispatched from the servlet resides in a different web application by RequestDispatcher, the object set by this method may not be correctly retrieved in the caller servlet.
Parameters:
  name - a String specifying the name of the attribute
Parameters:
  o - the Object to be stored




setCharacterEncoding
public void setCharacterEncoding(String env) throws UnsupportedEncodingException(Code)
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader().
Parameters:
  env - a String containing the name of the character encoding.
throws:
  java.io.UnsupportedEncodingException - if this is not a valid encoding



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