/** * Returns the URL of the codebase used to find the applet classes */ public URL getCodeBaseURL() throws MalformedURLException { return new URL( _response.getURL(), getCodeBase() ); }
public String toString() { StringBuffer sb = new StringBuffer( "HttpWebResponse [url=" ); sb.append( getURL() ).append( "; headers=" ); for (Enumeration e = _headers.keys(); e.hasMoreElements(); ) { Object key = e.nextElement(); String[] values = (String[]) _headers.get( key ); for (int i = 0; i < values.length; i++) { sb.append( "\n " ).append( key ).append( ": " ).append( values[i] ); } } sb.append( " ]" ); return sb.toString(); }
/** * Returns the URL of the codebase used to find the applet classes */ public URL getCodeBaseURL() throws MalformedURLException { return new URL( _response.getURL(), getCodeBase() ); }
/** * Returns the URL of the codebase used to find the applet classes */ public URL getCodeBaseURL() throws MalformedURLException { return new URL( _response.getURL(), getCodeBase() ); }
/** * open a a new Window with the given name and relative URL * @param name - the name of the window * @param relativeUrl - the relative URL to be used * @return the WebResponse as a DomWindowProxy */ public DomWindowProxy openNewWindow( String name, String relativeUrl ) throws IOException, SAXException { if (relativeUrl == null || relativeUrl.trim().length() == 0) relativeUrl = "about:"; GetMethodWebRequest request = new GetMethodWebRequest( getURL(), relativeUrl, _frame, name ); WebResponse response=_window.getResponse( request ); return response; }
/** * open a a new Window with the given name and relative URL * @param name - the name of the window * @param relativeUrl - the relative URL to be used * @return the WebResponse as a DomWindowProxy */ public DomWindowProxy openNewWindow( String name, String relativeUrl ) throws IOException, SAXException { if (relativeUrl == null || relativeUrl.trim().length() == 0) relativeUrl = "about:"; GetMethodWebRequest request = new GetMethodWebRequest( getURL(), relativeUrl, _frame, name ); WebResponse response=_window.getResponse( request ); return response; }
private void find(Document tree, WebResponse r, String xpath, String attr) throws MalformedURLException { for( Element e : (List<Element>)tree.selectNodes(xpath) ) { String src = e.attributeValue(attr); if(src==null) continue; addResource(new URL(r.getURL(), src)); } }
/** * Moves to the URL of the folder if necessary */ private void setCurrentPage() throws IOException, SAXException, ProcessingException { if( getCurrentPage().getURL().toExternalForm().equals(url) ) return; goTo(url); }
/** * open a a new Window with the given name and relative URL * @param name - the name of the window * @param relativeUrl - the relative URL to be used * @return the WebResponse as a DomWindowProxy */ public DomWindowProxy openNewWindow( String name, String relativeUrl ) throws IOException, SAXException { if (relativeUrl == null || relativeUrl.trim().length() == 0) relativeUrl = "about:"; GetMethodWebRequest request = new GetMethodWebRequest( getURL(), relativeUrl, _frame, name ); WebResponse response=_window.getResponse( request ); return response; }
String getCookieHeader() { return _client.getCookieJar().getCookieHeaderField( getURL() ); }
/** * Constructs a web request using a base URL, a relative URL string, and a target. **/ protected WebRequest( WebResponse referer, Element sourceElement, URL urlBase, String urlString, String target ) { this( urlBase, urlString, referer.getFrame(), target != null ? target : referer.getBaseTarget() ); _sourceElement = sourceElement; _referringPage = referer; setHeaderField( REFERER_HEADER_NAME, referer.getURL().toExternalForm() ); }
public DomWindowProxy submitRequest( HTMLElementImpl sourceElement, String method, String location, String target, MessageBody requestBody ) throws IOException, SAXException { if (method.equalsIgnoreCase( "get" )) { return getWindow().sendRequest( new GetMethodWebRequest( this, sourceElement, getURL(), location, target ) ); } else { return null; } }
/** * Constructs a web request using a base URL, a relative URL string, and a target. **/ protected WebRequest( WebResponse referer, Element sourceElement, URL urlBase, String urlString, String target ) { this( urlBase, urlString, referer.getFrame(), target != null ? target : referer.getBaseTarget() ); _sourceElement = sourceElement; _referringPage = referer; setHeaderField( REFERER_HEADER_NAME, referer.getURL().toExternalForm() ); }
public DomWindowProxy submitRequest( HTMLElementImpl sourceElement, String method, String location, String target, MessageBody requestBody ) throws IOException, SAXException { if (method.equalsIgnoreCase( "get" )) { return getWindow().sendRequest( new GetMethodWebRequest( this, sourceElement, getURL(), location, target ) ); } else { return null; } }
public DomWindowProxy submitRequest( HTMLElementImpl sourceElement, String method, String location, String target, MessageBody requestBody ) throws IOException, SAXException { if (method.equalsIgnoreCase( "get" )) { return getWindow().sendRequest( new GetMethodWebRequest( this, sourceElement, getURL(), location, target ) ); } else { return null; } }
/** * Constructs a web request using a base URL, a relative URL string, and a target. **/ protected WebRequest( WebResponse referer, Element sourceElement, URL urlBase, String urlString, String target ) { this( urlBase, urlString, referer.getFrame(), target != null ? target : referer.getBaseTarget() ); _sourceElement = sourceElement; _referringPage = referer; setHeaderField( REFERER_HEADER_NAME, referer.getURL().toExternalForm() ); }
public void produceHTML(WebResponse r, PrintStream out) throws IOException, SAXException { out.println(); Document tree = Util.getDom4j(r); find(tree, r,"//IMG|//SCRIPT", "src"); find(tree, r,"//LINK", "href"); // replpace @import in CSS for( Element style : (List<Element>)tree.selectNodes("//STYLE") ) { String text = style.getText(); findInCSS(text, r.getURL()); } out.print(r.getText()); out.println(); }
private void processBaseTag( ByteTag tag ) throws MalformedURLException { if (tag.getAttribute( "href" ) != null) _baseURL = new URL( getURL(), tag.getAttribute( "href" ) ); if (tag.getAttribute( "target" ) != null) _baseTarget = tag.getAttribute( "target" ); }
RedirectWebRequest( WebResponse response ) { super( response.getURL(), response.getHeaderField( "Location" ), response.getFrame(), response.getFrameName() ); if (response.getReferer() != null) setHeaderField( "Referer", response.getReferer() ); }
RedirectWebRequest( WebResponse response ) { super( response.getURL(), response.getHeaderField( "Location" ), response.getFrame(), response.getFrameName() ); if (response.getReferer() != null) setHeaderField( "Referer", response.getReferer() ); }