Object built-in object

objectHttpHandler

httpProtocol conversion processor

to convert the data stream tohttpProtocol message, created by:

1
var hdlr = new mq.HttpHandler(...);

or:

1
var hdlr = new http.Handler(...);

inheritance relationship

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<class>Handler|new Handler()|invoke()] [<this>HttpHandler|new HttpHandler()|maxHeadersCount;maxBodySize;enableEncoding;serverName;handler|enableCrossOrigin()] [object] <:- [Handler] [Handler] <:- [HttpHandler] HttpHandler new HttpHandler() maxHeadersCount maxBodySize enableEncoding serverName handler enableCrossOrigin() Handler new Handler() invoke() object toString() toJSON()

Constructor

HttpHandler

CreatehttpA protocol handler object that converts the stream object's data intohttpmessage object

1
new HttpHandler(Handler hdlr);

Call parameters:

  • hdlr:Handler, built-in message handlers, handler functions, chained processing arrays, routing objects, see detailsmq.Handler

Member properties

maxHeadersCount

Integer, query and set the maximum number of request headers, the default is 128

1
Integer HttpHandler.maxHeadersCount;

maxBodySize

Integer, query and set the maximum size of the body, in MB, the default is 64

1
Integer HttpHandler.maxBodySize;

enableEncoding

Boolean, automatic decompression function switch, off by default

1
Boolean HttpHandler.enableEncoding;

serverName

String, query and set the server name, the default is: fibjs/0.x.0

1
String HttpHandler.serverName;

handler

Handler,httpProtocol conversion handler current event processing interface object

1
Handler HttpHandler.handler;

member function

enableCrossOrigin

Allow cross-domain requests

1
HttpHandler.enableCrossOrigin(String allowHeaders = "Content-Type");

Call parameters:

  • allowHeaders: String, specifies the acceptedhttpheader field

invoke

handle a message or object

1
Handler HttpHandler.invoke(object v) async;

Call parameters:

  • v:object, specifies the message or object to process

Return result:

  • Handler, return to the next handler

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be reimplemented according to its own characteristics

1
String HttpHandler.toString();

Return result:

  • String, returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns the set of readable properties defined by the object

1
Value HttpHandler.toJSON(String key = "");

Call parameters:

  • key: String, unused

Return result:

  • Value, returns a value containing JSON serializable