1 |
3454
|
barteau
|
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
|
|
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
|
3 |
|
|
|
4 |
|
|
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
|
5 |
|
|
<jsp:directive.page import="com.oreilly.servlet.multipart.MultipartParser"/>
|
6 |
4080
|
daigle
|
<jsp:directive.page import="edu.ucsb.nceas.metacat.service.PropertyService"/>
|
7 |
3454
|
barteau
|
<jsp:directive.page import="java.io.*"/>
|
8 |
|
|
<jsp:directive.page import="javax.servlet.*"/>
|
9 |
|
|
<jsp:directive.page import="javax.servlet.http.*"/>
|
10 |
|
|
<jsp:directive.page import="edu.ucsb.nceas.metacat.clientview.ClientViewHelper"/>
|
11 |
|
|
|
12 |
|
|
<jsp:declaration>
|
13 |
3484
|
barteau
|
private String message, newUrl, contentType;
|
14 |
3454
|
barteau
|
private ClientViewHelper clientHelper;
|
15 |
|
|
private MultipartParser multipartParser;
|
16 |
|
|
private int sizeLimit;
|
17 |
|
|
</jsp:declaration>
|
18 |
|
|
|
19 |
|
|
<jsp:scriptlet>
|
20 |
|
|
clientHelper = ClientViewHelper.clientViewHelperInstance(request);
|
21 |
3484
|
barteau
|
|
22 |
3454
|
barteau
|
contentType = request.getContentType();
|
23 |
|
|
message = "";
|
24 |
3676
|
barteau
|
if (contentType != null && (contentType.indexOf("multipart/form-data") > -1)) {
|
25 |
3484
|
barteau
|
//*** Process request here if a file update.
|
26 |
|
|
//*** Init the MultipartParser.
|
27 |
4173
|
daigle
|
sizeLimit = (new Integer(PropertyService.getProperty("replication.datafilesizelimit"))).intValue();
|
28 |
3484
|
barteau
|
multipartParser = new MultipartParser(request, sizeLimit * 1024 * 1024);
|
29 |
|
|
message = clientHelper.handleFileUpdate(multipartParser);
|
30 |
3454
|
barteau
|
} else {
|
31 |
3484
|
barteau
|
message = clientHelper.clientRequest(request, response);
|
32 |
3454
|
barteau
|
}
|
33 |
|
|
newUrl = clientHelper.makeRedirectUrl();
|
34 |
3484
|
barteau
|
if (newUrl != null) {
|
35 |
|
|
response.setContentType("text/html;charset=UTF-8");
|
36 |
|
|
response.sendRedirect("../../" + newUrl);
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
System.out.println("ClientViewHelper.jspx: " + message);
|
40 |
3454
|
barteau
|
</jsp:scriptlet>
|
41 |
|
|
</jsp:root>
|