1 package org.apache.turbine.services.upload;
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.services.Service;
59 import org.apache.turbine.util.ParameterParser;
60 import org.apache.turbine.util.TurbineException;
61
62 /***
63 * <p> This service handles parsing <code>multipart/form-data</code>
64 * POST requests and turing them into form fields and uploaded files.
65 * This can be either performed automatically by the {@link
66 * org.apache.turbine.util.ParameterParser} or manually by an user
67 * definded {@link org.apache.turbine.modules.Action}.
68 *
69 * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
70 * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
71 * @version $Id: UploadService.java,v 1.1.1.1 2001/08/16 05:09:25 jvanzyl Exp $
72 */
73 public interface UploadService
74 extends Service
75 {
76 /***
77 * HTTP header.
78 */
79 public static final String CONTENT_TYPE = "Content-type";
80
81 /***
82 * HTTP header.
83 */
84 public static final String CONTENT_DISPOSITION = "Content-disposition";
85
86 /***
87 * HTTP header base type.
88 */
89 public static final String MULTIPART = "multipart";
90
91 /***
92 * HTTP header base type modifier.
93 */
94 public static final String FORM_DATA = "form-data";
95
96 /***
97 * HTTP header base type modifier.
98 */
99 public static final String MIXED = "mixed";
100
101 /***
102 * HTTP header.
103 */
104 public static final String MULTIPART_FORM_DATA =
105 MULTIPART + '/' + FORM_DATA;
106
107 /***
108 * HTTP header.
109 */
110 public static final String MULTIPART_MIXED = MULTIPART + '/' + MIXED;
111
112 /***
113 * The key in the TurbineResources.properties that references this
114 * service.
115 */
116 public static final String SERVICE_NAME = "UploadService";
117
118 /***
119 * The key in UploadService properties in
120 * TurbineResources.properties 'automatic' property.
121 */
122 public static final String AUTOMATIC_KEY = "automatic";
123
124 /***
125 * <p> The default value of 'automatic' property
126 * (<code>false</code>). If set to <code>true</code>, parsing the
127 * multipart request will be performed automaticaly by {@link
128 * org.apache.turbine.util.ParameterParser}. Otherwise, an {@link
129 * org.apache.turbine.modules.Action} may decide to to parse the
130 * request by calling {@link #parseRequest(HttpServletRequest,
131 * ParameterParser, String) parseRequest} manually.
132 */
133 public static final Boolean AUTOMATIC_DEFAULT = Boolean.FALSE;
134
135 /***
136 * The request parameter name for overriding 'repository' property
137 * (path).
138 */
139 public static final String REPOSITORY_PARAMETER = "path";
140
141 /***
142 * The key in UploadService properties in
143 * TurbineResources.properties 'repository' property.
144 */
145 public static final String REPOSITORY_KEY = "repository";
146
147 /***
148 * <p> The default value of 'repository' property (.). This is
149 * the directory where uploaded fiels will get stored temporarily.
150 * Note that "." is whatever the servlet container chooses to be
151 * it's 'current directory'.
152 */
153 public static final String REPOSITORY_DEFAULT = ".";
154
155 /***
156 *w The key in UploadService properties in
157 * TurbineResources.properties 'size.max' property.
158 */
159 public static final String SIZE_MAX_KEY = "size.max";
160
161 /***
162 * <p> The default value of 'size.max' property (1 megabyte =
163 * 1048576 bytes). This is the maximum size of POST request that
164 * will be parsed by the uploader. If you need to set specific
165 * limits for your users, set this property to the largest limit
166 * value, and use an action + no auto upload to enforce limits.
167 *
168 */
169 public static final Integer SIZE_MAX_DEFAULT = new Integer(1048576);
170
171 /***
172 * The key in UploadService properties in
173 * TurbineResources.properties 'size.threshold' property.
174 */
175 public static final String SIZE_THRESHOLD_KEY = "size.threshold";
176
177 /***
178 * <p> The default value of 'size.threshold' property (10
179 * kilobytes = 10240 bytes). This is the maximum size of a POST
180 * request that will have it's components stored temporarily in
181 * memory, instead of disk.
182 */
183 public static final Integer SIZE_THRESHOLD_DEFAULT = new Integer(10240);
184
185 /***
186 * <p> This method performs parsing the request, and storing the
187 * acquired information in apropriate places.
188 *
189 * @param req The servlet request to be parsed.
190 * @param params The ParameterParser instance to insert form
191 * fields into.
192 * @param path The location where the files should be stored.
193 * @exception IOException, if there are problems reading/parsing
194 * the request or storing files.
195 */
196 public void parseRequest( HttpServletRequest req,
197 ParameterParser params,
198 String path )
199 throws TurbineException;
200
201 /***
202 * <p> Retrieves the value of <code>size.max</code> property of the
203 * {@link org.apache.turbine.services.upload.UploadService}.
204 *
205 * @return The maximum upload size.
206 */
207 public int getSizeMax();
208
209 /***
210 * <p> Retrieves the value of <code>size.threshold</code> property of
211 * {@link org.apache.turbine.services.upload.UploadService}.
212 *
213 * @return The threshold beyond which files are written directly to disk.
214 */
215 public int getSizeThreshold();
216
217 /***
218 * <p> Retrieves the value of the <code>repository</code> property of
219 * {@link org.apache.turbine.services.upload.UploadService}.
220 *
221 * @return The repository.
222 */
223 public String getRepository();
224 }
This page was automatically generated by Maven