/** Creates a web response object which represents the response to the specified web request. */ protected WebResponse newResponse(WebRequest request, FrameSelector targetFrame) throws MalformedURLException, IOException { Properties savedProperties = (Properties) System.getProperties().clone(); try { if (_proxyHost != null) { System.setProperty("proxyHost", _proxyHost); System.setProperty("proxyPort", Integer.toString(_proxyPort)); } URLConnection connection = openConnection(getRequestURL(request)); if (HttpUnitOptions.isLoggingHttpHeaders()) { String urlString = request.getURLString(); System.out.println("\nConnecting to " + request.getURL().getHost()); System.out.println("Sending:: " + request.getMethod() + " " + urlString); } sendHeaders(connection, getHeaderFields(request.getURL())); sendHeaders(connection, request.getHeaderDictionary()); request.completeRequest(connection); return new HttpWebResponse( this, targetFrame, request, connection, getExceptionsThrownOnErrorStatus()); } finally { System.setProperties(savedProperties); } }
private String getMethod() { return null == _request ? null : _request.getMethod(); }