@Override
	public void serviceRequest(final Request request) {
		// Get the expected session token
		UIContext uic = UIContextHolder.getCurrent();
		String expected = uic.getEnvironment().getSessionToken();

		// Session token should already be set
		if (expected == null) {
			LOG.error("Session token should already be set on the session before AJAX request. Can be due to the session timing out.");
			handleError();
		}

		// Get the session token from the request
		String got = request.getParameter(Environment.SESSION_TOKEN_VARIABLE);

		// Check tokens match (both must be provided)
		if (Util.equals(expected, got)) {
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else { // Invalid token
			LOG.error("Wrong session token detected for AJAX request. Expected token [" + expected
					+ "] but got token [" + got + "].");
			handleError();
		}
	}
@ Override public void serviceRequest ( final Request request ) { UIContext uic = UIContextHolder . getCurrent ( ) ; String expected = uic . getEnvironment ( ) . getSessionToken ( ) ; if ( expected == null ) { LOG . error ( "Session token should already be set on the session before AJAX request. Can be due to the session timing out." ) ; handleError ( ) ; } String got = request . getParameter ( Environment . SESSION_TOKEN_VARIABLE ) ; if ( Util . equals ( expected , got ) ) { getBackingComponent ( ) . serviceRequest ( request ) ; } else { LOG . error ( "Wrong session token detected for AJAX request. Expected token [" + expected + "] but got token [" + got + "]." ) ; handleError ( ) ; } }
Override to check whether the session token variable in the incoming request matches what we expect.

@param request the request being serviced.