public class PathParamInterceptor
extends java.lang.Object
implements okhttp3.Interceptor
Interceptor implementation that substitutes path parameters in URL segments.
This interceptor replaces token strings in the URL path segments with specified values.
A path parameter is identified by the format {paramName}, where 'paramName' is the name
of the parameter to be substituted.
Example: For a URL like "https://example.com/api/{projectName}/launch" When configured with PathParamInterceptor("projectName", "testProject") The resulting URL will be "https://example.com/api/testProject/launch"
This interceptor is used in the ReportPortal client to replace project name placeholders in API endpoints with the actual project name specified in the client configuration.
| Constructor and Description |
|---|
PathParamInterceptor(java.lang.String replaceKey,
java.lang.String replaceValue)
Constructs a
PathParamInterceptor with specified parameter name and replacement value. |
| Modifier and Type | Method and Description |
|---|---|
okhttp3.Response |
intercept(okhttp3.Interceptor.Chain chain)
Intercepts the HTTP request and replaces any path segments containing the specified parameter
with the replacement value.
|
public PathParamInterceptor(java.lang.String replaceKey,
java.lang.String replaceValue)
PathParamInterceptor with specified parameter name and replacement value.replaceKey - The name of the parameter to replace (will be wrapped in {} in the URL)replaceValue - The value to substitute for the parameter@Nonnull
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain)
throws java.io.IOException
intercept in interface okhttp3.Interceptorchain - The interceptor chainjava.io.IOException - If an I/O error occurs during request processing