incubator-wink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse A Ramos <jra...@us.ibm.com>
Subject Re: What is the best way, in a handler, to get the Entity and method that is going to be invoked?
Date Mon, 22 Nov 2010 22:16:11 GMT
Hi,

By "raw input" do you mean the message as it's sent over the wire?

This isn't the most straightforward thing to do since the InputStream can 
only be read once by the MessageBodyReader and the MBR's don't save the 
bytes off the InputStream while reading.  Because of this there isn't a 
way to get them back once we've passed through the MBR.

What you'll need to do is wrap the InputStream with your own so that you 
can intercept the bytes as they're being read.  One way to do this is to 
create a handler that runs earlier and wraps the HttpServletRequestWrapper 
with your own.  When getInputStream() is called, your 
HttpServletRequestWrapper wrapper would return your InputStream wrapper 
which could then save the bytes as the MBR reads them.

If you'd like a code example, we do this exact thing in 
org.apache.wink.server.internal.log.Request.  The purpose of the Request 
class is to log the request as it was sent over the wire if debug is 
enabled.  One caveat is that it may be difficult to have the data when you 
want it.  You can see in Request that we inject our wrapper and then 
advance the handler chain so that the MBR will eventually read the data. 
We then gain control once the chain sequence is done advancing and log the 
request at that point.

Hope this helps.
-- Jesse





From:   fishrick <fishmanrick@gmail.com>
To:     wink-user@incubator.apache.org
Date:   11/22/2010 03:34 PM
Subject:        Re: What is the best way, in a handler, to get the Entity 
and method that is going to be invoked?




Sorry, looks like we found it in SearchResult.getInvocationParameters(). 
Do
you know how to get the raw input so we can audit it?
-- 
View this message in context: 
http://apache-wink-users.3471013.n2.nabble.com/What-is-the-best-way-in-a-handler-to-get-the-Entity-and-method-that-is-going-to-be-invoked-tp5756400p5764504.html

Sent from the Apache Wink Users mailing list archive at Nabble.com.


Mime
View raw message