org.springframework.web.bind.support.SessionAttributeStore Java Examples

The following examples show how to use org.springframework.web.bind.support.SessionAttributeStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SessionAttributesHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create a new session attributes handler. Session attribute names and types
 * are extracted from the {@code @SessionAttributes} annotation, if present,
 * on the given type.
 * @param handlerType the controller type
 * @param sessionAttributeStore used for session access
 */
public SessionAttributesHandler(Class<?> handlerType, SessionAttributeStore sessionAttributeStore) {
	Assert.notNull(sessionAttributeStore, "SessionAttributeStore may not be null");
	this.sessionAttributeStore = sessionAttributeStore;

	SessionAttributes ann = AnnotatedElementUtils.findMergedAnnotation(handlerType, SessionAttributes.class);
	if (ann != null) {
		Collections.addAll(this.attributeNames, ann.names());
		Collections.addAll(this.attributeTypes, ann.types());
	}
	this.knownAttributeNames.addAll(this.attributeNames);
}
 
Example #2
Source File: SessionAttributesHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create a new session attributes handler. Session attribute names and types
 * are extracted from the {@code @SessionAttributes} annotation, if present,
 * on the given type.
 * @param handlerType the controller type
 * @param sessionAttributeStore used for session access
 */
public SessionAttributesHandler(Class<?> handlerType, SessionAttributeStore sessionAttributeStore) {
	Assert.notNull(sessionAttributeStore, "SessionAttributeStore may not be null");
	this.sessionAttributeStore = sessionAttributeStore;

	SessionAttributes ann = AnnotatedElementUtils.findMergedAnnotation(handlerType, SessionAttributes.class);
	if (ann != null) {
		Collections.addAll(this.attributeNames, ann.names());
		Collections.addAll(this.attributeTypes, ann.types());
	}
	this.knownAttributeNames.addAll(this.attributeNames);
}
 
Example #3
Source File: SessionAttributesHandler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new instance for a controller type. Session attribute names and
 * types are extracted from the {@code @SessionAttributes} annotation, if
 * present, on the given type.
 * @param handlerType the controller type
 * @param sessionAttributeStore used for session access
 */
public SessionAttributesHandler(Class<?> handlerType, SessionAttributeStore sessionAttributeStore) {
	Assert.notNull(sessionAttributeStore, "SessionAttributeStore may not be null");
	this.sessionAttributeStore = sessionAttributeStore;

	SessionAttributes annotation =
			AnnotatedElementUtils.findMergedAnnotation(handlerType, SessionAttributes.class);
	if (annotation != null) {
		this.attributeNames.addAll(Arrays.asList(annotation.names()));
		this.attributeTypes.addAll(Arrays.asList(annotation.types()));
	}
	this.knownAttributeNames.addAll(this.attributeNames);
}
 
Example #4
Source File: HandlerMethodInvoker.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer,
		SessionAttributeStore sessionAttributeStore, ParameterNameDiscoverer parameterNameDiscoverer,
		WebArgumentResolver[] customArgumentResolvers, HttpMessageConverter<?>[] messageConverters) {

	this.methodResolver = methodResolver;
	this.bindingInitializer = bindingInitializer;
	this.sessionAttributeStore = sessionAttributeStore;
	this.parameterNameDiscoverer = parameterNameDiscoverer;
	this.customArgumentResolvers = customArgumentResolvers;
	this.messageConverters = messageConverters;
}
 
Example #5
Source File: SessionAttributesHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new instance for a controller type. Session attribute names and
 * types are extracted from the {@code @SessionAttributes} annotation, if
 * present, on the given type.
 * @param handlerType the controller type
 * @param sessionAttributeStore used for session access
 */
public SessionAttributesHandler(Class<?> handlerType, SessionAttributeStore sessionAttributeStore) {
	Assert.notNull(sessionAttributeStore, "SessionAttributeStore may not be null.");
	this.sessionAttributeStore = sessionAttributeStore;

	SessionAttributes annotation = AnnotationUtils.findAnnotation(handlerType, SessionAttributes.class);
	if (annotation != null) {
		this.attributeNames.addAll(Arrays.asList(annotation.names()));
		this.attributeTypes.addAll(Arrays.asList(annotation.types()));
	}

	for (String attributeName : this.attributeNames) {
		this.knownAttributeNames.add(attributeName);
	}
}
 
Example #6
Source File: HandlerMethodInvoker.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer,
		SessionAttributeStore sessionAttributeStore, ParameterNameDiscoverer parameterNameDiscoverer,
		WebArgumentResolver[] customArgumentResolvers, HttpMessageConverter<?>[] messageConverters) {

	this.methodResolver = methodResolver;
	this.bindingInitializer = bindingInitializer;
	this.sessionAttributeStore = sessionAttributeStore;
	this.parameterNameDiscoverer = parameterNameDiscoverer;
	this.customArgumentResolvers = customArgumentResolvers;
	this.messageConverters = messageConverters;
}
 
Example #7
Source File: AuthorizationEndpoint.java    From MaxKey with Apache License 2.0 4 votes vote down vote up
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	this.sessionAttributeStore = sessionAttributeStore;
}
 
Example #8
Source File: RequestMappingHandlerAdapter.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Specify the strategy to store session attributes with. The default is
 * {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
 * storing session attributes in the HttpSession with the same attribute
 * name as in the model.
 */
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	this.sessionAttributeStore = sessionAttributeStore;
}
 
Example #9
Source File: RequestMappingHandlerAdapter.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Specify the strategy to store session attributes with. The default is
 * {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
 * storing session attributes in the HttpSession with the same attribute
 * name as in the model.
 */
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	this.sessionAttributeStore = sessionAttributeStore;
}
 
Example #10
Source File: AnnotationMethodHandlerAdapter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Specify the strategy to store session attributes with.
 * <p>Default is {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
 * storing session attributes in the HttpSession, using the same attribute name as in the model.
 */
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	Assert.notNull(sessionAttributeStore, "SessionAttributeStore must not be null");
	this.sessionAttributeStore = sessionAttributeStore;
}
 
Example #11
Source File: RequestMappingHandlerAdapter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Specify the strategy to store session attributes with. The default is
 * {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
 * storing session attributes in the HttpSession with the same attribute
 * name as in the model.
 */
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	this.sessionAttributeStore = sessionAttributeStore;
}
 
Example #12
Source File: AnnotationMethodHandlerAdapter.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Specify the strategy to store session attributes with.
 * <p>Default is {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
 * storing session attributes in the PortletSession, using the same
 * attribute name as in the model.
 */
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	Assert.notNull(sessionAttributeStore, "SessionAttributeStore must not be null");
	this.sessionAttributeStore = sessionAttributeStore;
}
 
Example #13
Source File: AnnotationMethodHandlerAdapter.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Specify the strategy to store session attributes with.
 * <p>Default is {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
 * storing session attributes in the HttpSession, using the same attribute name as in the model.
 */
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	Assert.notNull(sessionAttributeStore, "SessionAttributeStore must not be null");
	this.sessionAttributeStore = sessionAttributeStore;
}
 
Example #14
Source File: RequestMappingHandlerAdapter.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Specify the strategy to store session attributes with. The default is
 * {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
 * storing session attributes in the HttpSession with the same attribute
 * name as in the model.
 */
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
	this.sessionAttributeStore = sessionAttributeStore;
}