Project

General

Profile

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
    <jsp:directive.page import="edu.ucsb.nceas.metacat.MetaCatUtil"/>
7
    <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
        sizeLimit = (new Integer(MetaCatUtil.getOption("datafilesizelimit"))).intValue();
21
        clientHelper = ClientViewHelper.clientViewHelperInstance(request);
22 3484 barteau
23 3454 barteau
        contentType = request.getContentType();
24
        message = "";
25 3484 barteau
        if (contentType != null &amp;&amp; contentType.contains("multipart/form-data")) {
26
            //*** Process request here if a file update.
27
            //*** Init the MultipartParser.
28
            multipartParser = new MultipartParser(request, sizeLimit * 1024 * 1024);
29
            message = clientHelper.handleFileUpdate(multipartParser);
30 3454 barteau
        } else {
31 3484 barteau
            //*** Process request here if a delete.
32
            message = clientHelper.clientRequest(request, response);
33 3454 barteau
        }
34
        newUrl = clientHelper.makeRedirectUrl();
35 3484 barteau
        if (newUrl != null) {
36
            response.setContentType("text/html;charset=UTF-8");
37
            response.sendRedirect("../../" + newUrl);
38
        }
39
40
        System.out.println("ClientViewHelper.jspx: " + message);
41 3454 barteau
    </jsp:scriptlet>
42
</jsp:root>