- From: Yves Lafon <ylafon@w3.org>
- Date: Tue, 10 Feb 1998 18:03:29 +0100 (MET)
- To: Paul Pazandak <pazandak@OBJS.com>
- cc: www-jigsaw@w3.org
On Mon, 9 Feb 1998, Paul Pazandak wrote:
> If I return a reply in an ingoing filter (which would stop further
> processing of the
> request), what are the minimum set of fields that I need to populate in
> w3c.www.protocol.http.Reply? Do I only need to provide values for
> major, minor, status, and call setStream to set the content?
You need to create a Reply, according to the level of protocol used by using
Reply = req.makeReply(status);
where status is one of the HTTP status value as defined in
[org.]w3c.http.HTTP.java (an error value is 4xx, a OK value is 2xx...)
Then you have to fill the value needed to describe what you will fill in
this Reply. ex:
InputStream in;
[...]
reply = req.makeReply(HTTP.OK);
reply.setNoCache();
reply.setContentLength(c.getContentLength());
try {
mt = new MimeType(c.getContentType());
} catch (MimeTypeFormatException me) {
mt = MimeType.TEXT_PLAIN;
}
reply.setContentType(mt);
reply.setStream(in);
return reply;
or
reply.setContentLength(18);
reply.setContent("18 bytes length msg");
...
If you can provide good caching information, do so, as it will help
caches to handle that kind of reply.
/\ - Yves Lafon - World Wide Web Consortium -
/\ / \ Architecture Domain - Jigsaw
/ \ \/\
/ \ / \ http://www.w3.org/People/Lafon - ylafon@w3.org
Received on Tuesday, 10 February 1998 12:04:28 UTC