Source Code Cross Referenced for ActionRequestImpl.java in  » Portal » gridsphere » org » gridsphere » portlet » impl » 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 » Portal » gridsphere » org.gridsphere.portlet.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
003:         * @version $Id: ActionRequestImpl.java 6385 2007-10-25 14:02:26Z wehrens $
004:         */
005:        package org.gridsphere.portlet.impl;
006:
007:        import javax.portlet.ActionRequest;
008:        import javax.portlet.PortletContext;
009:        import javax.portlet.PortletRequest;
010:        import javax.portlet.RenderRequest;
011:        import javax.servlet.http.HttpServletRequest;
012:        import java.io.IOException;
013:        import java.io.UnsupportedEncodingException;
014:
015:        /**
016:         * The <CODE>ActionRequest</CODE> represents the request sent to the portlet
017:         * to handle an action.
018:         * It extends the PortletRequest interface to provide action request
019:         * information to portlets.<br>
020:         * The portlet container creates an <CODE>ActionRequest</CODE> object and
021:         * passes it as argument to the portlet's <CODE>processAction</CODE> method.
022:         * 
023:         * @see PortletRequest
024:         * @see RenderRequest
025:         */
026:        public class ActionRequestImpl extends PortletRequestImpl implements 
027:                ActionRequest {
028:
029:            /**
030:             * Constructor creates a proxy for a HttpServletRequest
031:             * All PortletRequest objects come from request or session attributes
032:             *
033:             * @param req the HttpServletRequest
034:             * @param portletContext the PortletContext
035:             */
036:            public ActionRequestImpl(HttpServletRequest req,
037:                    PortletContext portletContext) {
038:                super (req, portletContext);
039:            }
040:
041:            /**
042:             * Retrieves the body of the HTTP request from client to
043:             * portal as binary data using
044:             * an <CODE>InputStream</CODE>. Either this method or
045:             * {@link #getReader} may be called to read the body, but not both.
046:             * <p/>
047:             * For HTTP POST data of type application/x-www-form-urlencoded
048:             * this method throws an <code>IllegalStateException</code>
049:             * as this data has been already processed by the
050:             * portal/portlet-container and is available as request parameters.
051:             *
052:             * @return an input stream containing the body of the request
053:             * @throws IllegalStateException if getReader was already called, or it is a
054:             *                               HTTP POST data of type application/x-www-form-urlencoded
055:             * @throws java.io.IOException   if an input or output exception occurred
056:             */
057:            public java.io.InputStream getPortletInputStream()
058:                    throws IOException, IllegalStateException {
059:                HttpServletRequest req = (HttpServletRequest) super 
060:                        .getRequest();
061:                // 'POST' replaced by 'post' for XHTML 1.0 Strict compliance
062:                if (req.getMethod().toUpperCase().equals("POST")) {
063:                    String contentType = req.getContentType();
064:                    if (contentType == null
065:                            || contentType
066:                                    .equals("application/x-www-form-urlencoded")) {
067:                        throw new IllegalStateException(
068:                                "User request HTTP POST data is of type application/x-www-form-urlencoded. This data has been already processed by the portal/portlet-container and is available as request parameters.");
069:                    }
070:                }
071:                hasReader = true;
072:                return super .getRequest().getInputStream();
073:            }
074:
075:            /**
076:             * Overrides the name of the character encoding used in the body of this
077:             * request. This method must be called prior to reading input
078:             * using {@link #getReader} or {@link #getPortletInputStream}.
079:             * <p/>
080:             * This method only sets the character set for the Reader that the
081:             * {@link #getReader} method returns.
082:             *
083:             * @param	enc	a <code>String</code> containing the name of
084:             * the chararacter encoding.
085:             * @exception		java.io.UnsupportedEncodingException if this is not a valid encoding
086:             * @exception		IllegalStateException if this method is called after
087:             * reading request parameters or reading input using
088:             * <code>getReader()</code>
089:             */
090:            public void setCharacterEncoding(String enc)
091:                    throws UnsupportedEncodingException, IllegalStateException {
092:                if (hasReader) {
093:                    throw new IllegalStateException(
094:                            "Cannot invoke this method after using getReader or reading request parameters!");
095:                }
096:                super .getRequest().setCharacterEncoding(enc);
097:            }
098:
099:            /**
100:             * Retrieves the body of the HTTP request from the client to the portal
101:             * as character data using
102:             * a <code>BufferedReader</code>.  The reader translates the character
103:             * data according to the character encoding used on the body.
104:             * Either this method or {@link #getPortletInputStream} may be called to read the
105:             * body, not both.
106:             * <p/>
107:             * For HTTP POST data of type application/x-www-form-urlencoded
108:             * this method throws an <code>IllegalStateException</code>
109:             * as this data has been already processed by the
110:             * portal/portlet-container and is available as request parameters.
111:             *
112:             * @throws java.io.UnsupportedEncodingException
113:             *                               if the character set encoding used is
114:             *                               not supported and the text cannot be decoded
115:             * @throws IllegalStateException if {@link #getPortletInputStream} method
116:             *                               has been called on this request,  it is a
117:             *                               HTTP POST data of type application/x-www-form-urlencoded.
118:             * @throws java.io.IOException   if an input or output exception occurred
119:             * @return	a <code>BufferedReader</code>
120:             * containing the body of the request
121:             * @see #getPortletInputStream
122:             */
123:            public java.io.BufferedReader getReader()
124:                    throws java.io.IOException {
125:                hasReader = true;
126:                return super .getRequest().getReader();
127:            }
128:
129:            /**
130:             * Returns the name of the character encoding used in the body of this request.
131:             * This method returns <code>null</code> if the request
132:             * does not specify a character encoding.
133:             *
134:             * @return		a <code>String</code> containing the name of
135:             * the chararacter encoding, or <code>null</code>
136:             * if the request does not specify a character encoding.
137:             */
138:            public String getCharacterEncoding() {
139:                return super .getRequest().getCharacterEncoding();
140:            }
141:
142:            /**
143:             * Returns the MIME type of the body of the request,
144:             * or null if the type is not known.
145:             *
146:             * @return		a <code>String</code> containing the name
147:             * of the MIME type of the request, or null
148:             * if the type is not known.
149:             */
150:            public String getContentType() {
151:                return super .getRequest().getContentType();
152:            }
153:
154:            /**
155:             * Returns the length, in bytes, of the request body
156:             * which is made available by the input stream, or -1 if the
157:             * length is not known.
158:             *
159:             * @return		an integer containing the length of the
160:             * request body or -1 if the length is not known
161:             */
162:            public int getContentLength() {
163:                return super.getRequest().getContentLength();
164:            }
165:
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.