Skip to content

Commit a7a9731

Browse files
committed
turned requestedSessionId into a settable property
1 parent ed61da9 commit a7a9731

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

org.springframework.test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ public class MockHttpServletRequest implements HttpServletRequest {
159159

160160
private Principal userPrincipal;
161161

162+
private String requestedSessionId;
163+
162164
private String requestURI;
163165

164166
private String servletPath = "";
@@ -761,9 +763,12 @@ public Principal getUserPrincipal() {
761763
return this.userPrincipal;
762764
}
763765

766+
public void setRequestedSessionId(String requestedSessionId) {
767+
this.requestedSessionId = requestedSessionId;
768+
}
769+
764770
public String getRequestedSessionId() {
765-
HttpSession session = getSession();
766-
return (session != null ? session.getId() : null);
771+
return this.requestedSessionId;
767772
}
768773

769774
public void setRequestURI(String requestURI) {

org.springframework.web.servlet/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ public class MockHttpServletRequest implements HttpServletRequest {
159159

160160
private Principal userPrincipal;
161161

162+
private String requestedSessionId;
163+
162164
private String requestURI;
163165

164166
private String servletPath = "";
@@ -761,9 +763,12 @@ public Principal getUserPrincipal() {
761763
return this.userPrincipal;
762764
}
763765

766+
public void setRequestedSessionId(String requestedSessionId) {
767+
this.requestedSessionId = requestedSessionId;
768+
}
769+
764770
public String getRequestedSessionId() {
765-
HttpSession session = getSession();
766-
return (session != null ? session.getId() : null);
771+
return this.requestedSessionId;
767772
}
768773

769774
public void setRequestURI(String requestURI) {

org.springframework.web/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ public class MockHttpServletRequest implements HttpServletRequest {
159159

160160
private Principal userPrincipal;
161161

162+
private String requestedSessionId;
163+
162164
private String requestURI;
163165

164166
private String servletPath = "";
@@ -761,9 +763,12 @@ public Principal getUserPrincipal() {
761763
return this.userPrincipal;
762764
}
763765

766+
public void setRequestedSessionId(String requestedSessionId) {
767+
this.requestedSessionId = requestedSessionId;
768+
}
769+
764770
public String getRequestedSessionId() {
765-
HttpSession session = getSession();
766-
return (session != null ? session.getId() : null);
771+
return this.requestedSessionId;
767772
}
768773

769774
public void setRequestURI(String requestURI) {

0 commit comments

Comments
 (0)