Java Code Examples for org.springframework.mock.web.MockHttpSession#setNew()

The following examples show how to use org.springframework.mock.web.MockHttpSession#setNew() . 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: HtmlUnitRequestBuilder.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) {
	MockHttpSession session;
	synchronized (this.sessions) {
		session = this.sessions.get(sessionid);
		if (session == null) {
			session = new HtmlUnitMockHttpSession(request, sessionid);
			session.setNew(true);
			synchronized (this.sessions) {
				this.sessions.put(sessionid, session);
			}
			addSessionCookie(request, sessionid);
		}
		else {
			session.setNew(false);
		}
	}
	return session;
}
 
Example 2
Source File: HtmlUnitRequestBuilder.java    From java-technology-stack with MIT License 6 votes vote down vote up
private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) {
	MockHttpSession session;
	synchronized (this.sessions) {
		session = this.sessions.get(sessionid);
		if (session == null) {
			session = new HtmlUnitMockHttpSession(request, sessionid);
			session.setNew(true);
			synchronized (this.sessions) {
				this.sessions.put(sessionid, session);
			}
			addSessionCookie(request, sessionid);
		}
		else {
			session.setNew(false);
		}
	}
	return session;
}
 
Example 3
Source File: HtmlUnitRequestBuilder.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) {
	MockHttpSession session;
	synchronized (this.sessions) {
		session = this.sessions.get(sessionid);
		if (session == null) {
			session = new HtmlUnitMockHttpSession(request, sessionid);
			session.setNew(true);
			synchronized (this.sessions) {
				this.sessions.put(sessionid, session);
			}
			addSessionCookie(request, sessionid);
		}
		else {
			session.setNew(false);
		}
	}
	return session;
}