FAQ
Hi,

i created a customer jetty security handler and configured the spring
configuration file accordingly.
In the security handler i use my own "exec" camel component for the
authentication.

In short my "exec" component can executes external programs and makes use of
the
apache-commons-exec library.

The problem is that the OnCompletition's are not called. When is use the
component
in other routes everything works fine.

Here is the code from my "exec" producer that adds the OnCompletition:
exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO));


Here the security handler code:

String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args="
+ username + ";"
+ credentials;

ProducerTemplate template = camelContext.createProducerTemplate();
Exchange result = template.send(authEndpoint, new
DefaultExchange(camelContext));

Integer exitCode = result.getOut().getHeader(
ExecComponent.EXEC_EXITCODE, Integer.class);

--
View this message in context: http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Search Discussions

  • Claus Ibsen at Jan 22, 2010 at 9:04 am
    Hi

    Do you send directly to the endpoint of your custom component?
    Custom OnCompletion is triggered when you use a route.


    On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel wrote:

    Hi,

    i created a customer jetty security handler and configured the spring
    configuration file accordingly.
    In the security handler i use my own "exec" camel component for the
    authentication.

    In short my "exec" component can executes external programs and makes use of
    the
    apache-commons-exec library.

    The problem is that the OnCompletition's are not called. When is use the
    component
    in other routes everything works fine.

    Here is the code from my "exec" producer that adds the OnCompletition:
    exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO));


    Here the security handler code:

    String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args="
    + username + ";"
    + credentials;

    ProducerTemplate template = camelContext.createProducerTemplate();
    Exchange result = template.send(authEndpoint, new
    DefaultExchange(camelContext));

    Integer exitCode = result.getOut().getHeader(
    ExecComponent.EXEC_EXITCODE, Integer.class);

    --
    View this message in context: http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • SwenVogel at Jan 22, 2010 at 9:29 am
    Hi,

    i use the send() method of the producer template, like in the code snippet
    from the first post.

    Means "Custom OnCompletion is triggered when you use a route." that when
    i use a standard component for example "file" that the
    GenericFileOnCompletion is triggered?

    I thought that a component is like a encapsulated logical unit but it seems
    that the internal
    semantic changes when i use a route or the ProducerTemplate. It's a little
    bit confusing.

    For example when i write a component that must do some important kind of
    cleanup
    after processing, this cleanup must be done regardless whether i use a route
    or a
    ProducerTemplate.

    Is there a way to manually trigger the OnCompletitions's?



    Claus Ibsen-2 wrote:
    Hi

    Do you send directly to the endpoint of your custom component?
    Custom OnCompletion is triggered when you use a route.


    On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel wrote:

    Hi,

    i created a customer jetty security handler and configured the spring
    configuration file accordingly.
    In the security handler i use my own "exec" camel component for the
    authentication.

    In short my "exec" component can executes external programs and makes use
    of
    the
    apache-commons-exec library.

    The problem is that the OnCompletition's are not called. When is use the
    component
    in other routes everything works fine.

    Here is the code from my "exec" producer that adds the OnCompletition:
    exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO));


    Here the security handler code:

    String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args="
    + username + ";"
    + credentials;

    ProducerTemplate template = camelContext.createProducerTemplate();
    Exchange result = template.send(authEndpoint, new
    DefaultExchange(camelContext));

    Integer exitCode = result.getOut().getHeader(
    ExecComponent.EXEC_EXITCODE, Integer.class);

    --
    View this message in context:
    http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
    --
    View this message in context: http://old.nabble.com/Jetty-Security-Handler-tp27259580p27270602.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Claus Ibsen at Jan 22, 2010 at 9:35 am

    On Fri, Jan 22, 2010 at 10:29 AM, SwenVogel wrote:
    Hi,

    i use the send() method of the producer template, like in the code snippet
    from the first post.

    Means "Custom OnCompletion is triggered when you use a route." that when
    i use a standard component for example "file" that the
    GenericFileOnCompletion is triggered?

    I thought that a component is like a encapsulated logical unit but it seems
    that the internal
    semantic changes when i use a route or the ProducerTemplate. It's a little
    bit confusing.
    All the cross cutting functions such as interceptors, on completion,
    on exception is route based.
    Camel does a lot of stuff when building routes which allows it to
    weave in those cross cutting stuff at the right places etc.

    You can add some custom completion to your component if its important
    for your component that it does some cleanup etc.


    For example when i write a component that must do some important kind of
    cleanup
    after processing, this cleanup must be done regardless whether i use a route
    or a
    ProducerTemplate.

    Is there a way to manually trigger the OnCompletitions's?
    No, you can however use the asyncXXXCallback method from producer
    template which offers on completion callbacks


    Claus Ibsen-2 wrote:
    Hi

    Do you send directly to the endpoint of your custom component?
    Custom OnCompletion is triggered when you use a route.



    On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel <swen.vogel@ypsystems.de>
    wrote:
    Hi,

    i created a customer jetty security handler and configured the spring
    configuration file accordingly.
    In the security handler i use my own "exec" camel component for the
    authentication.

    In short my "exec" component can executes external programs and makes use
    of
    the
    apache-commons-exec library.

    The problem is that the OnCompletition's are not called. When is use the
    component
    in other routes everything works fine.

    Here is the code from my "exec" producer that adds the OnCompletition:
    exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO));


    Here the security handler code:

    String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args="
    + username + ";"
    + credentials;

    ProducerTemplate template = camelContext.createProducerTemplate();
    Exchange result = template.send(authEndpoint, new
    DefaultExchange(camelContext));

    Integer exitCode = result.getOut().getHeader(
    ExecComponent.EXEC_EXITCODE, Integer.class);

    --
    View this message in context:
    http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
    --
    View this message in context: http://old.nabble.com/Jetty-Security-Handler-tp27259580p27270602.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Claus Ibsen at Jan 22, 2010 at 11:13 am

    On Fri, Jan 22, 2010 at 10:29 AM, SwenVogel wrote:
    Hi,

    i use the send() method of the producer template, like in the code snippet
    from the first post.

    Means "Custom OnCompletion is triggered when you use a route." that when
    i use a standard component for example "file" that the
    GenericFileOnCompletion is triggered?

    I thought that a component is like a encapsulated logical unit but it seems
    that the internal
    semantic changes when i use a route or the ProducerTemplate. It's a little
    bit confusing.

    For example when i write a component that must do some important kind of
    cleanup
    after processing, this cleanup must be done regardless whether i use a route
    or a
    ProducerTemplate.

    Is there a way to manually trigger the OnCompletitions's?
    You can always manually invoke it

    Synchronization onComp = ...
    Exchange result = template.send(xxxx);

    comp.onComplete(result);





    Claus Ibsen-2 wrote:
    Hi

    Do you send directly to the endpoint of your custom component?
    Custom OnCompletion is triggered when you use a route.



    On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel <swen.vogel@ypsystems.de>
    wrote:
    Hi,

    i created a customer jetty security handler and configured the spring
    configuration file accordingly.
    In the security handler i use my own "exec" camel component for the
    authentication.

    In short my "exec" component can executes external programs and makes use
    of
    the
    apache-commons-exec library.

    The problem is that the OnCompletition's are not called. When is use the
    component
    in other routes everything works fine.

    Here is the code from my "exec" producer that adds the OnCompletition:
    exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO));


    Here the security handler code:

    String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args="
    + username + ";"
    + credentials;

    ProducerTemplate template = camelContext.createProducerTemplate();
    Exchange result = template.send(authEndpoint, new
    DefaultExchange(camelContext));

    Integer exitCode = result.getOut().getHeader(
    ExecComponent.EXEC_EXITCODE, Integer.class);

    --
    View this message in context:
    http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
    --
    View this message in context: http://old.nabble.com/Jetty-Security-Handler-tp27259580p27270602.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Huntc at Jan 23, 2010 at 7:52 pm
    Hi,

    I needed to adorn my own authorisation policy to Jetty endpoints a while
    back and so we subsequently modified the component. Take a look at
    http://camel.apache.org/jetty.html and the section entitled "Jetty handlers
    and security configuration".

    The approach uses JAAS.

    Maybe this will be useful to you.

    Kind regards,
    Christopher

    --
    View this message in context: http://old.nabble.com/Jetty-Security-Handler-tp27259580p27289340.html
    Sent from the Camel - Users mailing list archive at Nabble.com.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedJan 21, '10 at 3:30p
activeJan 23, '10 at 7:52p
posts6
users3
websitecamel.apache.org

3 users in discussion

Claus Ibsen: 3 posts SwenVogel: 2 posts Huntc: 1 post

People

Translate

site design / logo © 2022 Grokbase