This is a repost of the nabble forum entry as my account was obviously not 
correctly verified at the time when I posted this issue (post has NOT been 
accepted …). 

In order to test the new REST feature in 2.14.0 I created a simple route class: 

public class RestTestRoute extends RouteBuilder { 

   @Override 
   public void configure() throws Exception { 

       restConfiguration() 
           .component("jetty") 
           .port(8383) 
           .scheme("https") 
           .contextPath("/api/v1") 
           .endpointProperty("sslKeystore", "/security/serverKey.jks") 
           .endpointProperty("sslPassword", "keystorePW") 
           .endpointProperty("sslKeyPassword", "jettyPW") 
           // .componentProperty("sslContextParameters", 
"#sslContextParameters") 
           .componentProperty("handlers", "#jettyAuthHandler"); 

       rest("/service4") 
           .get().route().log("Service4 GET request received").endRest() 
           .post().route().log("Service4 POST request received").endRest() 
           .delete().route().log("Service4 DELETE request received").endRest(); 
   } 
} 

However, special-characters like "/" or ":" get replaced by "%2F" and "%3A" 
which cause a UnknownFormatConversionException: Conversion = 'F' in the primer 
case and a MissingFormatArgumentException: Format specifier '3A' in the latter 
case. As endpoint- or componentProperty only allows for string value 
declarations, I also tried to set Spring beans as used with a leading # before 
but without any success. 

If I leave out the sslKeystore stuff the example fails with a 
FileNotFoundException as it can't locate the keystore in my home-directory - 
which I have none. Though, I'd like to use the JKS located in the 
security-subfolder of my project. The documentation lacks a full example which 
showcases a bit more complex scenario. 

From debugging, I also figured out that the contextPath is not added on top of 
the "jetty:..." generated URL - is this only valid in servlet scenarios? 
Moreover, I'm a bit confused about the generated URL in JettyHttpComponent as 
it contains two '?' symbols: 

jetty:%s://%s:%s/%s?httpMethodRestrict=%s?sslPassword=keystorePW&sslKeyPassword=jettyPW&sslKeystore=%2Fsecurity%2FserverKey.jks

A simple test-project setup can be gathered in rest-dsl branch on github: 
https://github.com/RovoMe/CamelMultipleJettyComponents/tree/rest-dsl

Kind regards,

Roman

Reply via email to