You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[On Before Send Batch Request Handler](#config-onBeforeSendBatchRequest)
29
+
-[.Net WebApi Configuation](#config-net)
30
+
-[Configuring for Java Servlet <= 3.1](#config-javaservlet)
31
+
21
32
22
33
## <aname="get-started"></a> Get Started
23
34
@@ -53,7 +64,7 @@ import { AppComponent } from "./app.component";
53
64
// Having this as an exported function enabled AOT complication as well :-)
54
65
exportfunctionhttpBatchConfigurationFactory() {
55
66
returnnewHttpBatchConfigurationCollection([
56
-
// this is a basic configuration object see [Configuration Object Options](#configuration)
67
+
// this is a basic configuration object see [Configuration Object Options]
57
68
// for more information on all the options
58
69
newHttpBatchConfiguration({
59
70
rootEndpointUrl:"https://api.myservice.com",
@@ -132,3 +143,56 @@ For example
132
143
### <aname="config-enabled"></a> Enabled
133
144
This optional parameter defaults to true. If false calls that would normally be batched to this endpoint will just be passed through as normal HTTP calls.
134
145
146
+
### <aname="config-minRequestsPerBatch"></a> Min Requests Per Batch
147
+
The minimum number of http requests that trigger a batch request to be sent.
148
+
149
+
Http calls are batched into groups. There is no point batching a single http call therefore the default smallest batch size is 2.
150
+
151
+
### <aname="config-maxRequestsPerBatch"></a> Max Requests Per Batch
152
+
The maximum number of http requests that can be batched in a single batch request.
153
+
154
+
Http calls are batched into groups. Batching hundreds of http calls into a single batch request might be unwise due to string processing times and the fact that you would not be taking advantage of being able to send to more than one http request to the same host of once. Therefore, the default max batch size is 20.
The period of time to wait in milliseconds between recieving the first http request and sending the batch.
158
+
159
+
This is undoubtedly the most important option. As this module tries to be as transparent as possible to the user.
160
+
161
+
The default time in milliseconds the http batcher should wait to collection all request to this domain after the first http call that can be batched has been collect. This defaults to 75ms. Therefore if you send a HTTP GET call that can be batched the HTTP batcher will receive this call and wait a further 75ms before sending the call in order to wait for other calls to the same domain in order to add them to the current batch request. If no other calls are collected the initial HTTP call will be allowed to continue as normal and will not be batched unless the config property - minRequestBatchSize is set to 2.
Requests with these http verbs will be ignored and not form part of the batch.
165
+
166
+
By default http requests with the verbs 'HEAD' & 'OPTIONS' are ignored.
167
+
168
+
### <aname="config-sendCookies"></a> Send Cookies
169
+
True to send cookies, defaults to false to reduce request size.
170
+
171
+
If this is set to true cookies available on the document.cookie property will be set in each segment of a batch request. Note that only non HTTPOnly cookies will be sent as HTTPOnly cookies cannot be access by JavaScript because of security limitations.
172
+
173
+
### <aname="config-uniqueRequestName"></a> Unique Request Name
174
+
An optional parameter to set a unique parameter name on the Content-Disposition header. This requires the a 'Content-Disposition' header is first set on the initial request sending in a Content-Disposition header. Sample configuration:
175
+
176
+
Some backend servers may require that each part be named in this manner. If the configuration above is used, then each part will have a header like this: Content-Disposition: form-data; name=batchRequest0
177
+
178
+
If a Content-Disposition header is not added in the request then this parameter is silently ignored.
179
+
180
+
## <aname="config-net"></a> Configuring .Net WebApi to accept batch requests
181
+
182
+
This is really simple the web api team have done a really good job here. To enable batch request handling you just add a new route to your application and the rest is done for you! It's so easy I don't see any reason for you not to do it! See this link for a more detailed setup guide. Just add the below code to your web api configuration class and you are good to go!
## <aname="config-javaservlet"></a> Configuring for Java Servlet <= 3.1
192
+
193
+
Java Servlet <= 3.1 parses multipart requests looking for the Content-Disposition header, expecting all multipart requests to include form data. It also expects a content disposition header per request part in the batch.
194
+
195
+
Therefore you will need to setup the library to do this. Add a 'Content-Disposition' header of 'form-data' and set the 'Unique Request Name' configuration option.
0 commit comments