1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet;
16  
17  import java.io.BufferedReader;
18  import java.io.IOException;
19  import java.io.InputStream;
20  import java.io.UnsupportedEncodingException;
21  
22  import javax.portlet.ClientDataRequest;
23  
24  /**
25   * <a href="ClientDataRequestImpl.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public abstract class ClientDataRequestImpl
30      extends PortletRequestImpl implements ClientDataRequest {
31  
32      public String getCharacterEncoding() {
33          return getHttpServletRequest().getCharacterEncoding();
34      }
35  
36      public int getContentLength() {
37          return getHttpServletRequest().getContentLength();
38      }
39  
40      public String getContentType() {
41          return getHttpServletRequest().getContentType();
42      }
43  
44      public String getMethod() {
45          return getHttpServletRequest().getMethod();
46      }
47  
48      public InputStream getPortletInputStream() throws IOException {
49          return getHttpServletRequest().getInputStream();
50      }
51  
52      public BufferedReader getReader()
53          throws IOException, UnsupportedEncodingException {
54  
55          _calledGetReader = true;
56  
57          return getHttpServletRequest().getReader();
58      }
59  
60      public void setCharacterEncoding(String enc)
61          throws UnsupportedEncodingException {
62  
63          if (_calledGetReader) {
64              throw new IllegalStateException();
65          }
66  
67          getHttpServletRequest().setCharacterEncoding(enc);
68      }
69  
70      private boolean _calledGetReader;
71  
72  }