complete
Class:matlab.net.http.io.ContentProvider
Package:matlab.net.http.io
Complete HTTP header for ContentProvider
Syntax
complete(provider,URI)
Description
complete(
augments the header of the message with header fields required by this provider. Theprovider
,URI
)RequestMessage.send
andRequestMessage.complete
methods call this method before validating the header or adding any default fields, and before calling other methods in this class except forexpectedContentLength
.
This is where subclasses can add any fields to Header that depend on the content, such as Content-Type. See the description of theHeader
property for more information.
TheRequestMessage
如果消息已经完成,方法不调用此方法(也就是说RequestMessage.Completed
istrue
). However, a subsequent change to the message after completion resets theRequestMessage.Completed
property, allowing those methods to invoke this method again. Therefore, providers should be prepared for more than one call tocomplete
before a call tostart
. Oncestart
has been called, MATLAB®does not reinvokecomplete
in this provider unlessreusable
returnstrue
to indicate that this provider can be reused for another message.
AContentProvider
that extends anotherContentProvider
should first call its superclasscomplete
method to add header fields toHeader
that the superclass needs, and then, on return, modify those fields if desired.
The default behavior of this method does nothing, but throws an exception if this provider has been started and is not reusable. Providers that override this method should always invoke their superclass.
If this provider is not a multipart delegate, and you want to include a Content-Length field in the message (thereby avoiding chunked transfer coding), then you should return a nonempty value inexpectedContentLength
或插入一个Content-Lengt实现这个方法h field in theHeader
.
此方法未在带有一个的消息上调用完全的
property set totrue
, which generally means that this method is invoked only once per message, even if this message is resent multiple times. Implementations of this method should, therefore, perform any initialization that needs to be done only once per message. Costly initialization that does not need to be done until the data is ready to be sent should be performed in thestart
method.
Input Arguments
Attributes
Access |
protected |