org.apache.struts2.interceptor

## Class CoopInterceptor

- java.lang.Object
- - com.opensymphony.xwork2.interceptor.AbstractInterceptor
  - - org.apache.struts2.interceptor.CoopInterceptor

- All Implemented Interfaces:
    ConditionalInterceptor, Interceptor, PreResultListener, Serializable

      public class CoopInterceptor
      extends AbstractInterceptor
      implements PreResultListener

  Interceptor that implements Cross-Origin Opener Policy on incoming requests. COOP is a mitigation against cross-origin information leaks and is used to make websites, cross-origin isolated. Setting the COOP header allows you to ensure that a top-level window is isolated from other documents by putting them in a different browsing context group, so they cannot directly interact with the top-level window.
  See Also:
    https://web.dev/why-coop-coep/#coop, https://github.com/whatwg/html/pull/5334/files, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CoopInterceptor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beforeResult(ActionInvocation invocation, String resultCode)` This callback method will be called after the `Action` execution and before the `Result` execution.
    `String` | `intercept(ActionInvocation invocation)` Override to handle interception
    `boolean` | `isExempted(String path)`
    `void` | `setExemptedPaths(String paths)`
    `void` | `setMode(String mode)`

    - ### Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor

      `destroy, init, setDisabled, shouldIntercept`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CoopInterceptor

          public CoopInterceptor()

  - ### Method Detail

    - #### intercept

          public String intercept(ActionInvocation invocation)
                           throws Exception

      Description copied from class: `AbstractInterceptor`
      Override to handle interception
      Specified by:
        `intercept` in interface `Interceptor`
      Specified by:
        `intercept` in class `AbstractInterceptor`
      Parameters:
        `invocation` - the action invocation
      Returns:
        the return code, either returned from `ActionInvocation.invoke()`, or from the interceptor itself.
      Throws:
        `Exception` - any system-level error, as defined in `Action.execute()`.

    - #### beforeResult

          public void beforeResult(ActionInvocation invocation,
                                   String resultCode)

      Description copied from interface: `PreResultListener`
      This callback method will be called after the `Action` execution and before the `Result` execution.
      Specified by:
        `beforeResult` in interface `PreResultListener`
      Parameters:
        `invocation` - the action invocation
        `resultCode` - the result code returned by the action (eg. `success`).

    - #### isExempted

          public boolean isExempted(String path)

    - #### setExemptedPaths

          public void setExemptedPaths(String paths)

    - #### setMode

          public void setMode(String mode)

Copyright © 2000–2024 Apache Software Foundation. All rights reserved.