001: /**
002: * Copyright 2003 IBM Corporation and Sun Microsystems, Inc.
003: * All rights reserved.
004: * Use is subject to license terms.
005: */package javax.portlet;
006:
007: /**
008: * The <CODE>ActionRequest</CODE> represents the request sent to the portlet
009: * to handle an action.
010: * It extends the PortletRequest interface to provide action request
011: * information to portlets.<br>
012: * The portlet container creates an <CODE>ActionRequest</CODE> object and
013: * passes it as argument to the portlet's <CODE>processAction</CODE> method.
014: *
015: * @see PortletRequest
016: * @see RenderRequest
017: */
018: public interface ActionRequest extends PortletRequest {
019:
020: /**
021: * Retrieves the body of the HTTP request from client to
022: * portal as binary data using
023: * an <CODE>InputStream</CODE>. Either this method or
024: * {@link #getReader} may be called to read the body, but not both.
025: * <p/>
026: * For HTTP POST data of type application/x-www-form-urlencoded
027: * this method throws an <code>IllegalStateException</code>
028: * as this data has been already processed by the
029: * portal/portlet-container and is available as request parameters.
030: *
031: * @return an input stream containing the body of the request
032: * @throws java.lang.IllegalStateException
033: * if getReader was already called, or it is a
034: * HTTP POST data of type application/x-www-form-urlencoded
035: * @throws java.io.IOException if an input or output exception occurred
036: */
037: public java.io.InputStream getPortletInputStream()
038: throws java.io.IOException;
039:
040: /**
041: * Overrides the name of the character encoding used in the body of this
042: * request. This method must be called prior to reading input
043: * using {@link #getReader} or {@link #getPortletInputStream}.
044: * <p/>
045: * This method only sets the character set for the Reader that the
046: * {@link #getReader} method returns.
047: *
048: * @param enc a <code>String</code> containing the name of
049: * the chararacter encoding.
050: * @exception java.io.UnsupportedEncodingException if this is not a valid encoding
051: * @exception java.lang.IllegalStateException if this method is called after
052: * reading request parameters or reading input using
053: * <code>getReader()</code>
054: */
055:
056: public void setCharacterEncoding(String enc)
057: throws java.io.UnsupportedEncodingException;
058:
059: /**
060: * Retrieves the body of the HTTP request from the client to the portal
061: * as character data using
062: * a <code>BufferedReader</code>. The reader translates the character
063: * data according to the character encoding used on the body.
064: * Either this method or {@link #getPortletInputStream} may be called to read the
065: * body, not both.
066: * <p/>
067: * For HTTP POST data of type application/x-www-form-urlencoded
068: * this method throws an <code>IllegalStateException</code>
069: * as this data has been already processed by the
070: * portal/portlet-container and is available as request parameters.
071: *
072: * @throws java.io.UnsupportedEncodingException
073: * if the character set encoding used is
074: * not supported and the text cannot be decoded
075: * @throws java.lang.IllegalStateException
076: * if {@link #getPortletInputStream} method
077: * has been called on this request, it is a
078: * HTTP POST data of type application/x-www-form-urlencoded.
079: * @throws java.io.IOException if an input or output exception occurred
080: * @return a <code>BufferedReader</code>
081: * containing the body of the request
082: * @see #getPortletInputStream
083: */
084:
085: public java.io.BufferedReader getReader()
086: throws java.io.UnsupportedEncodingException,
087: java.io.IOException;
088:
089: /**
090: * Returns the name of the character encoding used in the body of this request.
091: * This method returns <code>null</code> if the request
092: * does not specify a character encoding.
093: *
094: * @return a <code>String</code> containing the name of
095: * the chararacter encoding, or <code>null</code>
096: * if the request does not specify a character encoding.
097: */
098:
099: public java.lang.String getCharacterEncoding();
100:
101: /**
102: * Returns the MIME type of the body of the request,
103: * or null if the type is not known.
104: *
105: * @return a <code>String</code> containing the name
106: * of the MIME type of the request, or null
107: * if the type is not known.
108: */
109:
110: public java.lang.String getContentType();
111:
112: /**
113: * Returns the length, in bytes, of the request body
114: * which is made available by the input stream, or -1 if the
115: * length is not known.
116: *
117: * @return an integer containing the length of the
118: * request body or -1 if the length is not known
119: */
120:
121: public int getContentLength();
122:
123: }
|