I was just trying to implement a Ratpack access-logging handler but the first stumbling block I hit was the c'tor of AccessEvent which requires HttpServletRequest and HttpServletResponse. This is bad since those are both Servlet-specific.
Assuming that the Access-logging system itself could be started up trivially and would offer something like add(AccessEvent) (instead of the current Tomcat-specific void invoke(Request request, Response response)), an implementation of such a Ratpack handler would be very easy. It would be possible to implement IAccessEvent from scratch but that would still pull in javax.servlet since it defines getters for request and response.
The other problem is that startup and shutdown of logback-access is currently implemented in LogbackValve, i.e. it's also entirely Tomcat-specific. It would make sense to extract that logic into a different class and just call it from LogbackValve or any other code that would like to use it.
See NcsaRequestLogger for an example.
In case of Ratpack, you'll receive a RequestOutcome containing a Request and a SentResponse.
|