Skip to content

Commit 81a4e32

Browse files
committed
Add ERROR and ASYNC dispatcher type and more docs
1 parent 140a799 commit 81a4e32

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/main/java/edu/harvard/iq/dataverse/filter/CorsFilter.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,22 @@
2828
* 1. Reads CORS configuration from JVM settings (dataverse.cors.*). See the Dataverse Configuration Guide for more details.
2929
* 2. Determines whether CORS should be allowed based on these settings.
3030
* 3. If CORS is allowed, it adds the appropriate CORS headers to all HTTP responses. The JVMSettings allow customization of the header contents if desired.
31-
*
31+
*
32+
* The broader dispatcher set is intentional:
33+
* - REQUEST applies CORS to direct client requests.
34+
* - FORWARD covers internal forwards, including API paths rewritten by
35+
* {@link edu.harvard.iq.dataverse.api.ApiRouter} from {@code /api/...} to {@code /api/v1/...}.
36+
* - ERROR ensures error responses also carry CORS headers, so browser clients can read error details.
37+
* - ASYNC keeps behavior consistent for asynchronous servlet/JAX-RS processing.
38+
*
3239
* The filter is applied to all paths ("/*") in the application.
3340
*/
34-
35-
@WebFilter(value = "/*", dispatcherTypes = { DispatcherType.REQUEST, DispatcherType.FORWARD})
41+
@WebFilter(value = "/*", dispatcherTypes = {
42+
DispatcherType.REQUEST,
43+
DispatcherType.FORWARD,
44+
DispatcherType.ERROR,
45+
DispatcherType.ASYNC
46+
})
3647
public class CorsFilter implements Filter {
3748

3849
private boolean allowCors;

0 commit comments

Comments
 (0)