You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Cameron Dalton <ca...@eim-usa.com> on 2012/05/28 16:13:52 UTC

Re: exits or overriding dispatcher

If I understand the problem correctly, it sounds like a simple servlet filter would do the job nicely.

Map the filter to the same URL pattern the Wink servlet is mapped to, put your pre-processing code in the doFilter method before the doChain call, and put that important post-processing code in the doFilter method *after* the doChain call. 

Alternatively, you can look into the jax-rs RequestHandler and ResponseHandler features. I'd go with the standard servlet filter if it were me, but the handlers wee an option.

Cameron 
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Anton Piatek1 <an...@uk.ibm.com> wrote:

I need to setup a special object for every connection which wink handles. This object needsto have its disconnect() method called on it before the request has been completely finished with (otherwise the remote resource fills up with a load of stale/cached handles). 

The simplest way to do this is if wink offered a pre/post exit-type facility, so I could setup a variable before any of my handler classes are invoked, and call the disconnect() after they are done. Is there any support in wink for this? 

If not, are there any examples of overriding the dispatcher so that I can add something just before and just after each handler method is invoked (or class created)? I don't want to have to completely implement the wink dispatcher, just add a line of code before and after a handler method is invoked. 

Regards, 

Anton


_____________________________________________


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU 







RE: exits or overriding dispatcher

Posted by Cameron Dalton <Ca...@eim-usa.com>.
errr...that "doChain" call should be "chain.doFilter" call.

I'm clearly on auto-pilot and talking crazy!

Cameron

________________________________
From: Cameron Dalton [cameron.dalton@eim-usa.com]
Sent: Monday, May 28, 2012 10:13 AM
To: wink-user@incubator.apache.org
Subject: Re: exits or overriding dispatcher

If I understand the problem correctly, it sounds like a simple servlet filter would do the job nicely.

Map the filter to the same URL pattern the Wink servlet is mapped to, put your pre-processing code in the doFilter method before the doChain call, and put that important post-processing code in the doFilter method *after* the doChain call.

Alternatively, you can look into the jax-rs RequestHandler and ResponseHandler features. I'd go with the standard servlet filter if it were me, but the handlers wee an option.

Cameron
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Anton Piatek1 <an...@uk.ibm.com> wrote:
I need to setup a special object for every connection which wink handles. This object needsto have its disconnect() method called on it before the request has been completely finished with (otherwise the remote resource fills up with a load of stale/cached handles).

The simplest way to do this is if wink offered a pre/post exit-type facility, so I could setup a variable before any of my handler classes are invoked, and call the disconnect() after they are done. Is there any support in wink for this?

If not, are there any examples of overriding the dispatcher so that I can add something just before and just after each handler method is invoked (or class created)? I don't want to have to completely implement the wink dispatcher, just add a line of code before and after a handler method is invoked.

Regards,

Anton


________________________________



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU