tibcobusinessworks

Getting the HTTP Request from a TIBCO BW Process


I have a TIBCO BW process which starts with the 'HTTP Receiver' Activity.

I'd like to obtain (via a custom Java Code activity) the size of the original HTTP request. (The purpose is to collect statistics, measure response times, request/response sizes etc.)

I'd like to measure the data in bytes and not in characters, is it possible to get the request as a byte array, ServletInputStream or something similar?


Solution

  • I don't think you can get the original request from Java code - simply because you cannot access the HTTPServletRequest object of the HTTP Receiver from a Java activity. If you'd like to access the raw request data, you may write a proxy servlet and access BusinessWorks via this proxy servlet.

    If your task is only to get stats on the request size, there is a simpler solution. You can use the "Content-length" header parameter for this reason (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).

    The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient

    Content-length is an output parameter of the HTTP receiver. You may need to add the length of "RequestURI", "PostData" and "Header" parameters as they are not part of the entity body.


    Update: PostData is part of entity-body, therefore its size is included in Content-length