Hi

You can configure the jetty component regularly without the rest dsl,
and just refer to jetty as the component. Then the Rest DSL uses the
jetty with the security settings you have configured on it.

And I think we have fixed the double ? in the uri in the upcoming
2.14.1 release.

On Wed, Nov 5, 2014 at 10:53 AM, Roman Vottner <r...@gmx.at> wrote:
> 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



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to