public boolean handleRequest(HttpServletRequest httpRequest,
			HttpServletResponse httpResponse) throws ServletException,
			IOException {
		WaybackRequest wbRequest = null;
		boolean handled = false;
		try {
			PerfStats.clearAll();
			if (this.isEnablePerfStatsHeader() && (perfStatsHeader != null)) {
				PerfStats.timeStart(PerfStat.Total);
				httpResponse = new PerfWritingHttpServletResponse(httpRequest,
					httpResponse, PerfStat.Total, perfStatsHeader,
					perfStatsHeaderFormat);
			}
			String inputPath = translateRequestPathQuery(httpRequest);
			Thread.currentThread().setName("Thread " +
					Thread.currentThread().getId() + " " + getBeanName() +
					" handling: " + inputPath);
			LOGGER.fine("Handling translated: " + inputPath);
			wbRequest = getParser().parse(httpRequest, this);
			if (wbRequest != null) {
				handled = true;
				// TODO: refactor this code into RequestParser implementations
				wbRequest.setAccessPoint(this);
//				wbRequest.setContextPrefix(getAbsoluteLocalPrefix(httpRequest));
//				wbRequest.setContextPrefix(getUrlRoot());
				wbRequest.extractHttpRequestInfo(httpRequest);
				// end of refactor
				if (getAuthentication() != null) {
					if (!getAuthentication().isTrue(wbRequest)) {
						throw new AuthenticationControlException(
							"Unauthorized", isRequestAuth());
					}
				}
				// set exclusionFilter on wbRequest only if not set externally
				if (wbRequest.getExclusionFilter() == null) {
					wbRequest.setExclusionFilter(createExclusionFilter());
				}
				// TODO: refactor this into RequestParser implementations, so a
				// user could alter requests to change the behavior within a
				// single AccessPoint. For now, this is a simple way to expose
				// the feature to configuration.g
				wbRequest.setExactScheme(isExactSchemeMatch());
				if (wbRequest.isReplayRequest()) {
					if (bounceToReplayPrefix) {
						// we don't accept replay requests on this AccessPoint
						// bounce the user to the right place:
						String suffix = translateRequestPathQuery(httpRequest);
						String replayUrl = replayPrefix + suffix;
						httpResponse.sendRedirect(replayUrl);
						return true;
					}
					handleReplay(wbRequest, httpRequest, httpResponse);
				} else {
					if (bounceToQueryPrefix) {
						// we don't accept replay requests on this AccessPoint
						// bounce the user to the right place:
						String suffix = translateRequestPathQuery(httpRequest);
						String replayUrl = queryPrefix + suffix;
						httpResponse.sendRedirect(replayUrl);
						return true;
					}
					wbRequest.setExactHost(isExactHostMatch());
					handleQuery(wbRequest, httpRequest, httpResponse);
				}
			} else {
				handled = dispatchLocal(httpRequest, httpResponse);
			}
		} catch (BetterRequestException e) {
			e.generateResponse(httpResponse, wbRequest);
			httpResponse.getWriter(); // cause perf headers to be committed
			handled = true;
		} catch (WaybackException e) {
			if (httpResponse.isCommitted()) {
				return true;
			}
			if (wbRequest == null) {
				wbRequest = new WaybackRequest();
				wbRequest.setAccessPoint(this);
			}
			logError(httpResponse, errorMsgHeader, e, wbRequest);
			LiveWebState liveWebState = LiveWebState.NOT_FOUND;
			if ((getLiveWebRedirector() != null) &&
					!wbRequest.hasMementoAcceptDatetime() && !wbRequest.isMementoTimemapRequest()) {
				liveWebState = getLiveWebRedirector().handleRedirect(e, wbRequest, httpRequest, httpResponse);
			}
			// If not liveweb redirected, then render current exception
			if (liveWebState != LiveWebState.REDIRECTED) {
				e.setLiveWebAvailable(liveWebState == LiveWebState.FOUND);
				getException().renderException(httpRequest, httpResponse, wbRequest, e, getUriConverter());
			}
			handled = true;
		} catch (Exception other) {
			logError(httpResponse, errorMsgHeader, other, wbRequest);
		} finally {
			//Slightly hacky, but ensures that all block loaders are closed
			ZipNumBlockLoader.closeAllReaders();
		}
		return handled;
	}
public boolean handleRequest(HttpServletRequest httpRequest,
			HttpServletResponse httpResponse) throws ServletException,
			IOException {
		WaybackRequest wbRequest = null;
		boolean handled = false;
		try {
			PerfStats.clearAll();
			if (this.isEnablePerfStatsHeader() && (perfStatsHeader != null)) {
				PerfStats.timeStart(PerfStat.Total);
				httpResponse = new PerfWritingHttpServletResponse(httpRequest,
					httpResponse, PerfStat.Total, perfStatsHeader,
					perfStatsHeaderFormat);
			}
			String inputPath = translateRequestPathQuery(httpRequest);
			Thread.currentThread().setName("Thread " +
					Thread.currentThread().getId() + " " + getBeanName() +
					" handling: " + inputPath);
			LOGGER.fine("Handling translated: " + inputPath);
			wbRequest = getParser().parse(httpRequest, this);
			if (wbRequest != null) {
				handled = true;
			
				wbRequest.setAccessPoint(this);
				wbRequest.extractHttpRequestInfo(httpRequest);
			
				if (getAuthentication() != null) {
					if (!getAuthentication().isTrue(wbRequest)) {
						throw new AuthenticationControlException(
							"Unauthorized", isRequestAuth());
					}
				}
			
				if (wbRequest.getExclusionFilter() == null) {
					wbRequest.setExclusionFilter(createExclusionFilter());
				}
			
			
			
			
				wbRequest.setExactScheme(isExactSchemeMatch());
				if (wbRequest.isReplayRequest()) {
					if (bounceToReplayPrefix) {
					
					
						String suffix = translateRequestPathQuery(httpRequest);
						String replayUrl = replayPrefix + suffix;
						httpResponse.sendRedirect(replayUrl);
						return true;
					}
					handleReplay(wbRequest, httpRequest, httpResponse);
				} else {
					if (bounceToQueryPrefix) {
					
					
						String suffix = translateRequestPathQuery(httpRequest);
						String replayUrl = queryPrefix + suffix;
						httpResponse.sendRedirect(replayUrl);
						return true;
					}
					wbRequest.setExactHost(isExactHostMatch());
					handleQuery(wbRequest, httpRequest, httpResponse);
				}
			} else {
				handled = dispatchLocal(httpRequest, httpResponse);
			}
		} catch (BetterRequestException e) {
			e.generateResponse(httpResponse, wbRequest);
			httpResponse.getWriter();
			handled = true;
		} catch (WaybackException e) {
			if (httpResponse.isCommitted()) {
				return true;
			}
			if (wbRequest == null) {
				wbRequest = new WaybackRequest();
				wbRequest.setAccessPoint(this);
			}
			logError(httpResponse, errorMsgHeader, e, wbRequest);
			LiveWebState liveWebState = LiveWebState.NOT_FOUND;
			if ((getLiveWebRedirector() != null) &&
					!wbRequest.hasMementoAcceptDatetime() && !wbRequest.isMementoTimemapRequest()) {
				liveWebState = getLiveWebRedirector().handleRedirect(e, wbRequest, httpRequest, httpResponse);
			}
		
			if (liveWebState != LiveWebState.REDIRECTED) {
				e.setLiveWebAvailable(liveWebState == LiveWebState.FOUND);
				getException().renderException(httpRequest, httpResponse, wbRequest, e, getUriConverter());
			}
			handled = true;
		} catch (Exception other) {
			logError(httpResponse, errorMsgHeader, other, wbRequest);
		} finally {
		
			ZipNumBlockLoader.closeAllReaders();
		}
		return handled;
	}
public boolean handlerequest(httpservletrequest httprequest, httpservletresponse httpresponse) throws servletexception, ioexception { waybackrequest wbrequest = null; boolean handled = false; try { perfstats.clearall(); if (this.isenableperfstatsheader() && (perfstatsheader != null)) { perfstats.timestart(perfstat.total); httpresponse = new perfwritinghttpservletresponse(httprequest, httpresponse, perfstat.total, perfstatsheader, perfstatsheaderformat); } string inputpath = translaterequestpathquery(httprequest); thread.currentthread().setname("thread " + thread.currentthread().getid() + " " + getbeanname() + " handling: " + inputpath); logger.fine("handling translated: " + inputpath); wbrequest = getparser().parse(httprequest, this); if (wbrequest != null) { handled = true; wbrequest.setaccesspoint(this); wbrequest.extracthttprequestinfo(httprequest); if (getauthentication() != null) { if (!getauthentication().istrue(wbrequest)) { throw new authenticationcontrolexception( "unauthorized", isrequestauth()); } } if (wbrequest.getexclusionfilter() == null) { wbrequest.setexclusionfilter(createexclusionfilter()); } wbrequest.setexactscheme(isexactschemematch()); if (wbrequest.isreplayrequest()) { if (bouncetoreplayprefix) { string suffix = translaterequestpathquery(httprequest); string replayurl = replayprefix + suffix; httpresponse.sendredirect(replayurl); return true; } handlereplay(wbrequest, httprequest, httpresponse); } else { if (bouncetoqueryprefix) { string suffix = translaterequestpathquery(httprequest); string replayurl = queryprefix + suffix; httpresponse.sendredirect(replayurl); return true; } wbrequest.setexacthost(isexacthostmatch()); handlequery(wbrequest, httprequest, httpresponse); } } else { handled = dispatchlocal(httprequest, httpresponse); } } catch (betterrequestexception e) { e.generateresponse(httpresponse, wbrequest); httpresponse.getwriter(); handled = true; } catch (waybackexception e) { if (httpresponse.iscommitted()) { return true; } if (wbrequest == null) { wbrequest = new waybackrequest(); wbrequest.setaccesspoint(this); } logerror(httpresponse, errormsgheader, e, wbrequest); livewebstate livewebstate = livewebstate.not_found; if ((getlivewebredirector() != null) && !wbrequest.hasmementoacceptdatetime() && !wbrequest.ismementotimemaprequest()) { livewebstate = getlivewebredirector().handleredirect(e, wbrequest, httprequest, httpresponse); } if (livewebstate != livewebstate.redirected) { e.setlivewebavailable(livewebstate == livewebstate.found); getexception().renderexception(httprequest, httpresponse, wbrequest, e, geturiconverter()); } handled = true; } catch (exception other) { logerror(httpresponse, errormsgheader, other, wbrequest); } finally { zipnumblockloader.closeallreaders(); } return handled; }