Package org.wiztools.restclient

Examples of org.wiztools.restclient.Request


        else{
            for(String param: params){
                File f = new File(param);
                if(f.canRead()){
                    try{
                        Request request = XMLUtil.getRequestFromXMLFile(f);
                        View view = new CliView(outDir, f);
                        // Execute:
                        RequestExecuter executer = Implementation.of(RequestExecuter.class);
                        executer.execute(request, view);
                    }
View Full Code Here


        c.add(jp_south, BorderLayout.SOUTH);
    }
   
    private void jb_nextAction(){
        try{
            Request request = null;
            Response response = null;
            if(jrb_archive.isSelected()){
                if(archiveFile == null){
                    JOptionPane.showMessageDialog(ui.getFrame(),
                            "Please select a file!", "Error", JOptionPane.ERROR_MESSAGE);
View Full Code Here

    private void jmi_open_reqAction(){
        File f = getOpenFile(FileChooserType.OPEN_REQUEST);
        if(f != null){
            Exception e = null;
            try{
                Request request = XMLUtil.getRequestFromXMLFile(f);
                view.setUIFromRequest(request);
            }
            catch(IOException ex){
                e = ex;
            }
View Full Code Here

        File f = getOpenFile(FileChooserType.OPEN_ARCHIVE);
        if(f != null){
            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);
                }
View Full Code Here

        return true;
    }
   
    private void actionSave(final FileChooserType type){
        if(type == FileChooserType.SAVE_REQUEST){
            Request request = view.getLastRequest();

            if(request == null){
                JOptionPane.showMessageDialog(view,
                        "No last request available.",
                        "No Request",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }

            Request uiRequest = view.getRequestFromUI();
            if(!request.equals(uiRequest)){
                if(!doSaveEvenIfUIChanged(DO_SAVE_UI_REQUEST)){
                    return;
                }
            }

            File f = getSaveFile(FileChooserType.SAVE_REQUEST);
            if(f != null){
                try{
                    XMLUtil.writeRequestXML(request, f);
                }
                catch(IOException ex){
                    view.showError(Util.getStackTrace(ex));
                }
                catch(XMLException ex){
                    view.showError(Util.getStackTrace(ex));
                }
            }
        }
        else if(type == FileChooserType.SAVE_RESPONSE){
            Response response = view.getLastResponse();
            if(response == null){
                JOptionPane.showMessageDialog(view,
                        "No last response available.",
                        "No Response",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            Response uiResponse = view.getResponseFromUI();
            if(!response.equals(uiResponse)){
                if(!doSaveEvenIfUIChanged(DO_SAVE_UI_RESPONSE)){
                    return;
                }
            }
            File f = getSaveFile(FileChooserType.SAVE_RESPONSE);
            if(f != null){
                try{
                    XMLUtil.writeResponseXML(response, f);
                }
                catch(IOException ex){
                    view.showError(Util.getStackTrace(ex));
                }
                catch(XMLException ex){
                    view.showError(Util.getStackTrace(ex));
                }
            }
        }
        else if(type == FileChooserType.SAVE_RESPONSE_BODY){
            Response response = view.getLastResponse();
            if(response == null){
                JOptionPane.showMessageDialog(view,
                        "No last response available.",
                        "No Response",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            File f = getSaveFile(FileChooserType.SAVE_RESPONSE_BODY);
            if(f != null){
                PrintWriter pw = null;
                try{
                    pw = new PrintWriter(new FileWriter(f));
                    pw.print(response.getResponseBody());
                }
                catch(IOException ex){
                    view.showError(Util.getStackTrace(ex));
                }
                finally{
                    if(pw != null){
                        pw.close();
                    }
                }
            }
        }
        else if(type == FileChooserType.SAVE_ARCHIVE){
            Request request = view.getLastRequest();
            Response response = view.getLastResponse();
            if(request == null || response == null){
                JOptionPane.showMessageDialog(view,
                        "No last request/response available.",
                        "No Request/Response",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            Request uiRequest = view.getRequestFromUI();
            Response uiResponse = view.getResponseFromUI();
            if((!request.equals(uiRequest)) || (!response.equals(uiResponse))){
                if(!doSaveEvenIfUIChanged(DO_SAVE_UI_ARCHIVE)){
                    return;
                }
View Full Code Here

TOP

Related Classes of org.wiztools.restclient.Request

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.