Search in sources :

Example 1 with DefaultWebDavResponseHandler

use of com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler in project v7files by thiloplanz.

the class MiltonServlet method init.

@Override
public void init(ServletConfig config) throws ServletException {
    String endpoint = config.getInitParameter("webdav.endpoint");
    Properties ep = Configuration.getEndpointProperties(endpoint);
    dbName = ep.getProperty("mongo.db");
    try {
        endpointProperties.set(ep);
        super.init(config);
    } finally {
        endpointProperties.remove();
    }
    // http://stackoverflow.com/questions/8380324/
    httpManager.getHandlers().setEnableExpectContinue(false);
    handlers: for (HttpExtension x : httpManager.getHandlers()) {
        if (x instanceof Http11Protocol) {
            Http11Protocol p = (Http11Protocol) x;
            for (Handler h : x.getHandlers()) {
                if (h instanceof com.bradmcevoy.http.http11.GetHandler) {
                    httpManager.addFilter(0, new GetHandler(new DefaultWebDavResponseHandler(new AuthenticationService()), p.getHandlerHelper()));
                    break handlers;
                }
            }
        }
    }
}
Also used : DefaultWebDavResponseHandler(com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler) Http11Protocol(com.bradmcevoy.http.http11.Http11Protocol) DefaultWebDavResponseHandler(com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler) Handler(com.bradmcevoy.http.Handler) Properties(java.util.Properties) HttpExtension(com.bradmcevoy.http.HttpExtension) AuthenticationService(com.bradmcevoy.http.AuthenticationService)

Aggregations

AuthenticationService (com.bradmcevoy.http.AuthenticationService)1 Handler (com.bradmcevoy.http.Handler)1 HttpExtension (com.bradmcevoy.http.HttpExtension)1 Http11Protocol (com.bradmcevoy.http.http11.Http11Protocol)1 DefaultWebDavResponseHandler (com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler)1 Properties (java.util.Properties)1