How to explicitly terminate http connection from server with no response header
I am developing a server simulator for one of my client application. I am using GlassFish server. I have to simulate a http connection terminate condition in my server application.
Is there a way by which I can explicitly terminate a connection from server side such that client does not receive any response header. Curre开发者_开发问答ntly I have tried many options like closing the response outputStream. But in every case a http 200 OK message is delivered to the client application. I would like to consume the http-request and do not want to return anything to the client.
I am using a simple conrtroller servlet and had overridden doGet()
and doPost()
functions.
You're going to have difficulty persuading an appserver to do this, they're designed to be robust.
I suggest taking a look at Jetty, which is an embeddable and highly configurable HTTP/servlet framework which you can use as alternative to the appserver's built-in support. There's a good chance you'll be able to configure it with a customized connection handler, and hopefully perform your specific connection terminations.
精彩评论