use of cn.taketoday.web.session.WebSession in project today-infrastructure by TAKETODAY.
the class SessionScope method getConversationId.
@Override
public String getConversationId() {
RequestContext context = RequestContextHolder.getRequired();
WebSession session = getSession(context, false);
if (session != null) {
return session.getId();
}
return null;
}
use of cn.taketoday.web.session.WebSession in project today-infrastructure by TAKETODAY.
the class RequestMappingHandlerAdapter method handleInternal.
@Override
protected Object handleInternal(RequestContext request, HandlerMethod handlerMethod) throws Throwable {
Object returnValue;
checkRequest(request);
// Execute invokeHandlerMethod in synchronized block if required.
if (this.synchronizeOnSession) {
if (sessionManager != null) {
}
WebSession session = RequestContextUtils.getSession(request, false);
if (session != null) {
Object mutex = WebUtils.getSessionMutex(session);
synchronized (mutex) {
returnValue = invokeHandlerMethod(request, handlerMethod);
}
} else {
// No Session available -> no mutex necessary
returnValue = invokeHandlerMethod(request, handlerMethod);
}
} else {
// No synchronization on session demanded at all...
returnValue = invokeHandlerMethod(request, handlerMethod);
}
HttpHeaders headers = request.getHeaders();
if (!headers.containsKey(HEADER_CACHE_CONTROL)) {
if (getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) {
applyCacheSeconds(request, cacheSecondsForSessionAttributeHandlers);
} else {
prepareResponse(request);
}
}
return returnValue;
}
Aggregations