users@grizzly.java.net

How to cancel a request in a HttpHandler?

From: gOA-pSY <goa-psy_at_gmx.net>
Date: Tue, 10 Jul 2012 13:20:01 +0200

Hello,

I have an instance of a org.glassfish.grizzly.http.server.HttpServer and
I added an org.glassfish.grizzly.http.server.HttpHandler instance.

Now I have to implement the

public void service(final Request request, final Response response)
throws Exception {}

method.

Now I need to look at the request and if certain conditions match, I
want to "cancel" the request and immediately reply with different status
codes. Currently the client has to complete the request (some MB of
data) but I don't want to waste bandwith on both sides.

If I call request.getRequest().getConnection().close() nothing is sent
to the client but at least the upload is canceled.

Does anyone have a hint how to solve this issue?

Greetings