Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Idiomatic "create an alias" handler?


Paul,

well a fluent style API would indeed be nice for this example.

But Jetty is 20 years old and "fluent" was only applied to french/italian back then :)     So Jetty is pretty much a pile of beans in it's fundamental style (although we are a little fluent in the latest client API).       It would be considerable bloat to go back over the entire API and provide fluent alternatives to the bean style.

Note also that you are being a little apple and orange in your comparison between the styles as you have assumed in the bean style that none of the defaults are right, but that they all are in the fluent example.

So you really should just be comparing to:

handlers.setHandlers(new Handler[] {new MovedContextHandler(server,"/lib/angular","/lib/angular_v1.2.9") , resource_handler, new DefaultHandler() });

cheers




On 27 November 2015 at 11:01, Paul Hammant <paul@xxxxxxxxxxx> wrote:
Hi Folks,

(Note - I'm not after "honor/recognize a unix/windows symlink or Alias")

I've created a "MovedContextHandler" in the test-logic of an OSS project - 

It is because I've source a test-web-app from another OSS project, and that one has one of two alternates for a certain 'angular' directory - https://github.com/angular/protractor/tree/master/testapp/lib and in their test suite (using 'express' not Jetty) they have one of the two alternates mapped to the shorter 'angular' directory.

Anyway, I'm doing:

MovedContextHandler effective_symlink = new MovedContextHandler();
effective_symlink.setNewContextURL("/lib/angular_v1.2.9");
effective_symlink.setContextPath("/lib/angular");
effective_symlink.setPermanent(false);
effective_symlink.setDiscardPathInfo(false);
effective_symlink.setDiscardQuery(false);
handlers.setHandlers(new Handler[] { effective_symlink, resource_handler, new DefaultHandler() }); 

I was hoping for a:

handlers.setHandlers(new Handler[] { tempForwardFrom("/lib/angular").to("lib/angular_v1.2.9"), resource_handler, new DefaultHandler() }); 

Or at least an elegant one-liner.

Regards,

- Paul

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--

Back to the top