You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Chris Odom <ch...@mediadriver.com> on 2012/04/26 21:09:18 UTC

DefaultJettyHttpBinding


Has anyone every used this class? Currently I have implemented this
strategy with in my JetyHttpComponent but no matter what happens my
override methods never get called. In debug the jettyHttpBind property gets
set to my Spring bean as I guess it suppose to but like I said I never ever
get to my override methods. Any help in this would be greatly appreciated.


Spring config 

-- 
Thanks,
Chris Odom
512:799-0270
 

Re: DefaultJettyHttpBinding

Posted by Willem Jiang <wi...@gmail.com>.
On Sat Apr 28 23:12:16 2012, Chris Odom wrote:
> Thanks so much Jiang for your response. I was able to get the
> DefaultHttpBinding up and working using the httpBindingRef on the URI. I
> guess the most confusing thing about all this is the example for
> 'Customizing HttpBinding' on the Camel Jetty page
> 'http://camel.apache.org/jetty.html'. Not really sure who has ownership of
> said page but that section definitely needs some updating. The wording
> above the example is exactly what you stated in that you use the
> DefaultHttpBinding but the example below it shows the class extending the
> DefaultJettyHttpBinding which is really confusing.

I just update the wiki page for it.

>
> On another note when implementing this solution I noticed that when
> extending the DefaultHttpBinding the default constructor is deprecated. The
> one and only valid constructor I can see requires an HttpEndpoint. When
> using this in Spring should we be creating HttpEndpoint bean that are DI'd
> into the DefaultHttpBinding bean for Spring construction?

I think we should at least to keep the default constructor for people 
to inject their customer HttpBinding to use.
Please feel free to log a JIRA for it.

>
> Thanks again.
>
> On Sat, 28 Apr 2012 09:59:18 +0800, Willem Jiang<wi...@gmail.com>
> wrote:
>> Hi,
>>
>> If you check the Java doc of the JettyHttpBinding, you will find it is
>> just used for JettyHttpProducer.
>> Your test case just showed it.
>>
>> But for your real use case, you need to extends the DefaultHttpBinding
>> which will be used in the JettyHttpConsumer.
>> Please update the HttpBinding attribute of the JettyHttpComponent with
>> your customer HttpBinding.
>>
>>
>> On Sat Apr 28 01:07:18 2012, Chris Odom wrote:
>>> First off thanks for your reply and I am using a vanilla install of
>>> apache-servicemix-4.4.1-fuse-03-06. What didn't happen was in the
>>> original
>>> email in the 'Spring config' below you should have seen my
> configuration
>>> of
>>> the JettyHttpComponent with jettyHttpBinding.
>>>
>>> Spring config:
>>>
>>> <bean id="jetty"
>>> class="org.apache.camel.component.jetty.JettyHttpComponent">
>>>       <property name="sslSocketConnectorProperties">
>>>           <map>
>>>               <entry key="password"
>>> value="${com.cvs.rxdw.emh.http.sslPassword}"/>
>>>               <entry key="keyPassword"
>>> value="${com.cvs.rxdw.emh.http.sslKeyPassword}"/>
>>>               <entry key="keystore"
>>> value="file:${com.cvs.rxdw.emh.http.keystore}"/>
>>>           </map>
>>>       </property>
>>>       <property name="httpClientMinThreads"
>>> value="${com.cvs.rxdw.emh.http.httpClientMinThreads}"/>
>>>       <property name="httpClientMaxThreads"
>>> value="${com.cvs.rxdw.emh.http.httpClientMaxThreads}"/>
>>>       <property name="jettyHttpBinding" ref="httpResponseBinding"/>
>>> </bean>
>>>
>>> <bean id="httpResponseBinding"
>>> class="com.cvs.rxdw.emh.binding.HttpResponseBinding">
>>>       <property name="transferException" value="true"/>
>>>       <property name="throwExceptionOnFailure" value="true"/>
>>> </bean>
>>>
>>> Is this configuration I just inject the bean value into the Component.
>>> Upon debugging the value is set and seems to be init'd correctly.
>>> I have tried to create a URI based on the the jettyHttpBindingRef as
> well
>>> and get the exact same initialization as doing it above.
>>>
>>> Spring config:
>>>
>>> <bean id="httpReqResRoute"
>>> class="com.cvs.rxdw.emh.route.HttpReqResRoute">
>>>       <property name="acceptURL"
>>>
> value="jetty:https://${com.some.servername}:${com.some.port}?jettyHttpBindingRef=httpResponseBinding&matchOnUriPrefix=true"
>>> />
>>>       <property name="queueName"
> value="${com.cvs.rxdw.emh.jms.queueName}"
>>> />
>>> </bean>
>>>
>>>
>>>
>>> If I create a camel support test that directly uses the endpoint on a
>>> producer template, so something like:
>>>
>>>    Object result =
>>> template.requestBody("jetty:https://someserver:someport/",
>>> getSampleMessage("Request.xml"));
>>>
>>> the binding works.
>>>
>>> If I deploy this code into a Servicemix container where Camel actually
>>> stands up a Servlet, CamelContinuationServlet, the binding references
> can
>>> be found on the endpoint on the Camel HttpConsumer but it never gets
>>> called. I did some digging into this continuation pattern and the Camel
>>> code that it represents to see that there is really no code that tries
> to
>>> use the Camel HttpConsumer to call the bindings. Not really sure why
> this
>>> happens but it makes since why the camel endpoint component tests are
>>> passing but in a real scenario where Camel front ends the component
> with
>>> this CamelContinuationServlet nothing happens.
>>>
>>>
>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>           http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>



--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Re: DefaultJettyHttpBinding

Posted by Chris Odom <ch...@mediadriver.com>.
Thanks so much Jiang for your response. I was able to get the
DefaultHttpBinding up and working using the httpBindingRef on the URI. I
guess the most confusing thing about all this is the example for
'Customizing HttpBinding' on the Camel Jetty page
'http://camel.apache.org/jetty.html'. Not really sure who has ownership of
said page but that section definitely needs some updating. The wording
above the example is exactly what you stated in that you use the
DefaultHttpBinding but the example below it shows the class extending the
DefaultJettyHttpBinding which is really confusing.

On another note when implementing this solution I noticed that when
extending the DefaultHttpBinding the default constructor is deprecated. The
one and only valid constructor I can see requires an HttpEndpoint. When
using this in Spring should we be creating HttpEndpoint bean that are DI'd
into the DefaultHttpBinding bean for Spring construction?

Thanks again.

On Sat, 28 Apr 2012 09:59:18 +0800, Willem Jiang <wi...@gmail.com>
wrote:
> Hi,
> 
> If you check the Java doc of the JettyHttpBinding, you will find it is 
> just used for JettyHttpProducer.
> Your test case just showed it.
> 
> But for your real use case, you need to extends the DefaultHttpBinding 
> which will be used in the JettyHttpConsumer.
> Please update the HttpBinding attribute of the JettyHttpComponent with 
> your customer HttpBinding.
> 
> 
> On Sat Apr 28 01:07:18 2012, Chris Odom wrote:
>> First off thanks for your reply and I am using a vanilla install of
>> apache-servicemix-4.4.1-fuse-03-06. What didn't happen was in the
>> original
>> email in the 'Spring config' below you should have seen my
configuration
>> of
>> the JettyHttpComponent with jettyHttpBinding.
>>
>> Spring config:
>>
>> <bean id="jetty"
>> class="org.apache.camel.component.jetty.JettyHttpComponent">
>>      <property name="sslSocketConnectorProperties">
>>          <map>
>>              <entry key="password"
>> value="${com.cvs.rxdw.emh.http.sslPassword}"/>
>>              <entry key="keyPassword"
>> value="${com.cvs.rxdw.emh.http.sslKeyPassword}"/>
>>              <entry key="keystore"
>> value="file:${com.cvs.rxdw.emh.http.keystore}"/>
>>          </map>
>>      </property>
>>      <property name="httpClientMinThreads"
>> value="${com.cvs.rxdw.emh.http.httpClientMinThreads}"/>
>>      <property name="httpClientMaxThreads"
>> value="${com.cvs.rxdw.emh.http.httpClientMaxThreads}"/>
>>      <property name="jettyHttpBinding" ref="httpResponseBinding"/>
>> </bean>
>>
>> <bean id="httpResponseBinding"
>> class="com.cvs.rxdw.emh.binding.HttpResponseBinding">
>>      <property name="transferException" value="true"/>
>>      <property name="throwExceptionOnFailure" value="true"/>
>> </bean>
>>
>> Is this configuration I just inject the bean value into the Component.
>> Upon debugging the value is set and seems to be init'd correctly.
>> I have tried to create a URI based on the the jettyHttpBindingRef as
well
>> and get the exact same initialization as doing it above.
>>
>> Spring config:
>>
>> <bean id="httpReqResRoute"
>> class="com.cvs.rxdw.emh.route.HttpReqResRoute">
>>      <property name="acceptURL"
>>
value="jetty:https://${com.some.servername}:${com.some.port}?jettyHttpBindingRef=httpResponseBinding&matchOnUriPrefix=true"
>> />
>>      <property name="queueName"
value="${com.cvs.rxdw.emh.jms.queueName}"
>> />
>> </bean>
>>
>>
>>
>> If I create a camel support test that directly uses the endpoint on a
>> producer template, so something like:
>>
>>   Object result =
>> template.requestBody("jetty:https://someserver:someport/",
>> getSampleMessage("Request.xml"));
>>
>> the binding works.
>>
>> If I deploy this code into a Servicemix container where Camel actually
>> stands up a Servlet, CamelContinuationServlet, the binding references
can
>> be found on the endpoint on the Camel HttpConsumer but it never gets
>> called. I did some digging into this continuation pattern and the Camel
>> code that it represents to see that there is really no code that tries
to
>> use the Camel HttpConsumer to call the bindings. Not really sure why
this
>> happens but it makes since why the camel endpoint component tests are
>> passing but in a real scenario where Camel front ends the component
with
>> this CamelContinuationServlet nothing happens.
>>
>>
> 
> 
> 
> --
> Willem
> ----------------------------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>          http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang

-- 
Thanks,
Chris Odom
512:799-0270

Re: DefaultJettyHttpBinding

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

If you check the Java doc of the JettyHttpBinding, you will find it is 
just used for JettyHttpProducer.
Your test case just showed it.

But for your real use case, you need to extends the DefaultHttpBinding 
which will be used in the JettyHttpConsumer.
Please update the HttpBinding attribute of the JettyHttpComponent with 
your customer HttpBinding.


On Sat Apr 28 01:07:18 2012, Chris Odom wrote:
> First off thanks for your reply and I am using a vanilla install of
> apache-servicemix-4.4.1-fuse-03-06. What didn't happen was in the original
> email in the 'Spring config' below you should have seen my configuration of
> the JettyHttpComponent with jettyHttpBinding.
>
> Spring config:
>
> <bean id="jetty"
> class="org.apache.camel.component.jetty.JettyHttpComponent">
>      <property name="sslSocketConnectorProperties">
>          <map>
>              <entry key="password"
> value="${com.cvs.rxdw.emh.http.sslPassword}"/>
>              <entry key="keyPassword"
> value="${com.cvs.rxdw.emh.http.sslKeyPassword}"/>
>              <entry key="keystore"
> value="file:${com.cvs.rxdw.emh.http.keystore}"/>
>          </map>
>      </property>
>      <property name="httpClientMinThreads"
> value="${com.cvs.rxdw.emh.http.httpClientMinThreads}"/>
>      <property name="httpClientMaxThreads"
> value="${com.cvs.rxdw.emh.http.httpClientMaxThreads}"/>
>      <property name="jettyHttpBinding" ref="httpResponseBinding"/>
> </bean>
>
> <bean id="httpResponseBinding"
> class="com.cvs.rxdw.emh.binding.HttpResponseBinding">
>      <property name="transferException" value="true"/>
>      <property name="throwExceptionOnFailure" value="true"/>
> </bean>
>
> Is this configuration I just inject the bean value into the Component.
> Upon debugging the value is set and seems to be init'd correctly.
> I have tried to create a URI based on the the jettyHttpBindingRef as well
> and get the exact same initialization as doing it above.
>
> Spring config:
>
> <bean id="httpReqResRoute" class="com.cvs.rxdw.emh.route.HttpReqResRoute">
>      <property name="acceptURL"
> value="jetty:https://${com.some.servername}:${com.some.port}?jettyHttpBindingRef=httpResponseBinding&amp;matchOnUriPrefix=true"
> />
>      <property name="queueName" value="${com.cvs.rxdw.emh.jms.queueName}"
> />
> </bean>
>
>
>
> If I create a camel support test that directly uses the endpoint on a
> producer template, so something like:
>
>   Object result =
> template.requestBody("jetty:https://someserver:someport/",
> getSampleMessage("Request.xml"));
>
> the binding works.
>
> If I deploy this code into a Servicemix container where Camel actually
> stands up a Servlet, CamelContinuationServlet, the binding references can
> be found on the endpoint on the Camel HttpConsumer but it never gets
> called. I did some digging into this continuation pattern and the Camel
> code that it represents to see that there is really no code that tries to
> use the Camel HttpConsumer to call the bindings. Not really sure why this
> happens but it makes since why the camel endpoint component tests are
> passing but in a real scenario where Camel front ends the component with
> this CamelContinuationServlet nothing happens.
>
>



--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Re: DefaultJettyHttpBinding

Posted by Chris Odom <ch...@mediadriver.com>.
First off thanks for your reply and I am using a vanilla install of
apache-servicemix-4.4.1-fuse-03-06. What didn't happen was in the original
email in the 'Spring config' below you should have seen my configuration of
the JettyHttpComponent with jettyHttpBinding.

Spring config:

<bean id="jetty"
class="org.apache.camel.component.jetty.JettyHttpComponent">
    <property name="sslSocketConnectorProperties">
        <map>
            <entry key="password"
value="${com.cvs.rxdw.emh.http.sslPassword}"/>
            <entry key="keyPassword"
value="${com.cvs.rxdw.emh.http.sslKeyPassword}"/>
            <entry key="keystore"
value="file:${com.cvs.rxdw.emh.http.keystore}"/>
        </map>
    </property>
    <property name="httpClientMinThreads"
value="${com.cvs.rxdw.emh.http.httpClientMinThreads}"/>
    <property name="httpClientMaxThreads"
value="${com.cvs.rxdw.emh.http.httpClientMaxThreads}"/>
    <property name="jettyHttpBinding" ref="httpResponseBinding"/>
</bean>
    
<bean id="httpResponseBinding"
class="com.cvs.rxdw.emh.binding.HttpResponseBinding">
    <property name="transferException" value="true"/>
    <property name="throwExceptionOnFailure" value="true"/>
</bean>

Is this configuration I just inject the bean value into the Component.
Upon debugging the value is set and seems to be init'd correctly.
I have tried to create a URI based on the the jettyHttpBindingRef as well
and get the exact same initialization as doing it above.

Spring config:

<bean id="httpReqResRoute" class="com.cvs.rxdw.emh.route.HttpReqResRoute">
    <property name="acceptURL"
value="jetty:https://${com.some.servername}:${com.some.port}?jettyHttpBindingRef=httpResponseBinding&amp;matchOnUriPrefix=true"
/>
    <property name="queueName" value="${com.cvs.rxdw.emh.jms.queueName}"
/>
</bean>



If I create a camel support test that directly uses the endpoint on a
producer template, so something like:

 Object result =
template.requestBody("jetty:https://someserver:someport/",
getSampleMessage("Request.xml")); 

the binding works. 

If I deploy this code into a Servicemix container where Camel actually
stands up a Servlet, CamelContinuationServlet, the binding references can
be found on the endpoint on the Camel HttpConsumer but it never gets
called. I did some digging into this continuation pattern and the Camel
code that it represents to see that there is really no code that tries to
use the Camel HttpConsumer to call the bindings. Not really sure why this
happens but it makes since why the camel endpoint component tests are
passing but in a real scenario where Camel front ends the component with
this CamelContinuationServlet nothing happens.


-- 
Thanks,
Chris Odom
512:799-0270

On Fri, 27 Apr 2012 07:53:47 +0200, Claus Ibsen <cl...@gmail.com>
wrote:
> Hi
> 
> Yes its in use. What version of Camel are you using?
> And you need to either configure it on the jetty http component, or on
> the endpoint with the option name jettyHttpBindingRef
> 
> 
> On Thu, Apr 26, 2012 at 9:09 PM, Chris Odom <ch...@mediadriver.com>
> wrote:
>>
>>
>> Has anyone every used this class? Currently I have implemented this
>> strategy with in my JetyHttpComponent but no matter what happens my
>> override methods never get called. In debug the jettyHttpBind property
>> gets
>> set to my Spring bean as I guess it suppose to but like I said I never
>> ever
>> get to my override methods. Any help in this would be greatly
>> appreciated.
>>
>>
>> Spring config
>>
>> --
>> Thanks,
>> Chris Odom
>> 512:799-0270
>>


Re: DefaultJettyHttpBinding

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yes its in use. What version of Camel are you using?
And you need to either configure it on the jetty http component, or on
the endpoint with the option name jettyHttpBindingRef


On Thu, Apr 26, 2012 at 9:09 PM, Chris Odom <ch...@mediadriver.com> wrote:
>
>
> Has anyone every used this class? Currently I have implemented this
> strategy with in my JetyHttpComponent but no matter what happens my
> override methods never get called. In debug the jettyHttpBind property gets
> set to my Spring bean as I guess it suppose to but like I said I never ever
> get to my override methods. Any help in this would be greatly appreciated.
>
>
> Spring config
>
> --
> Thanks,
> Chris Odom
> 512:799-0270
>



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/