Search in sources :

Example 1 with RedirectPatternRule

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);
}
Also used : HandlerList(org.eclipse.jetty.server.handler.HandlerList) ArrayList(java.util.ArrayList) RedirectPatternRule(org.eclipse.jetty.rewrite.handler.RedirectPatternRule) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) Handler(org.eclipse.jetty.server.Handler) RewriteHandler(org.eclipse.jetty.rewrite.handler.RewriteHandler) SLF4JBridgeHandler(org.slf4j.bridge.SLF4JBridgeHandler) PseudoAuthenticationHandler(org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler) RewriteHandler(org.eclipse.jetty.rewrite.handler.RewriteHandler)

Aggregations

ArrayList (java.util.ArrayList)1 PseudoAuthenticationHandler (org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler)1 RedirectPatternRule (org.eclipse.jetty.rewrite.handler.RedirectPatternRule)1 RewriteHandler (org.eclipse.jetty.rewrite.handler.RewriteHandler)1 Handler (org.eclipse.jetty.server.Handler)1 HandlerList (org.eclipse.jetty.server.handler.HandlerList)1 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)1 SLF4JBridgeHandler (org.slf4j.bridge.SLF4JBridgeHandler)1