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
        String                                              message;
14
        String                                              contentType, posted_ldapUserName;
15

    
16
        private ClientViewHelper                            clientHelper;
17
        private MultipartParser                             multipartParser;
18
        private int                                         sizeLimit;
19
        private String                                      contenType;
20
    </jsp:declaration>
21
    
22
    <jsp:scriptlet>
23
        sizeLimit = (new Integer(MetaCatUtil.getOption("datafilesizelimit"))).intValue();
24
        clientHelper = ClientViewHelper.clientViewHelperInstance(request);
25
        
26
        contentType = request.getContentType();
27
        message = "";
28
        //*** Only process request if a file upload.
29
        if (clientHelper.isLoggedIn()) {
30
            if (contentType != null &amp;&amp; contentType.contains("multipart/form-data")) {
31
                //*** Init the MultipartParser.
32
                multipartParser = new MultipartParser(request, sizeLimit * 1024 * 1024);
33
                message = clientHelper.handleFileUpdate(multipartParser);
34
            } else {
35
                message = clientHelper.clientRequest(request, response);
36
            }
37
        } else {
38
            message = "You need to be logged in.";
39
        }
40
        response.setContentType("text/html;charset=UTF-8");
41
    </jsp:scriptlet>
42
    
43
    <html xmlns="http://www.w3.org/1999/xhtml">
44
        <head>
45
        </head>
46
        <body>
47
            <p>
48
                message = <jsp:expression>message</jsp:expression>
49
            </p>
50
            Press the BACK button to return.
51
        </body>
52
    </html>
53
    
54
</jsp:root>
(1-1/3)