Skip to content

Commit 2404a57

Browse files
committed
jakartified adaptation of the #5282
Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
1 parent 91d2fd1 commit 2404a57

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

core-server/src/main/java/org/glassfish/jersey/server/internal/routing/AbstractMethodSelectingRouter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ protected ConsumesProducesAcceptor(
201201
/**
202202
* Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}.
203203
*
204-
* @param requestContext The request to be tested.
204+
* @param contentType The media type of the {@code request} to be tested (can be NULL).
205205
* @return True if the {@code request} can be processed by this router, false otherwise.
206206
*/
207-
abstract boolean isConsumable(ContainerRequest requestContext);
207+
abstract boolean isConsumable(MediaType contentType);
208208

209209
@Override
210210
public String toString() {
@@ -400,8 +400,8 @@ private List<Router> getMethodRouter(final RequestProcessingContext context) {
400400
final List<ConsumesProducesAcceptor> satisfyingAcceptors = new LinkedList<>();
401401
final Set<ResourceMethod> differentInvokableMethods = Collections.newSetFromMap(new IdentityHashMap<>());
402402
final MediaType requestContentType = request.getMediaType();
403-
for (ConsumesProducesAcceptor cpi : acceptors) {
404-
if (cpi.isConsumable(request)) {
403+
for (final ConsumesProducesAcceptor cpi : acceptors) {
404+
if (cpi.isConsumable(requestContentType)) {
405405
satisfyingAcceptors.add(cpi);
406406
differentInvokableMethods.add(cpi.methodRouting.method);
407407
}

core-server/src/main/java/org/glassfish/jersey/server/internal/routing/OctetStreamMethodSelectingRouter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -65,11 +65,11 @@ private ConsumesProducesAcceptor(
6565
/**
6666
* Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}.
6767
*
68-
* @param requestContext The request to be tested.
68+
* @param contentType The media type of the {@code request} to be tested (can be NULL).
6969
* @return True if the {@code request} can be processed by this router, false otherwise.
7070
*/
71-
boolean isConsumable(ContainerRequest requestContext) {
72-
MediaType contentType = requestContext.getMediaType();
71+
@Override
72+
boolean isConsumable(MediaType contentType) {
7373
if (contentType == null && methodRouting.method.getType() != ResourceMethod.JaxrsType.SUB_RESOURCE_LOCATOR
7474
&& methodRouting.method.getInvocable().requiresEntity()) {
7575
contentType = MediaType.APPLICATION_OCTET_STREAM_TYPE;

core-server/src/main/java/org/glassfish/jersey/server/internal/routing/WildcardMethodSelectingRouter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -68,11 +68,11 @@ private ConsumesProducesAcceptor(
6868
/**
6969
* Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}.
7070
*
71-
* @param requestContext The request to be tested.
71+
* @param contentType The media type of the {@code request} to be tested (can be NULL).
7272
* @return True if the {@code request} can be processed by this router, false otherwise.
7373
*/
74-
boolean isConsumable(ContainerRequest requestContext) {
75-
MediaType contentType = requestContext.getMediaType();
74+
@Override
75+
boolean isConsumable(MediaType contentType) {
7676
return contentType == null || consumes.getMediaType().isCompatible(contentType);
7777
}
7878
}

0 commit comments

Comments
 (0)