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.properties.PropertyService"/>
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
        clientHelper = ClientViewHelper.clientViewHelperInstance(request);
21

    
22
        contentType = request.getContentType();
23
        message = "";
24
        if (contentType != null &amp;&amp; (contentType.indexOf("multipart/form-data") > -1)) {
25
            //*** Process request here if a file update.
26
            //*** Init the MultipartParser.
27
            sizeLimit = (new Integer(PropertyService.getProperty("replication.datafilesizelimit"))).intValue();
28
            multipartParser = new MultipartParser(request, sizeLimit * 1024 * 1024);
29
            message = clientHelper.handleFileUpdate(multipartParser);
30
        } else {
31
            message = clientHelper.clientRequest(request, response);
32
        }
33
        newUrl = clientHelper.makeRedirectUrl();
34
        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
    </jsp:scriptlet>
41
</jsp:root>
(1-1/34)