Java Code Examples for org.springframework.web.method.annotation.SessionAttributesHandler

Following code examples demonstrate how to use org.springframework.web.method.annotation.SessionAttributesHandler from spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.web.method.annotation.SessionAttributesHandler and various code implementation of this class.
Example 1
Project : spring-framework Source File : RequestMappingHandlerAdapter.java View Source Code on GitHub

	private ModelFactory createModelFactory(HandlerMethod handlerMethod, WebDataBinderFactory binderFactory) {
		List<InvocableHandlerMethod> modelAttrMethods = new ArrayList<InvocableHandlerMethod>();

		Class<?> handlerType = handlerMethod.getBeanType();
		Set<Method> attributeMethods = modelAttributeMethodCache.get(handlerType);
		if (attributeMethods == null) {
			attributeMethods = HandlerMethodSelector.selectMethods(handlerType, MODEL_ATTRIBUTE_METHODS);
			modelAttributeMethodCache.put(handlerType, attributeMethods);
		}

		for (Method method : attributeMethods) {
			InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(handlerMethod.getBean(), method);
			attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
			attrMethod.setDataBinderFactory(binderFactory);
			attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
			modelAttrMethods.add(attrMethod);
		}

		return new ModelFactory(modelAttrMethods, binderFactory, sessionAttributesHandlerCache.get(handlerType));
	}
			
Example 2
Project : spring-framework Source File : RequestMappingHandlerAdapter.java View Source Code on GitHub

	private boolean hasSessionAttributes(Class<?> handlerType) {
		SessionAttributesHandler handler = null;
		synchronized(this.sessionAttributesHandlerCache) {
			handler = this.sessionAttributesHandlerCache.get(handlerType);
			if (handler == null) {
				handler = new SessionAttributesHandler(handlerType, sessionAttributeStore);
				this.sessionAttributesHandlerCache.put(handlerType, handler);
			}
		}
		return handler.hasSessionAttributes();
	}