// end of refactor
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;
	}
// wbRequest.setContextPrefix(getUrlRoot());
wbRequest.extractHttpRequestInfo(httpRequest);
// end of refactor
if (getAuthentication() != null) {
if (!getAuthentication().isTrue(wbRequest)) {
" 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());
}
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);