Project

General

Profile

1 3374 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 3374 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
        String                                              message;
14
        String                                              contentType, posted_ldapUserName;
15
16
        private ClientViewHelper                            clientHelper;
17
        private MultipartParser                             multipartParser;
18
        private int                                         sizeLimit;
19 3394 barteau
        private String                                      contenType;
20 3374 barteau
    </jsp:declaration>
21
22
    <jsp:scriptlet>
23 4173 daigle
        sizeLimit = (new Integer(PropertyService.getProperty("replication.datafilesizelimit"))).intValue();
24 3374 barteau
        clientHelper = ClientViewHelper.clientViewHelperInstance(request);
25
26
        contentType = request.getContentType();
27
        message = "";
28
        //*** Only process request if a file upload.
29
        if (clientHelper.isLoggedIn()) {
30 3394 barteau
            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 3374 barteau
        } else {
38 3394 barteau
            message = "You need to be logged in.";
39 3374 barteau
        }
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>