*/
public boolean service(RequestContext context) throws ServletException, IOException
{try { __CLOVER_71_0.M[390]++;
__CLOVER_71_0.S[1606]++;IRequestCycle cycle = null;
__CLOVER_71_0.S[1607]++;ResponseOutputStream output = null;
__CLOVER_71_0.S[1608]++;IMonitor monitor = null;
__CLOVER_71_0.S[1609]++;if ((((LOG.isDebugEnabled()) && (++__CLOVER_71_0.CT[305] != 0)) || (++__CLOVER_71_0.CF[305] == 0))){
__CLOVER_71_0.S[1610]++;LOG.debug("Begin service " + context.getRequestURI());}
__CLOVER_71_0.S[1611]++;if ((((_infrastructure == null) && (++__CLOVER_71_0.CT[306] != 0)) || (++__CLOVER_71_0.CF[306] == 0))){
__CLOVER_71_0.S[1612]++;_infrastructure = (Infrastructure) context.getAttribute(Constants.INFRASTRUCTURE_KEY);}
// The servlet invokes setLocale() before invoking service(). We want
// to ignore that setLocale() ... that is, not force a cookie to be
// written.
__CLOVER_71_0.S[1613]++;_localeChanged = false;
__CLOVER_71_0.S[1614]++;try
{
__CLOVER_71_0.S[1615]++;setupForRequest(context);
__CLOVER_71_0.S[1616]++;monitor = getMonitor(context);
__CLOVER_71_0.S[1617]++;output = new ResponseOutputStream(context.getResponse());
}
catch (Exception ex)
{
__CLOVER_71_0.S[1618]++;reportException(Tapestry.getMessage("AbstractEngine.unable-to-begin-request"), ex);
__CLOVER_71_0.S[1619]++;throw new ServletException(ex.getMessage(), ex);
}
__CLOVER_71_0.S[1620]++;IEngineService service = null;
__CLOVER_71_0.S[1621]++;try
{
__CLOVER_71_0.S[1622]++;try
{
__CLOVER_71_0.S[1623]++;String serviceName;
__CLOVER_71_0.S[1624]++;try
{
__CLOVER_71_0.S[1625]++;serviceName = extractServiceName(context);
__CLOVER_71_0.S[1626]++;if ((((Tapestry.isBlank(serviceName)) && (++__CLOVER_71_0.CT[307] != 0)) || (++__CLOVER_71_0.CF[307] == 0))){
__CLOVER_71_0.S[1627]++;serviceName = Tapestry.HOME_SERVICE;}
// Must have a service to create the request cycle.
// Must have a request cycle to report an exception.
__CLOVER_71_0.S[1628]++;service = getService(serviceName);
}
catch (Exception ex)
{
__CLOVER_71_0.S[1629]++;service = getService(Tapestry.HOME_SERVICE);
__CLOVER_71_0.S[1630]++;cycle = createRequestCycle(context, service, monitor);
__CLOVER_71_0.S[1631]++;throw ex;
}
__CLOVER_71_0.S[1632]++;cycle = createRequestCycle(context, service, monitor);
__CLOVER_71_0.S[1633]++;monitor.serviceBegin(serviceName, context.getRequestURI());
// Invoke the service, which returns true if it may have changed
// the state of the engine (most do return true).
__CLOVER_71_0.S[1634]++;service.service(this, cycle, output);
// Return true only if the engine is actually dirty. This cuts
// down
// on the number of times the engine is stored into the
// session unceccesarily.
__CLOVER_71_0.S[1635]++;return _dirty;
}
catch (PageRedirectException ex)
{
__CLOVER_71_0.S[1636]++;handlePageRedirectException(ex, cycle, output);
}
catch (RedirectException ex)
{
__CLOVER_71_0.S[1637]++;handleRedirectException(cycle, ex);
}
catch (StaleLinkException ex)
{
__CLOVER_71_0.S[1638]++;handleStaleLinkException(ex, cycle, output);
}
catch (StaleSessionException ex)
{
__CLOVER_71_0.S[1639]++;handleStaleSessionException(ex, cycle, output);
}
}
catch (Exception ex)
{
__CLOVER_71_0.S[1640]++;monitor.serviceException(ex);
// Discard any output (if possible). If output has already been sent
// to
// the client, then things get dicey. Note that this block
// gets activated if the StaleLink or StaleSession pages throws
// any kind of exception.
// Attempt to switch to the exception page. However, this may itself
// fail
// for a number of reasons, in which case a ServletException is
// thrown.
__CLOVER_71_0.S[1641]++;output.reset();
__CLOVER_71_0.S[1642]++;if ((((LOG.isDebugEnabled()) && (++__CLOVER_71_0.CT[308] != 0)) || (++__CLOVER_71_0.CF[308] == 0))){
__CLOVER_71_0.S[1643]++;LOG.debug("Uncaught exception", ex);}
__CLOVER_71_0.S[1644]++;activateExceptionPage(cycle, output, ex);
}
finally
{
__CLOVER_71_0.S[1645]++;if ((((service != null) && (++__CLOVER_71_0.CT[309] != 0)) || (++__CLOVER_71_0.CF[309] == 0))){
__CLOVER_71_0.S[1646]++;monitor.serviceEnd(service.getName());}
__CLOVER_71_0.S[1647]++;try
{
__CLOVER_71_0.S[1648]++;cycle.cleanup();
// Closing the buffered output closes the underlying stream as
// well.
__CLOVER_71_0.S[1649]++;if ((((output != null) && (++__CLOVER_71_0.CT[310] != 0)) || (++__CLOVER_71_0.CF[310] == 0))){
__CLOVER_71_0.S[1650]++;output.forceFlush();}
__CLOVER_71_0.S[1651]++;cleanupAfterRequest(cycle);
}
catch (Exception ex)
{