forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
.../src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
package org.jboss.resteasy.reactive.server.core.parameters; | ||
|
||
import java.util.List; | ||
import org.jboss.resteasy.reactive.common.util.Encode; | ||
import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; | ||
|
||
public class PathParamExtractor implements ParameterExtractor { | ||
|
||
private final int index; | ||
private final boolean encoded; | ||
private final boolean single; | ||
|
||
public PathParamExtractor(int index, boolean encoded) { | ||
public PathParamExtractor(int index, boolean encoded, boolean single) { | ||
this.index = index; | ||
this.encoded = encoded; | ||
this.single = single; | ||
} | ||
|
||
@Override | ||
public Object extractParameter(ResteasyReactiveRequestContext context) { | ||
String pathParam = context.getPathParam(index); | ||
if (encoded) { | ||
return Encode.encodeQueryParam(pathParam); | ||
pathParam = Encode.encodeQueryParam(pathParam); | ||
} | ||
if (single) { | ||
return pathParam; | ||
} else { | ||
return List.of(pathParam.split("/")); | ||
} | ||
return pathParam; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters