import net.sf.sahi.response.SimpleHttpResponse;
import net.sf.sahi.util.URLParser;
public class LocalRequestProcessor {
public HttpResponse getLocalResponse(String uri, HttpRequest requestFromBrowser) throws Exception {
HttpResponse httpResponse = new NoCacheHttpResponse("");
if (uri.indexOf("/dyn/pro/") != -1) {
// httpResponse = handleDyn(uri, requestFromBrowser, httpResponse, true);
httpResponse = new SimpleHttpResponse("This feature is available only in Sahi Pro");
} else if (uri.indexOf("/dyn/") != -1) {
httpResponse = handleDyn(uri, requestFromBrowser, httpResponse, false);
} else if (uri.indexOf("/scripts/") != -1) {
String fileName = URLParser.scriptFileNamefromURI(
requestFromBrowser.uri(), "/scripts/");
httpResponse = new HttpFileResponse(fileName, null, false, false);
} else if (uri.indexOf("/spr/") != -1) {
String fileName = URLParser.fileNamefromURI(requestFromBrowser.uri());
httpResponse = new HttpFileResponse(fileName, null, true, true);
} else if (uri.indexOf("/sprm/") != -1) {
String fileName = URLParser.fileNamefromURI(requestFromBrowser.uri().replace("/sprm/", "/spr/"));
httpResponse = new HttpModifiedResponse2(new HttpFileResponse(fileName, null, true, true), requestFromBrowser.isSSL(), requestFromBrowser.fileExtension());
} else if (uri.indexOf("/logs") != -1) {
httpResponse = new NoCacheHttpResponse(LogViewer.getLogsList(Configuration.getPlayBackLogsRoot()));
} else {
httpResponse = new HttpFileResponse(Configuration.getHtdocsRoot() + "/spr/launch.htm");
}
return httpResponse;
}