Project

General

Profile

« Previous | Next » 

Revision 6059

use outputstream as an object, not a string. relax the Map typing to allow for mixed values. (sanparks patch)

View differences:

ClientViewHelper.java
20 20
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
21 21
import edu.ucsb.nceas.metacat.properties.PropertyService;
22 22
import edu.ucsb.nceas.metacat.service.SessionService;
23
import edu.ucsb.nceas.metacat.util.RequestUtil;
24 23
import edu.ucsb.nceas.metacat.util.SessionData;
25 24
import edu.ucsb.nceas.utilities.XMLUtilities;
26 25
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
......
126 125
    public String clientRequest(HttpServletRequest request, HttpServletResponse response)  {
127 126
        String                              result = null, action, contentType;
128 127
        MultipartParser                     multipartParser;
129
        HashMap<String, String>             responseMap;
128
        HashMap<String, Object>             responseMap;
130 129
        
131 130
        getMetacatClient().setSessionId(request.getSession().getId());
132 131
        
......
180 179
                        multipartParser = new MultipartParser(request, sizeLimit * 1024 * 1024);
181 180
                        responseMap = handleClientRequest(multipartParser);
182 181
                    } catch (IOException ex) {
183
                        responseMap = new HashMap<String, String>();
182
                        responseMap = new HashMap<String, Object>();
184 183
                        responseMap.put("message", ex.getMessage());
185 184
                    }
186 185
                    clientViewBean.setAction("");
......
189 188
                    try {
190 189
                        handleDownloadResponse(responseMap, response);
191 190
                    } catch (IOException ex) {
192
                        responseMap = new HashMap<String, String>();
191
                        responseMap = new HashMap<String, Object>();
193 192
                        responseMap.put("message", ex.getMessage());
194 193
                    }
195 194
                    
......
218 217
     * the action is Download, than this will contain all needed values
219 218
     * to pass to handleDownloadResponse.
220 219
     */
221
    public HashMap<String, String> handleClientRequest(MultipartParser multipartParser)  {
220
    public HashMap<String, Object> handleClientRequest(MultipartParser multipartParser)  {
222 221
        String                              result = "", serverResponse;
223 222
        String                              posted_ldapUserName, tmp, action;
224
        HashMap<String, String>             responseMap = new HashMap<String, String>();
223
        HashMap<String, Object>             responseMap = new HashMap<String, Object>();
225 224
        
226 225
        
227 226
        if (clientViewBean != null) {
......
1019 1018
        return(result);
1020 1019
    }
1021 1020
    
1022
    private HashMap<String, String> download(ClientView bean) {
1021
    private HashMap<String, Object> download(ClientView bean) {
1023 1022
        Properties                      args;
1024 1023
        InputStream                     inStream;
1025 1024
        String                          docId, metaId, fNm = null, pth, txtLst[];
......
1027 1026
        Node                            branchRoot, metaRoot;
1028 1027
        ByteArrayOutputStream           outStream;
1029 1028
        int                             intMe;
1030
        HashMap<String, String>         responseMap = new HashMap<String, String>();
1029
        HashMap<String, Object>         responseMap = new HashMap<String, Object>();
1031 1030
        
1032 1031
        docId = bean.getDocId();
1033 1032
        metaId = bean.getMetaFileDocId();
......
1106 1105
                }
1107 1106
                
1108 1107
                //*** Now, write the output stream to the response.
1109
                responseMap.put("outputStream", outStream.toString());
1108
                responseMap.put("outputStream", outStream);
1110 1109
                
1111 1110
                //*** Finally, set the message for the user interface to display.
1112 1111
                msg = msg.replaceFirst("~", fNm);

Also available in: Unified diff