01: /*
02: HttpdBase4J: An embeddable Java web server framework that supports HTTP, HTTPS,
03: templated content and serving content from inside a jar or archive.
04: Copyright (C) 2007 Donald Munro
05:
06: This library is free software; you can redistribute it and/or
07: modify it under the terms of the GNU Lesser General Public
08: License as published by the Free Software Foundation; either
09: version 2.1 of the License, or (at your option) any later version.
10:
11: This library is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: Lesser General Public License for more details.
15:
16: You should have received a copy of the GNU Lesser General Public
17: License along with this library; if not,see http://www.gnu.org/licenses/lgpl.txt
18: */
19:
20: package net.homeip.donaldm.httpdbase4j;
21:
22: import java.io.File;
23:
24: import com.sun.net.httpserver.HttpExchange;
25:
26: /**
27: * An interface that must be implemented by classes processing POST requests.
28: * @see Httpd#addPostHandler
29: * @author Donald Munro
30: */
31: public interface Postable
32: //=======================
33: {
34: /**
35: * Called when the server is about to perform a POST. May be used by an
36: * overiding class to generate dynamic content. The overiding class should
37: * return a new File or if it does not handle the post then it should
38: * return null. The resulting file will be processed as a GET request,
39: * @param id Unique transaction id
40: * @param ex The HttpExchange instance for this request.
41: * @param request The Request
42: * @param response Response instance
43: * @param dir - Directory where output can be created
44: * @param extraParameters Extra parameters that can be used by overiding
45: * classes
46: * @return return either an HttpResponse instance or a new File instance
47: * within the base directory structure of the Httpd instance. If a File is
48: * returned it will be processed as a GET request.
49: */
50: public Object onHandlePost(long id, HttpExchange ex,
51: Request request, HttpResponse response, File dir,
52: Object... extraParameters);
53: }
|