@Override
	public void serviceRequest(final Request request) {
		// Get expected step count
		UIContext uic = UIContextHolder.getCurrent();
		int expected = uic.getEnvironment().getStep();

		// Step should already be set on the session
		if (expected == 0) {
			throw new SystemException(
					"Step count should already be set on the session before content request.");
		}

		// Get step count on the request
		int got = StepCountUtil.getRequestStep(request);

		// Check tokens match (both must be provided)
		if (expected == got) {
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else if (!StepCountUtil.isStepOnRequest(request) && StepCountUtil.isCachedContentRequest(request)) {  // cached content (no step on request)
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else {  // Invalid token
			// Set an error code
			LOG.warn(
					"Wrong step detected for content request. Expected step [" + expected + "] but got step [" + got
					+ "].");
			handleError();
		}

	}
@ Override public void serviceRequest ( final Request request ) { UIContext uic = UIContextHolder . getCurrent ( ) ; int expected = uic . getEnvironment ( ) . getStep ( ) ; if ( expected == 0 ) { throw new SystemException ( "Step count should already be set on the session before content request." ) ; } int got = StepCountUtil . getRequestStep ( request ) ; if ( expected == got ) { getBackingComponent ( ) . serviceRequest ( request ) ; } else if ( ! StepCountUtil . isStepOnRequest ( request ) && StepCountUtil . isCachedContentRequest ( request ) ) { getBackingComponent ( ) . serviceRequest ( request ) ; } else { LOG . warn ( "Wrong step detected for content request. Expected step [" + expected + "] but got step [" + got + "]." ) ; handleError ( ) ; } }
Override to check whether the step variable in the incoming request matches what we expect.

@param request the request being serviced.