use of org.eclipse.jetty.rewrite.handler.RedirectPatternRule in project hive by apache.
the class Main method addRedirects.
public void addRedirects(Server server) {
RewriteHandler rewrite = new RewriteHandler();
RedirectPatternRule redirect = new RedirectPatternRule();
redirect.setPattern("/templeton/v1/application.wadl");
redirect.setLocation("/templeton/application.wadl");
rewrite.addRule(redirect);
HandlerList handlerlist = new HandlerList();
ArrayList<Handler> handlers = new ArrayList<Handler>();
// Any redirect handlers need to be added first
handlers.add(rewrite);
// Now add all the default handlers
for (Handler handler : server.getHandlers()) {
handlers.add(handler);
}
Handler[] newlist = new Handler[handlers.size()];
handlerlist.setHandlers(handlers.toArray(newlist));
server.setHandler(handlerlist);
}
Aggregations