@@ -109,6 +109,11 @@ public static <TRequest, TResponse> Pair<TRequest, TResponse> onServiceEnter(
109109 return null ;
110110 }
111111
112+ // skip operation for excludeServiceOperations、includeServiceOperations
113+ if (shouldSkipOperation (adapter , httpServletRequest )) {
114+ CaseEventDispatcher .onEvent (CaseEvent .ofEnterEvent ());
115+ return null ;
116+ }
112117 // 302 Redirect request
113118 String redirectRecordId = getRedirectRecordId (adapter , httpServletRequest );
114119 if (StringUtil .isNotEmpty (redirectRecordId )) {
@@ -237,17 +242,6 @@ private static <TRequest> boolean shouldSkip(ServletAdapter<TRequest, ?> adapter
237242 return false ;
238243 }
239244 String pattern = adapter .getPattern (httpServletRequest );
240- // As long as one parameter is hit in includeServiceOperations, the operation will not be skipped
241- if (CollectionUtil .isNotEmpty (Config .get ().getIncludeServiceOperations ()) &&
242- !(IgnoreUtils .includeOperation (pattern ) ||
243- IgnoreUtils .includeOperation (requestURI ))) {
244- return true ;
245- }
246- // As long as one parameter is hit in excludeServiceOperations, the operation will be skipped
247- if (IgnoreUtils .excludeOperation (pattern ) ||
248- IgnoreUtils .excludeOperation (requestURI )) {
249- return true ;
250- }
251245
252246 // Filter invalid servlet path suffix
253247 if (FILTERED_GET_URL_SUFFIX .stream ().anyMatch (requestURI ::endsWith )) {
@@ -263,6 +257,38 @@ private static <TRequest> boolean shouldSkip(ServletAdapter<TRequest, ?> adapter
263257 return Config .get ().invalidRecord (pattern );
264258 }
265259
260+ private static <TRequest > boolean shouldSkipOperation (ServletAdapter <TRequest , ?> adapter ,
261+ TRequest httpServletRequest ) {
262+ String caseId = adapter .getRequestHeader (httpServletRequest , ArexConstants .RECORD_ID );
263+ // Replay scene
264+ if (StringUtil .isNotEmpty (caseId )) {
265+ return Config .get ().getBoolean (ConfigConstants .DISABLE_REPLAY , false );
266+ }
267+
268+ String forceRecord = adapter .getRequestHeader (httpServletRequest ,
269+ ArexConstants .FORCE_RECORD , ArexConstants .HEADER_X_PREFIX );
270+ // Do not skip if header with arex-force-record=true
271+ if (Boolean .parseBoolean (forceRecord )) {
272+ return false ;
273+ }
274+
275+ String requestURI = adapter .getRequestURI (httpServletRequest );
276+ if (StringUtil .isEmpty (requestURI )) {
277+ return false ;
278+ }
279+
280+ String pattern = adapter .getPattern (httpServletRequest );
281+ // As long as one parameter is hit in includeServiceOperations, the operation will not be skipped
282+ if (CollectionUtil .isNotEmpty (Config .get ().getIncludeServiceOperations ()) &&
283+ !(IgnoreUtils .includeOperation (pattern ) ||
284+ IgnoreUtils .includeOperation (requestURI ))) {
285+ return true ;
286+ }
287+ // As long as one parameter is hit in excludeServiceOperations, the operation will be skipped
288+ return IgnoreUtils .excludeOperation (pattern ) ||
289+ IgnoreUtils .excludeOperation (requestURI );
290+ }
291+
266292 private static <TRequest , TResponse > String getRedirectRecordId (ServletAdapter <TRequest , TResponse > adapter ,
267293 TRequest httpServletRequest ) {
268294 String redirectRecordId = adapter .getParameterFromQueryString (httpServletRequest , ArexConstants .RECORD_ID );
0 commit comments