/** * Returns a copy of the headers to be sent with this request. * @return the dictionary of headers **/ public Dictionary getHeaders() { return (Dictionary) getHeaderDictionary().clone(); }
/** * Sets the value of a header to be sent with this request. A header set here will override any matching header set * in the WebClient when the request is actually sent. * @param headerName - the name of the header * @param headerValue - the value to be set */ public void setHeaderField( String headerName, String headerValue ) { getHeaderDictionary().put( headerName, headerValue ); }
/** * Sets the value of a header to be sent with this request. A header set here will override any matching header set * in the WebClient when the request is actually sent. * @param headerName - the name of the header * @param headerValue - the value to be set */ public void setHeaderField( String headerName, String headerValue ) { getHeaderDictionary().put( headerName, headerValue ); }
/** * Returns a copy of the headers to be sent with this request. * @return the dictionary of headers **/ public Dictionary getHeaders() { return (Dictionary) getHeaderDictionary().clone(); }
/** * Sets the value of a header to be sent with this request. A header set here will override any matching header set * in the WebClient when the request is actually sent. * @param headerName - the name of the header * @param headerValue - the value to be set */ public void setHeaderField( String headerName, String headerValue ) { getHeaderDictionary().put( headerName, headerValue ); }
/** * Returns a copy of the headers to be sent with this request. * @return the dictionary of headers **/ public Dictionary getHeaders() { return (Dictionary) getHeaderDictionary().clone(); }
/** * 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 ) ); // [ 1518901 ] enable http connect and read timeouts (needs JDK 1.5) // XXX enable for 1.7 release in 2008 // comment out if you need this and have JDK 1.5 // if (_connectTimeout>=0) connection.setConnectTimeout( _connectTimeout ); // if (_readTimeout>=0) connection.setReadTimeout( _readTimeout ); 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 ); } }
/** * 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 ) ); // [ 1518901 ] enable http connect and read timeouts (needs JDK 1.5) // XXX enable for 1.7 release in 2008 // comment out if you need this and have JDK 1.5 // if (_connectTimeout>=0) connection.setConnectTimeout( _connectTimeout ); // if (_readTimeout>=0) connection.setReadTimeout( _readTimeout ); 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 ); } }
/** * 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 ) ); // [ 1518901 ] enable http connect and read timeouts (needs JDK 1.5) // XXX enable for 1.7 release in 2008 // comment out if you need this and have JDK 1.5 // if (_connectTimeout>=0) connection.setConnectTimeout( _connectTimeout ); // if (_readTimeout>=0) connection.setReadTimeout( _readTimeout ); 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 ); } }