Feedback wanted: Allowing policies to modify PolicyFailures emitted by *other* policies in chain
by Marc Savy
Marvin Oßwald filed a really interesting issue:
https://issues.jboss.org/browse/APIMAN-1300
In short, if we imagine a policy chain like this:
[CORS, PolicyA, PolicyB]
Even if PolicyB emits a failure, then the CORS policy would likely
still want to be able to process the PolicyFailure to add the relevant
headers (otherwise a SPA type app like Angular would break).
This seems like a valid use-case.
Ideally I'd like to tackle this without breaking any existing interfaces.
A couple of quick ideas:
* Add a new interface that policies like CORS could implement that
indicates it wants to do this kind of processing. E.g.
IFailureProcessor or similar with a simple method signature like
#process(PolicyFailure failureToModify).
* An annotation: essentially the same as above, but with a
@WhateverWeCallIt annotation on the method that does the processing.
6 years, 4 months
Is it possible blocking request after request body parsing?
by 林 柏廷
Hi all,
I would like to customize a policy, which parses the request body and blocks the request in case.
in http://www.apiman.io/latest/developer-guide.html 4.2.1.2 IData policy, it describes:
The request or response body will not begin streaming before the corresponding doApply has been called, however, it is still possible to interrupt the conversation during the streaming phase by signalling doFailure or doError.
When I trace the transformation-policy source code, doApply() executes before getRequestDataHandler() which matches the description.
In doApply() I can blocks the request via chain.doFailure() however I have no idea how to interrupt/block request in getRequestDataHandler().
Besides, I found following mail group which is similar to my question.
Eric also points it's possible to parse the body before apply in request:
On Thu, Feb 2, 2017 at 10:31 PM, Eric Wittmann <
eric.wittmann at redhat.com> wrote:
The bottom line here is that you cannot return a Policy Failure (or
customize it) based on information in the response body. The response is
streamed from the back-end to the client, and at the time streaming begins,
the response code and HTTP headers have already been sent.
It sounds to me like you're asking for a feature where you can parse
the response body *before* the policy's "apply" method is invoked. we have
such a feature for requests, but not for responses. I suspect core changes
to apiman would be required to enable that. It seems like a reasonable
request to me, as long as users of the feature understand the performance
and memory requirements of enabling it.
-Eric
Thanks for any comments in advance.
Kind Regards
BT
6 years, 5 months
Help needed: Feedback/testing for Apiman on ES 5.x (and possibly ES 2.x)
by Marc Savy
Hi,
After spending the last week or more fiddling with test harness and CI
issues, we finally seem to be (almost) there.
I'd appreciate anyone who could test the latest an ES 5.x version of
Apiman for me. It still needs some tidying up, but should be
functional.
Steps:
git clone git@github.com:msavy/apiman.git
git checkout es5x
mvn clean install
cd distro/{distro of your choice}/target/{distro overlay zip of your choice}
handle the distro zip as you usually would a release (i.e. extract
overlay onto a server such as wildfly10)
Please modify apiman.properties to match your particular configuration
and try things out!
Regards,
Marc
6 years, 5 months