Package com.epam.reportportal.service
Class PathParamInterceptor
- java.lang.Object
-
- com.epam.reportportal.service.PathParamInterceptor
-
- All Implemented Interfaces:
okhttp3.Interceptor
public class PathParamInterceptor extends java.lang.Object implements okhttp3.InterceptorOkHttpInterceptorimplementation 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 Summary
Constructors Constructor Description PathParamInterceptor(java.lang.String replaceKey, java.lang.String replaceValue)Constructs aPathParamInterceptorwith specified parameter name and replacement value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.Responseintercept(okhttp3.Interceptor.Chain chain)Intercepts the HTTP request and replaces any path segments containing the specified parameter with the replacement value.
-
-
-
Constructor Detail
-
PathParamInterceptor
public PathParamInterceptor(java.lang.String replaceKey, java.lang.String replaceValue)Constructs aPathParamInterceptorwith specified parameter name and replacement value.- Parameters:
replaceKey- The name of the parameter to replace (will be wrapped in {} in the URL)replaceValue- The value to substitute for the parameter
-
-
Method Detail
-
intercept
@Nonnull public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws java.io.IOExceptionIntercepts the HTTP request and replaces any path segments containing the specified parameter with the replacement value.- Specified by:
interceptin interfaceokhttp3.Interceptor- Parameters:
chain- The interceptor chain- Returns:
- The response from the chain after processing the modified request
- Throws:
java.io.IOException- If an I/O error occurs during request processing
-
-