Package org.wiztools.restclient.bean

Examples of org.wiztools.restclient.bean.ReqResBean


                if(archiveFile == null){
                    JOptionPane.showMessageDialog(ui.getFrame(),
                            "Please select a file!", "Error", JOptionPane.ERROR_MESSAGE);
                    return;
                }
                ReqResBean req_res = Util.getReqResArchive(archiveFile);
                request = req_res.getRequestBean();
                response = req_res.getResponseBean();
            }
            else{
                request = view.getLastRequest();
                response = view.getLastResponse();
                if(request == null || response == null){
View Full Code Here


    }
   
    public static void openArchive(final RESTView view, final File f) {
        Exception e = null;
        try{
            ReqResBean encp = Util.getReqResArchive(f);
            Request request = encp.getRequestBean();
            Response response = encp.getResponseBean();
            if(request != null && response != null){
                view.setUIFromRequest(request);
                view.setUIFromResponse(response);
            }
            else{
View Full Code Here

    private static final int BUFF_SIZE = 1024 * 4;
   
    public static ReqResBean getReqResArchive(File zipFile)
            throws FileNotFoundException, IOException, XMLException {
        ReqResBean encpBean = new ReqResBean();
        // BufferedOutputStream dest = null;
        FileInputStream fis = new FileInputStream(zipFile);
        ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
        ZipEntry entry;
        try{
            boolean isReqRead = false;
            boolean isResRead = false;
            while ((entry = zis.getNextEntry()) != null) {
                int count;
                byte data[] = new byte[BUFF_SIZE];
                File tmpFile = File.createTempFile(entry.getName(), "");
                try{
                    FileOutputStream fos = new FileOutputStream(tmpFile);
                    BufferedOutputStream dest = new BufferedOutputStream(fos, BUFF_SIZE);
                    while ((count = zis.read(data, 0, BUFF_SIZE)) != -1) {
                        dest.write(data, 0, count);
                    }
                    dest.flush();
                    dest.close();

                    if (entry.getName().equals("request.rcq")) {
                        Request reqBean = XMLUtil.getRequestFromXMLFile(tmpFile);
                        encpBean.setRequestBean(reqBean);
                        isReqRead = true;
                    }
                    else if(entry.getName().equals("response.rcs")){
                        Response resBean = XMLUtil.getResponseFromXMLFile(tmpFile);
                        encpBean.setResponseBean(resBean);
                        isResRead = true;
                    }
                }
                finally{
                    tmpFile.delete();
View Full Code Here

TOP

Related Classes of org.wiztools.restclient.bean.ReqResBean

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.