/* this belongs to the WebRaveler package */ package webraveler.vurl; import java.io.*; import webraveler.http.HTTPRequest; import webraveler.http.HTTPResponse; import webraveler.proxy.ProxyClient; import webraveler.ravel.Raveler; /** * This VURL returns the unraveled version of a page. * * @author The Web Raveler Development Squad * @version 1.0 */ public class GetUnraveledDocumentVURL implements VURL{ /** * */ public GetUnraveledDocumentVURL () { } public HTTPResponse resolveVURL (String username, String query, HTTPRequest request, Raveler ravel) { HTTPResponse response = null; ProxyClient proxy; HTTPRequest unravelRequest = HTTPRequest.generateGetRequest(query); proxy = new ProxyClient(unravelRequest); try { response = proxy.getResponse(); }catch(IOException ioe) { return null; } //catch /* try making an HTMLPage object to represent the content, if applicable. * also, we have to make URLs absolute, using VURLs. */ String contentType; contentType = (String) response.getHeader("content-type"); if ( contentType != null && contentType.equalsIgnoreCase("text/html")) { response.htmlPage.makeURLsAbsolute(unravelRequest,response); // System.out.println("response.entityText = "+response.entityText); }//if System.out.println("GetUnraveledDocumentVURL: "+unravelRequest.uriString()+"content-type = '"+contentType+"'"); return response; } // resolveVURL } // class GetUnraveledDocumentVURL