urlTextField.setText(_request.getURL().toString());
URL url = _request.getURL(); if (url != null) { urlTextField.setText(url.toString()); } else { urlTextField.setText(""); }
    private void updateRequest(int panel) {        if (! _editable || panel < 0) {            return;        }        if (panel == 0) {// parsed text            if (_messagePanel.isModified()) {                _request = (Request) _messagePanel.getMessage();                _modified = true;                invalidatePanels();            }            // if _modified            _request.setMethod(methodTextField.getText());            try {                _request.setURL(urlTextField.getText());            } catch (Exception e) {                urlTextField.setText(_request.getURL().toString());            }            _request.setVersion(versionTextField.getText());        } else if (panel == 1) {// bean shell            _modified = true;            invalidatePanels();            _request = _beanShellPanel.getRequest();        } else if (panel == 2) { // raw text            if (_textPanel.isModified()) {                try {                    Request r = new Request();                    ByteArrayInputStream bais = new ByteArrayInputStream(_textPanel.getBytes());                    r.read(bais);                    r.getContent();                    String cl = _request.getHeader("Content-Length");                    if (cl != null) {                        byte[] content = _request.getContent(); // read the content                        if (content == null) {                            _request.setHeader("Content-Length","0"); // update the header                        } else {                            _request.setHeader("Content-Length", Integer.toString(content.length));                        }                    }                    _request = r;                } catch (Exception e) {                    System.err.println("Error parsing the rawTextArea, abandoning changes : " + e);                }                _modified = true;                invalidatePanels();            }        }        _upToDate[panel] = true;    }