2009-05-17 18:46:05 +00:00
|
|
|
package zutil.test;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
2009-05-18 12:52:16 +00:00
|
|
|
import java.util.Map;
|
2009-05-17 18:46:05 +00:00
|
|
|
|
2011-02-15 19:37:04 +00:00
|
|
|
import zutil.net.http.HttpPage;
|
|
|
|
|
import zutil.net.http.HttpPrintStream;
|
|
|
|
|
import zutil.net.http.HttpServer;
|
2009-05-17 18:46:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class HTTPUploaderTest implements HttpPage{
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException{
|
|
|
|
|
HttpServer server = new HttpServer("localhost", 80);
|
|
|
|
|
server.setDefaultPage(new HTTPUploaderTest());
|
|
|
|
|
server.run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void respond(HttpPrintStream out,
|
2009-05-18 12:52:16 +00:00
|
|
|
Map<String, String> client_info,
|
|
|
|
|
Map<String, Object> session,
|
|
|
|
|
Map<String, String> cookie,
|
|
|
|
|
Map<String, String> request) {
|
2009-05-17 18:46:05 +00:00
|
|
|
|
|
|
|
|
if(!session.containsKey("file1")){
|
|
|
|
|
out.println("</html>" +
|
|
|
|
|
" <form enctype='multipart/form-data' method='post'>" +
|
|
|
|
|
" <p>Please specify a file, or a set of files:<br>" +
|
|
|
|
|
" <input type='file' name='datafile' size='40'>" +
|
|
|
|
|
" </p>" +
|
|
|
|
|
" <input type='submit' value='Send'>" +
|
|
|
|
|
" </form>" +
|
|
|
|
|
"</html>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|