You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Dmytro Rud (JIRA)" <ji...@apache.org> on 2009/11/30 10:47:52 UTC

[jira] Created: (CAMEL-2237) Improper ordering of MINA filters

Improper ordering of MINA filters
---------------------------------

                 Key: CAMEL-2237
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-mina
    Affects Versions: 2.1.0
            Reporter: Dmytro Rud
         Attachments: camel-mina-20091130.patch

When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.

A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:

{quote}
<bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
    <constructor-arg>
        <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
    </constructor-arg>
</bean>

<bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
    <constructor-arg ref="hl7codec" />
</bean>

<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />

<bean id="minaFilters" class="java.util.ArrayList">
    <constructor-arg>
        <list value-type="org.apache.mina.common.IoFilter">
             <ref bean="sslFilter" /> 
             <ref bean="codecFilter" /> 
        </list>
    </constructor-arg>
</bean>
{quote}

After that, the consumer endpoint URL can look like
{{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.

I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56183#action_56183 ] 

Martin Krasser commented on CAMEL-2237:
---------------------------------------

Agreed.

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56182#action_56182 ] 

Claus Ibsen commented on CAMEL-2237:
------------------------------------

I wonder if we should invert the {{noDefaultCodec}} option as its kinda confusing to say true to something that is no.

Maybe it should be {{useDefaultCodec=false}} and let that option be default *true*.

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56169#action_56169 ] 

Claus Ibsen commented on CAMEL-2237:
------------------------------------

Maybe we can do as Jetty where you can specify a comma separated list of bean ids (ordered) for its security handlers.
That kinda avoids some of the ugly spring list constructs. 

And/or we can offer both combinations.

And why do you state its the _beginning_. The code for me looks like its inserted last
{code}
config.getFilterChain().addLast("codec", new ProtocolCodecFilter(codecFactory));
{code}

But I guess then others is added as {{addLast}} as well and then it end up as _first_, is this the case?

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56209#action_56209 ] 

Martin Krasser commented on CAMEL-2237:
---------------------------------------

Sure, I only got distracted with some other urgent things. I'll update the camel-mina Wiki page tomorrow.

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56189#action_56189 ] 

Claus Ibsen commented on CAMEL-2237:
------------------------------------

+1 to allow 

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Krasser resolved CAMEL-2237.
-----------------------------------

    Resolution: Fixed

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56171#action_56171 ] 

Martin Krasser commented on CAMEL-2237:
---------------------------------------

Right, camel-mina always uses the addLast() method on the filter chain.
Regarding the comma-separated list of bean ids, I'll take a look and try to add support for it.

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56187#action_56187 ] 

Martin Krasser commented on CAMEL-2237:
---------------------------------------

Maybe instead of using {{useDefaultCodec}} (with default value true) we should use {{allowDefaultCodec}} (with default value true) because a default codec is only installed if the {{codec}} parameter is {{null}} and the {{textline}} parameter is {{false}}. With {{useDefaultCodec}} a user might expect that the default codec is enforced (i.e. always used) which is not the case. An {{allowDefaultCodec}} parameter expresses more closely what the component is actually doing.

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Krasser reassigned CAMEL-2237:
-------------------------------------

    Assignee: Martin Krasser

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56207#action_56207 ] 

Claus Ibsen commented on CAMEL-2237:
------------------------------------

Martin do you mind updating the Mina wiki documentation with this new option?

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56200#action_56200 ] 

Martin Krasser commented on CAMEL-2237:
---------------------------------------

Patch applied with minor changes and thanks to Dmytro.

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Martin Krasser (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Krasser updated CAMEL-2237:
----------------------------------

    Fix Version/s: 2.2.0

Thanks for the patch Dmytro! I'll apply it (with minor changes) as soon as Camel 2.1.0 is out. 

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>            Assignee: Martin Krasser
>             Fix For: 2.2.0
>
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2237) Improper ordering of MINA filters

Posted by "Dmytro Rud (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmytro Rud updated CAMEL-2237:
------------------------------

    Attachment: camel-mina-20091130.patch

> Improper ordering of MINA filters
> ---------------------------------
>
>                 Key: CAMEL-2237
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2237
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0
>            Reporter: Dmytro Rud
>         Attachments: camel-mina-20091130.patch
>
>
> When we want to use SSL on the consumer side, MINA's SSLFilter must be inserted as the very first filter into the chain (or, at least, as the second one after an {{ExecutorFilter}}), but it is currently not possible, because {{MinaComponent#createSocketEndpoint()}} always inserts a {{ProtocolCodecFilter}} at the very beginning by calling {{configureCodecFactory()}}.
> A proposed workaround is to introduce an additional URL parameter _noDefaultCodec_ which prohibits the installation of the default protocol codec filter. The protocol codec must be then configured manually, e.g. using Spring:
> {quote}
> <bean id="sslFilter" class="org.apache.mina.filter.SSLFilter">
>     <constructor-arg>
>         <bean class="javax.net.ssl.SSLContext" factory-method="getDefault" />
>     </constructor-arg>
> </bean>
> <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
>     <constructor-arg ref="hl7codec" />
> </bean>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" />
> <bean id="minaFilters" class="java.util.ArrayList">
>     <constructor-arg>
>         <list value-type="org.apache.mina.common.IoFilter">
>              <ref bean="sslFilter" /> 
>              <ref bean="codecFilter" /> 
>         </list>
>     </constructor-arg>
> </bean>
> {quote}
> After that, the consumer endpoint URL can look like
> {{from("mina:tcp://0.0.0.0:8888?sync=true&lazySessionCreation=true&noDefaultCodec=true&filters=#minaFilters")}}.
> I am not sure whether this approach is optimal, therefore I call it "workaround" and not "solution".  The corresponding patch is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.