On Jun 27, 2014, at 9:52 AM, Acácio Centeno <[email protected]> wrote:

> Hello,
> 
> I've written an ATS plugin -- based on James Peach's intercept
> example plugin -- that tries to find an object on a list of
> servers.  It first chooses (randomly) one server on the list,
> sends the request to it and checks its response. If the server
> fails to answer or answers with a status that is on a list of
> ``faulty'' statii, then the plugin tries the next server.
> 
> In order to have a copy of the original request to send to the
> other servers, I've created a TSIOBuffer object and copied the
> request into it, which is fine if the request fits in the buffer,
> but I was wondering what would happen if it didn't (for instance,
> while handling a POST request).

TSIOBuffer grows to as much data as you can put in it. However, for this use 
case, you need to be able to read fro it multiple times. I'm not sure whether 
you can preserve the data in it, or whether it will get tossed as the buffer 
reader streams it out.

> 
> Do you think this approach of creating a TSIOBuffer and copying
> the request to it is the best way of backing up the request?
> Which other options would be available?

The other option is to do something like what the escalation plugin does. 
Transform the faulty status into a redirect, then tell the core to follow the 
redirect. I'd be interested to hear whether this approach works with POST 
requests.

> 
> Thank you,
> -- 
> Acácio Centeno
> 
> Porto Alegre, Brasil + 55 51 3012 3005
> Miami, USA + 1 305 704 8816
> 
> Quaisquer informações contidas neste e-mail e anexos podem ser
> confidenciais e privilegiadas, protegidas por sigilo legal. Qualquer forma
> de utilização deste documento depende de autorização do emissor, sujeito as
> penalidades cabíveis.
> 
> Any information in this e-mail and attachments may be confidential and
> privileged, protected by legal confidentiality. The use of this document
> require authorization by the issuer, subject to penalties.

Reply via email to