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: *
033: * @exception java.lang.IllegalStateException
034: * if getReader was already called, or it is a
035: * HTTP POST data of type application/x-www-form-urlencoded
036: * @exception java.io.IOException
037: * if an input or output exception occurred
038: */
039: public java.io.InputStream getPortletInputStream()
040: throws java.io.IOException;
041:
042: /**
043: * Overrides the name of the character encoding used in the body of this
044: * request. This method must be called prior to reading input
045: * using {@link #getReader} or {@link #getPortletInputStream}.
046: * <p>
047: * This method only sets the character set for the Reader that the
048: * {@link #getReader} method returns.
049: *
050: * @param enc a <code>String</code> containing the name of
051: * the chararacter encoding.
052: *
053: * @exception java.io.UnsupportedEncodingException if this is not a valid encoding
054: * @exception java.lang.IllegalStateException if this method is called after
055: * reading request parameters or reading input using
056: * <code>getReader()</code>
057: */
058:
059: public void setCharacterEncoding(String enc)
060: throws java.io.UnsupportedEncodingException;
061:
062: /**
063: * Retrieves the body of the HTTP request from the client to the portal
064: * as character data using
065: * a <code>BufferedReader</code>. The reader translates the character
066: * data according to the character encoding used on the body.
067: * Either this method or {@link #getPortletInputStream} may be called to read the
068: * body, not both.
069: * <p>
070: * For HTTP POST data of type application/x-www-form-urlencoded
071: * this method throws an <code>IllegalStateException</code>
072: * as this data has been already processed by the
073: * portal/portlet-container and is available as request parameters.
074: *
075: * @return a <code>BufferedReader</code>
076: * containing the body of the request
077: *
078: * @exception java.io.UnsupportedEncodingException
079: * if the character set encoding used is
080: * not supported and the text cannot be decoded
081: * @exception java.lang.IllegalStateException
082: * if {@link #getPortletInputStream} method
083: * has been called on this request, it is a
084: * HTTP POST data of type application/x-www-form-urlencoded.
085: * @exception java.io.IOException
086: * if an input or output exception occurred
087: *
088: * @see #getPortletInputStream
089: */
090:
091: public java.io.BufferedReader getReader()
092: throws java.io.UnsupportedEncodingException,
093: java.io.IOException;
094:
095: /**
096: * Returns the name of the character encoding used in the body of this request.
097: * This method returns <code>null</code> if the request
098: * does not specify a character encoding.
099: *
100: * @return a <code>String</code> containing the name of
101: * the chararacter encoding, or <code>null</code>
102: * if the request does not specify a character encoding.
103: */
104:
105: public java.lang.String getCharacterEncoding();
106:
107: /**
108: * Returns the MIME type of the body of the request,
109: * or null if the type is not known.
110: *
111: * @return a <code>String</code> containing the name
112: * of the MIME type of the request, or null
113: * if the type is not known.
114: */
115:
116: public java.lang.String getContentType();
117:
118: /**
119: * Returns the length, in bytes, of the request body
120: * which is made available by the input stream, or -1 if the
121: * length is not known.
122: *
123: *
124: * @return an integer containing the length of the
125: * request body or -1 if the length is not known
126: *
127: */
128:
129: public int getContentLength();
130:
131: }
|