KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > multipart > IMultipartDecoder


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.multipart;
16
17 import javax.servlet.http.HttpServletRequest JavaDoc;
18
19 import org.apache.tapestry.request.IUploadFile;
20
21 /**
22  * Defines how a multipart HTTP request can be broken into individual elements (including file
23  * uploads).
24  * <p>
25  * Multipart decoder implementations must be threadsafe.
26  *
27  * @author Howard Lewis Ship
28  * @since 2.3
29  */

30
31 public interface IMultipartDecoder
32 {
33     /**
34      * Decodes the incoming request, identifying all the parts (values and uploaded files) contained
35      * within.
36      */

37
38     public void decode(HttpServletRequest JavaDoc request);
39
40     /**
41      * Invoked to release any resources needed by tghe decoder. In some cases, large incoming parts
42      * are written to temporary files; this method ensures those temporary files are deleted.
43      */

44
45     public void cleanup(HttpServletRequest JavaDoc request);
46
47     /**
48      * Returns the single value (or first value) for the parameter with the specified name. Returns
49      * null if no such parameter was in the request.
50      */

51
52     public String JavaDoc getString(HttpServletRequest JavaDoc request, String JavaDoc name);
53
54     /**
55      * Returns an array of values (possibly a single element array). Returns null if no such
56      * parameter was in the request.
57      */

58
59     public String JavaDoc[] getStrings(HttpServletRequest JavaDoc request, String JavaDoc name);
60
61     /**
62      * Returns the uploaded file with the specified parameter name, or null if no such parameter was
63      * in the request.
64      */

65
66     public IUploadFile getUploadFile(HttpServletRequest JavaDoc request, String JavaDoc name);
67
68     /**
69      * Returns the names of all parameters whose type is string (not file upload).
70      *
71      * @since 4.0
72      */

73     public String JavaDoc[] getStringParameterNames(HttpServletRequest JavaDoc request);
74 }
Popular Tags