Hi,

I want to set preemtive auth On of the servers, I am using http4 component,
going through various posts/camel documentation
(http://camel.apache.org/http4.html), I arrived at conclusion that I need to
set httpContext on the component/endpoint. I wrote a small piece of code to
create HttpContext and called the same in blueprint to set my bean in
registry as shown below:

public class HttpContextFactory {
        
Code-   
         
          public static HttpContext getObject(String httpHost,Integer httpPort) 
{
                  
                   HttpContext httpContext = new BasicHttpContext() ;
                  BasicAuthCache authCache = new BasicAuthCache();
                  BasicScheme basicAuth = new BasicScheme();
                    authCache.put(new HttpHost(httpHost, httpPort), basicAuth);
                 
                    httpContext.setAttribute(ClientContext.AUTH_CACHE, 
authCache);
                 
                    return httpContext;
                  }
          
          
          
        }



Blueprint -

<bean id="messageBrokerAuthContext"
class="manchanda.lalit.TryCxfSmooks.HttpContextFactory"
factory-method="getObject">
                <argument value="172.168.1.100"/>
                <argument value="1443"/>
        </bean>         
        


Usage - 

http4://172.168.1.100?authUsername=user&amp;authPassword=password&amp;httpContext=messageBrokerAuthContext


During execution I get  the following error-


Caused by: org.apache.camel.NoSuchBeanException: Found bean:
messageBrokerAuthCo
ntext in BlueprintContainer:
org.apache.aries.blueprint.container.BlueprintConta
inerImpl@c8f24 of type: org.apache.http.protocol.BasicHttpContext expected
type was: interface org.apache.http.protocol.HttpContext



This does not seem to be correct as it will never be possible to get
instance of HttpContext type it being an Interface.

How can I solve my problem of setting preemptive auth?

Regds
Lalit



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-HTTP4-not-able-to-use-httpContext-endpoint-option-tp5735937.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to