Skip to content

Commit 80bc276

Browse files
committed
Use getServletPath instead of getPathInfo for jakarta servlets
1 parent 5c86608 commit 80bc276

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

concurrency-limits-servlet-jakarta/src/main/java/com/netflix/concurrency/limits/servlet/jakarta/ServletLimiterBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public ServletLimiterBuilder partitionByParameter(String name) {
7171
* @return Chainable builder
7272
*/
7373
public ServletLimiterBuilder partitionByPathInfo(Function<String, String> pathToGroup) {
74-
return partitionResolver(request -> Optional.ofNullable(request.getPathInfo()).map(pathToGroup).orElse(null));
74+
return partitionResolver(request -> Optional.ofNullable(request.getServletPath()).map(pathToGroup).orElse(null));
7575
}
7676

7777
/**
@@ -129,7 +129,7 @@ public ServletLimiterBuilder bypassLimitByParameter(String name, String value) {
129129
* @return Chainable builder
130130
*/
131131
public ServletLimiterBuilder bypassLimitByPathInfo(String pathInfo) {
132-
return bypassLimitResolver((context) -> pathInfo.equals(context.getPathInfo()));
132+
return bypassLimitResolver((context) -> pathInfo.equals(context.getServletPath()));
133133
}
134134

135135
/**

concurrency-limits-servlet-jakarta/src/test/java/com/netflix/concurrency/limits/ConcurrencyLimitServletFilterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void testDoFilterBypassCheckPassedForPath() throws ServletException, IOEx
119119

120120
MockHttpServletRequest request = new MockHttpServletRequest();
121121
request.setMethod("POST");
122-
request.setPathInfo("/admin/health");
122+
request.setServletPath("/admin/health");
123123
MockHttpServletResponse response = new MockHttpServletResponse();
124124
MockFilterChain filterChain = new MockFilterChain();
125125

concurrency-limits-servlet-jakarta/src/test/java/com/netflix/concurrency/limits/GroupServletLimiterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private HttpServletRequest createMockRequestWithPrincipal(String name) {
166166
private HttpServletRequest createMockRequestWithPathInfo(String name) {
167167
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
168168

169-
Mockito.when(request.getPathInfo()).thenReturn(name);
169+
Mockito.when(request.getServletPath()).thenReturn(name);
170170
return request;
171171
}
172172
}

0 commit comments

Comments
 (0)