Project

General

Profile

1
<?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
        private String                                      message, newUrl, contentType;
14
        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

    
23
        contentType = request.getContentType();
24
        message = "";
25
        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
        } else {
31
            //*** Process request here if a delete.
32
            message = clientHelper.clientRequest(request, response);
33
        }
34
        newUrl = clientHelper.makeRedirectUrl();
35
        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
    </jsp:scriptlet>
42
</jsp:root>
(1-1/20)