1 package org.apache.turbine.util;
2
3 /* ====================================================================
4 * The Apache Software License, Version 1.1
5 *
6 * Copyright (c) 2001 The Apache Software Foundation. All rights
7 * reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. The end-user documentation included with the redistribution,
22 * if any, must include the following acknowledgment:
23 * "This product includes software developed by the
24 * Apache Software Foundation (http://www.apache.org/)."
25 * Alternately, this acknowledgment may appear in the software itself,
26 * if and wherever such third-party acknowledgments normally appear.
27 *
28 * 4. The names "Apache" and "Apache Software Foundation" and
29 * "Apache Turbine" must not be used to endorse or promote products
30 * derived from this software without prior written permission. For
31 * written permission, please contact apache@apache.org.
32 *
33 * 5. Products derived from this software may not be called "Apache",
34 * "Apache Turbine", nor may "Apache" appear in their name, without
35 * prior written permission of the Apache Software Foundation.
36 *
37 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 * SUCH DAMAGE.
49 * ====================================================================
50 *
51 * This software consists of voluntary contributions made by many
52 * individuals on behalf of the Apache Software Foundation. For more
53 * information on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57 import javax.servlet.http.HttpServletRequest;
58 import org.apache.turbine.util.upload.FileItem;
59
60 /***
61 * ParameterParser is an interface to a utility to handle parsing and
62 * retrieving the data passed via the GET/POST/PATH_INFO arguments.
63 *
64 * <p>NOTE: The name= portion of a name=value pair may be converted
65 * to lowercase or uppercase when the object is initialized and when
66 * new data is added. This behaviour is determined by the url.case.folding
67 * property in TurbineResources.properties. Adding a name/value pair may
68 * overwrite existing name=value pairs if the names match:
69 *
70 * <pre>
71 * ParameterParser pp = data.getParameters();
72 * pp.add("ERROR",1);
73 * pp.add("eRrOr",2);
74 * int result = pp.getInt("ERROR");
75 * </pre>
76 *
77 * In the above example, result is 2.
78 *
79 * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
80 * @author <a href="mailto:jon@clearink.com">Jon S. Stevens</a>
81 * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
82 * @version $Id: ParameterParser.java,v 1.3 2002/07/11 18:21:03 mpoeschl Exp $
83 */
84 public interface ParameterParser
85 extends ValueParser
86 {
87 /***
88 * Gets the parsed servlet request.
89 *
90 * @return the parsed servlet request or null.
91 */
92 public HttpServletRequest getRequest();
93
94 /***
95 * Sets the servlet request to be parser. This requires a
96 * valid HttpServletRequest object. It will attempt to parse out
97 * the GET/POST/PATH_INFO data and store the data into a Hashtable.
98 * There are convenience methods for retrieving the data as a
99 * number of different datatypes. The PATH_INFO data must be a
100 * URLEncoded() string.
101 *
102 * <p>To add name/value pairs to this set of parameters, use the
103 * <code>add()</code> methods.
104 *
105 * @param req An HttpServletRequest.
106 */
107 public void setRequest(HttpServletRequest req);
108
109 /***
110 * Sets the uploadData byte[]
111 *
112 * @param uploadData A byte[] with data.
113 */
114 public void setUploadData(byte[] uploadData);
115
116 /***
117 * Gets the uploadData byte[]
118 *
119 * @return uploadData A byte[] with data.
120 */
121 public byte[] getUploadData();
122
123
124 /***
125 * Add a FileItem object as a parameters. If there are any
126 * FileItems already associated with the name, append to the
127 * array. The reason for this is that RFC 1867 allows multiple
128 * files to be associated with single HTML input element.
129 *
130 * @param name A String with the name.
131 * @param value A FileItem with the value.
132 */
133 public void append(String name, FileItem value);
134
135
136 /***
137 * Return a FileItem object for the given name. If the name does
138 * not exist or the object stored is not a FileItem, return null.
139 *
140 * @param name A String with the name.
141 * @return A FileItem.
142 */
143 public FileItem getFileItem(String name);
144
145 /***
146 * Return an array of FileItem objects for the given name. If the
147 * name does not exist or the object stored is not a FileItem
148 * array, return null.
149 *
150 * @param name A String with the name.
151 * @return A FileItem[].
152 */
153 public FileItem[] getFileItems(String name);
154 }
This page was automatically generated by Maven