Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Short circuit Request #721

Open
sandy-adi opened this issue Feb 8, 2020 · 0 comments
Open

[Question] Short circuit Request #721

sandy-adi opened this issue Feb 8, 2020 · 0 comments

Comments

@sandy-adi
Copy link

sandy-adi commented Feb 8, 2020

I'm trying to short circuit request processing if a filter fails. For example, I've an authorization filter that should respond back with a 403 in case the user is not authorized to make the request. Currently I'm just calling stopFilterProcessing and setting an error end point on the context which basically relays a 403 back to the user. The response status of 403 is returned back to the user however the connection is kept alive and it finally times out. How can I make sure that the connection is terminated as well.

Here's sample code of what the filter would look like:

            context.stopFilterProcessing()
            context.set(Constants.RELAY_RESPONSE_CODE, HttpStatus.SC_FORBIDDEN)
            context.setErrorEndpoint(RelayResponse.class.getCanonicalName())
            context.setShouldSendErrorResponse(true)
            context.setError(new ClientException(HttpStatus.SC_FORBIDDEN))
            context.cancel()
@sandy-adi sandy-adi changed the title Short circuit Request [Question] Short circuit Request Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant