Http_server
This tag will startup an HTTP server and bind it to the
host and port you specify. It will then create HTTP listeners
for the path and methods you specify and allow you to receive
each of the requests and do something with it. Now currently
each listener has as many threads as requests can come in, so
there is no throttling or pooling of request handling threads.
We will add this in the near future when it becomes a problem.
The other thing to note bout the http_server tag is that it
doe snot currently allow you to define any HTTP config values
but can easily be adapted to do so in the near future.
Events available within your http_listener include the same
event attributes that would be visible on the client side when
using any of the DTF HTTP tags and also include the following:
- http.[METHOD].path
-
This attribute contains the exact path that was hit with
your HTTP request.
Children Tags
Usage Examples
Example #1
<http_server port="8080">
<http_listener method="PUT" path="/oddtest">
<mod op1="${http.put.headers.number}" op2="2" result="result" />
<if>
<eq op1="${result}" op2="0" />
<then>
<http_response message="${http.put.headers.number} is even" status="200" />
</then>
<else>
<http_response message="${http.put.headers.number} is odd" status="200" />
</else>
</if>
</http_listener>
</http_server>
Example #2
<http_server port="8082">
<http_listener method="PUT" path="/echo-data">
<log>received [${http.put.body}] in the HTTP body</log>
<log>received headers [${http.headers}]</log>
</http_listener>
</http_server>
Example #3
<http_server command="stop" port="8082" />