Hi Aliosha,

As you have included a send mediator in your inSequence, it gets executed
once "MySequence" completed when you set continueAfter=true.
Please refer [1] on the functionality of Conditional Router Mediator.

You could fulfil your requirement by using Filter Mediator. Please refer
[2], it has given an example for a regular expression as well.

[1] https://docs.wso2.com/display/ESB481/Conditional+Router+Mediator
[2] https://docs.wso2.com/display/ESB481/Filter+Mediator

Thank you.

On Thu, Mar 12, 2015 at 11:05 AM, Jagath Ariyananda <[email protected]> wrote:

> [Removed [email protected] from this thread]
> Please only use [email protected] for this type of queries.
>
> Regards
>
> On Thu, Mar 12, 2015 at 10:10 AM, Sriashalya Srivathsan <[email protected]>
> wrote:
>
>> Hi Aliosha,
>> I think your condition is getting failed or it has some problem. Can you
>> try filter mediators instead of condition.
>>
>> On Thu, Jan 29, 2015 at 2:00 AM, Aliosha <[email protected]> wrote:
>>
>>> im on WSO2 ESB 4.8.1. I need to block some request if their path match a
>>> regular expression. So i've implemented this proxy and these sequences:
>>>
>>> In my proxy:
>>>
>>>   <target>
>>>   <inSequence>
>>>      <sequence key="MySequence"></sequence>
>>>      <send>
>>>          <endpoint key="epProva"></endpoint>
>>>      </send>
>>>   </inSequence>
>>>
>>> Where MySequence is:
>>>
>>> <sequence xmlns="http://ws.apache.org/ns/synapse"; name="MySequence">
>>>      <conditionalRouter continueAfter="false">
>>>         <conditionalRoute breakRoute="true" asynchronous="true">
>>>            <condition>
>>>               <match type="url" regex=".*/my/path/.*"></match>
>>>            </condition>
>>>            <target sequence="conf:/BannedListMessage"></target>
>>>         </conditionalRoute>
>>>      </conditionalRouter>
>>> </sequence>
>>>
>>> where BannedListMessage is:
>>>
>>> <sequence xmlns="http://ws.apache.org/ns/synapse";>
>>>    <header name="To" action="remove"></header>
>>>    <property name="HTTP_SC" value="401" scope="axis2"></property>
>>>    <property name="RESPONSE" value="true"></property>
>>>    <property name="NO_ENTITY_BODY" action="remove" scope="axis2"></property>
>>>    <payloadFactory media-type="json">
>>>       <format>
>>>         {"code":"401", "unhautorized."}
>>>      </format>
>>>   </payloadFactory>
>>>   <property name="messageType" value="application/json" 
>>> scope="axis2"></property>
>>>    <send></send>
>>> </sequence>
>>>
>>> MySquence has the job to check if the request url matches the regular
>>> expression and, in that case, it has to block the request's flow, before it
>>> can reach the server, and to call the BannedListMessage sequence which will
>>> send back an error response (401) to the client.
>>>
>>> During my attempts i noticed that
>>>
>>>    -
>>>
>>>    if the attribute continueAfter=true in MySequence i get the 401
>>>    "unauthorized" error as response but the request reach the server.
>>>    -
>>>
>>>    If i set continueAfter="false" i receive a 202 Accepted response and
>>>    the request doesn't reach the server.
>>>
>>> My target is to send the BannedListMessage 401 error to the client and
>>> to block the request. What have i to do?
>>> Regards
>>> Alessio
>>>
>>
>>
>>
>> --
>> S.Sriashalya,
>> Associate Software Engineer,
>> WSO2.
>>
>
>
>
> --
> Jagath Ariyananda
> Director - Support
> WSO2, Inc.
> Mobile:+94 714887531
>
> Disclaimer: This communication may contain privileged or other
> confidential information and is intended exclusively for the addressee/s.
> If you are not the intended recipient/s, or believe that you may have
> received this communication in error, please reply to the sender indicating
> that fact and delete the copy you received and in addition, you should not
> print, copy, retransmit, disseminate, or otherwise use the information
> contained in this communication. Internet communications cannot be
> guaranteed to be timely, secure, error or virus-free. The sender does not
> accept liability for any errors or omissions.
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Best Regards,

*Thilini Cooray*
Software Engineer
Mobile : +94 (0) 774 570 112 <%2B94%20%280%29%20773%20451194>
E-mail : [email protected]

WSO2 Inc. www.wso2.com
lean.enterprise.middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to