Code example for WebRequest

Methods: getAttribute, setAttribute

0
	@Override 
	public void preHandle(WebRequest request) throws DataAccessException { 
		if (TransactionSynchronizationManager.hasResource(getPersistenceManagerFactory())) { 
			// Do not modify the PersistenceManager: just mark the request accordingly. 
			String participateAttributeName = getParticipateAttributeName(); 
			Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST); 
			int newCount = (count != null ? count + 1 : 1); 
			request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST); 
		} 
		else { 
			logger.debug("Opening JDO PersistenceManager in OpenPersistenceManagerInViewInterceptor"); 
			PersistenceManager pm = 
					PersistenceManagerFactoryUtils.getPersistenceManager(getPersistenceManagerFactory(), true); 
			TransactionSynchronizationManager.bindResource( 
					getPersistenceManagerFactory(), new PersistenceManagerHolder(pm)); 
		} 
	} 
 
	@Override 
	public void postHandle(WebRequest request, ModelMap model) { 
Connect your IDE to all the code out there  Get Codota for Java