Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5863

JettyHTTPServerEngineFactoryHolder does not support Handlers



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.10, 3.0
    • 2.6.15, 2.7.12, 3.0.1
    • Transports
    • Apache SMX 5.0.0
      Apache Camel 2.12.3
      Java 1.7.0_25

    • Unknown


      I've been trying to add basic authentication to my CXF Web Service (using Apache Camel 2.12.3 and SMX 5.0.0), and I had hoped that I would be able to use the http://cxf.apache.org/transports/http-jetty/configuration namespace to configure it, with the following in my blueprint file:

      <httpj:engine-factory bus="cxf"> 
          <httpj:engine port="${fromCxfEndpointUri.port}"> 
                  <!-- BASIC AUTHENTICATION configuration --> 
                  <ref bean="securityHandler"/>
      <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">

      But as it turns out, that's not possible - I was unable to get it to recognise the handler - nothing I could do would make SMX recognise that element (I had tried with an invalid bean id, in the hope that it would raise an error, but it never did). In addition to <ref bean="securityHandler"/>, I also tried <ref component-id="securityHandler"/>, but to no avail.

      After hunting around for some time, I eventually found the following in org.apache.cxf.transport.http_jetty.blueprint.JettyHTTPServerEngineFactoryHolder:

      if (engine.isContinuationsEnabled() != null) {
      // eng.setHandlers(engine.getHandlers());
      if (engine.getHost() != null && !StringUtils.isEmpty(engine.getHost())) {

      Note, particularly, the line // eng.setHandlers(engine.getHandlers()); (line 119) - it never actually adds the handlers.

      Now, I don't imagine the solution is as simple as just uncommenting that line, but it would be really nice if we could have one of the following:

      1. Handler support implemented
      2. An exception to be thrown if handlers are detected, saying they're not supported
      3. A warning / error message logged if handlers are detected, saying they're not supported.

      It's a bit frustrating, as everything else seemed to work, so I was a bit perplexed as to why this one thing didn't. Unfortunately, I don't have the time (or the knowledge, frankly) to fix this myself.




            njiang Willem Jiang
            ipsi Andrew
            0 Vote for this issue
            2 Start watching this issue