Package com.ibm.xsp

Examples of com.ibm.xsp.FacesExceptionEx


    public String buildHref(String path, Endpoint bean) {
        try {
            // Encode path URL for spaces & special characters
            path = URLEncoding.encodeURIString(path, null, 0, false);
        } catch (IOException e) {
            throw new FacesExceptionEx(e, "Failed to encode URI string: {0}", path);
        }
        String href = ExtLibUtil.concatPath(getDropBoxApiVersion(bean), "files/dropbox", '/');
        href = ExtLibUtil.concatPath(href, path, '/');
        return href;
    }
View Full Code Here


            params.put("path", folderName);

            svc.post(getDropBoxApiVersion(endpoint)+"/fileops/create_folder", params,null);
           
        } catch (ClientServicesException e) {
            throw new FacesExceptionEx(e, "Failed to create folder named \'{0}\'", folderName);
        }
    }
View Full Code Here

            ClientService svc = createClientService(authBean, ExtLibUtil.concatPath(getDropBoxApiVersion(authBean), "fileops/delete", '/'));

            svc.post(getDropBoxApiVersion(authBean)+"/fileops/delete", params,null);

        } catch (ClientServicesException e) {
            throw new FacesExceptionEx(e, "Failed to delete file with ID \'{0}\'", rowId);
        } catch (UnsupportedEncodingException e) {
            throw new FacesExceptionEx(e, "Failed to delete file with ID \'{0}\'", rowId);
        }

    }
View Full Code Here

                    proxyUrl = proxyUrl + TYPE;
                }
                entry.setProxyURL(proxyUrl);
                entry.setUniqueId(entry.getPath());
            } catch (Exception e) {
                throw new FacesExceptionEx(e);
            }
            entries.add(entry);
        }
        return entries;
    }
View Full Code Here

            HandlerInputStream handler = new HandlerInputStream();
            Object file;
            try {
                file =  svc.get(href,handler).getData();
            } catch (ClientServicesException e) {
                throw new FacesExceptionEx(e, "Failed to execute proxy request");
            }
           
            servletResponse.setContentType(request.getParameter("mimeType"));
           
            String nameUTF8 = URLEncoder.encode(request.getParameter("path"),"utf-8");//$NON-NLS-1$
View Full Code Here

     * java.util.HashMap)
     */
    public void uploadFile(Endpoint authBean, File serverFile, FileServiceData dataSource, HashMap<String, String> params) throws CloneNotSupportedException {
        String name = params.get("file");
        if(StringUtil.isEmpty(name)){
            throw new FacesExceptionEx(new NullPointerException(), "Name of file being uploaded may not be null");
        }
       
        int dot = name.lastIndexOf('.');
        String ext = null;
        if(dot > -1){
            ext = name.substring(dot + 1); //add one for the dot!
        }
        if(StringUtil.isEmpty(ext)){
            throw new FacesExceptionEx(new NullPointerException(), "Extension of file being uploaded may not be null");
        }
        try {
            final String uploadUrl = "/files_put/dropbox/";
            String path = dataSource.getCurrentDirectory();
            if(StringUtil.isNotEmpty(path)){
                name = ExtLibUtil.concatPath(path, name, '/');
            }
            name = ExtLibUtil.concatPath(uploadUrl, name, '/');
            String uploadURL = getDropBoxApiVersion(authBean) + name;
            DropboxService svc = (DropboxService)createClientService(authBean, uploadURL);
            svc.setMimeForUpload(MIME.getMIMETypeFromExtension(ext));           
           
            svc.post(uploadURL, params, null, serverFile,null);
           
        } catch (ClientServicesException e) {
            throw new FacesExceptionEx(e);
        }
    }
View Full Code Here

            try {
              file = svc.get(serviceUrl,inputStream).getData();

            } catch (ClientServicesException e) {
                throw new FacesExceptionEx(e, "Failed to perform proxy request");
            }

            servletResponse.setContentType(request.getParameter("mimeType"));
           
            String nameUTF8 = URLEncoder.encode(request.getParameter("fileName"),"utf-8");//$NON-NLS-1$
View Full Code Here

    String ext = null;
    if (dot > -1) {
        ext = name.substring(dot + 1); // add one for the dot!
    }
    if (StringUtil.isEmpty(ext)) {
        throw new FacesExceptionEx(new NullPointerException(), "Extension of file being uploaded may not be null");
    }
   
    FileService svc = new FileService();
   
    FileCreationParameters p = new FileCreationParameters();
        p.visibility = FileCreationParameters.Visibility.PUBLIC;
        InputStream is;

       try {
       
          is = new FileInputStream(serverFile);
      com.ibm.sbt.services.client.connections.files.File entry = svc.uploadFile(is,name, serverFile.length(),p.buildParameters());
        
    }catch (ClientServicesException e) {
            throw new FacesExceptionEx(e);
        } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
      
View Full Code Here

        try {
            authenticate(accessor);
            ClientService svc = createClientService(authBean, deleteURL);
            svc.delete(deleteURL);
        } catch (ClientServicesException e) {
            throw new FacesExceptionEx(e);
        }
    }
View Full Code Here

          
            try {
                file =  svc.get("files/basic/cmis/repository/"+href).getData();
               
            } catch (ClientServicesException e) {
                throw new FacesExceptionEx(e, "Failed to perform proxy request");
            }

            String nameUTF8 = URLEncoder.encode(request.getParameter("fileName"),"utf-8");//$NON-NLS-1$
            nameUTF8 = nameUTF8.replaceAll("\\+", "%20");//$NON-NLS-1$ //$NON-NLS-2$
           
View Full Code Here

TOP

Related Classes of com.ibm.xsp.FacesExceptionEx

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.