[MOBY-dev] an easy way to see the input/output size whenusingjMoby?

Martin Senger martin.senger at gmail.com
Sun May 27 19:28:32 UTC 2007


> However, the best would be to have a realistic size in bytes but it's
> not a real need.


To comply with the Ivan's request, I have added few new methods to the
BaseService (the class that is used by all Moses-based services):

* getHTTPHeaders() will allow the service to inspect what headers were used
to deliver a request

* getRequestLength() is only a convenient method extracting one particular
header from the HTTP headers

* getServletRequest() accessing all the richness of the servlet context.

Together with already existing method getCallerAddr() you can, for example,
have in your service the following code:

log.info ("Request length: " + getRequestLength());
log.info ("Request from: " + getCallerAddr());
log.debug ("Request URL: " + getServletRequest().getRequestURL());
log.debug ("Request headers: " + getHTTPHeaders().toString());

In the src/samples, there is a new testing service (registered in the usual
Central registry) TestServiceNotes that prints similar things in the service
notes.

Cheers,
Martin

-- 
Martin Senger
   email: martin.senger at gmail.com
   skype: martinsenger



More information about the MOBY-dev mailing list