View Javadoc

1   /*
2    * Copyright 2001-2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.fileupload;
17  
18  import java.io.InputStream;
19  import java.io.IOException;
20  
21  /***
22   * <p>Abstracts access to the request information needed for file uploads. This
23   * interfsace should be implemented for each type of request that may be
24   * handled by FileUpload, such as servlets and portlets.</p>
25   *
26   * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
27   *
28   * @since FileUpload 1.1
29   *
30   * @version $Id: RequestContext.java 349366 2005-11-28 04:44:57Z martinc $
31   */
32  public interface RequestContext {
33  
34      /***
35       * Retrieve the character encoding for the request.
36       *
37       * @return The character encoding for the request.
38       */
39      String getCharacterEncoding();
40  
41      /***
42       * Retrieve the content type of the request.
43       *
44       * @return The content type of the request.
45       */
46      String getContentType();
47  
48      /***
49       * Retrieve the content length of the request.
50       *
51       * @return The content length of the request.
52       */
53      int getContentLength();
54  
55      /***
56       * Retrieve the input stream for the request.
57       *
58       * @return The input stream for the request.
59       *
60       * @throws IOException if a problem occurs.
61       */
62      InputStream getInputStream() throws IOException;
63  }