root / src / gr / ebs / gss / server / webdav / milton / GssMiltonServlet.java @ 921693ed
History | View | Annotate | Download (3.1 kB)
1 |
/*
|
---|---|
2 |
* Copyright 2011 Electronic Business Systems Ltd.
|
3 |
*
|
4 |
* This file is part of GSS.
|
5 |
*
|
6 |
* GSS is free software: you can redistribute it and/or modify
|
7 |
* it under the terms of the GNU General Public License as published by
|
8 |
* the Free Software Foundation, either version 3 of the License, or
|
9 |
* (at your option) any later version.
|
10 |
*
|
11 |
* GSS is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with GSS. If not, see <http://www.gnu.org/licenses/>.
|
18 |
*/
|
19 |
package gr.ebs.gss.server.webdav.milton; |
20 |
|
21 |
import java.util.Arrays; |
22 |
|
23 |
import javax.servlet.ServletConfig; |
24 |
import javax.servlet.ServletException; |
25 |
|
26 |
import org.slf4j.Logger; |
27 |
import org.slf4j.LoggerFactory; |
28 |
|
29 |
import com.bradmcevoy.http.AuthenticationService; |
30 |
import com.bradmcevoy.http.CompressingResponseHandler; |
31 |
import com.bradmcevoy.http.MiltonServlet; |
32 |
import com.bradmcevoy.http.ServletHttpManager; |
33 |
import com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler; |
34 |
import com.ettrema.console.ConsoleResourceFactory; |
35 |
|
36 |
|
37 |
/**
|
38 |
* @author kman
|
39 |
*
|
40 |
*/
|
41 |
public class GssMiltonServlet extends MiltonServlet{ |
42 |
private Logger log = LoggerFactory.getLogger( GssMiltonServlet.class ); |
43 |
private ServletConfig config;
|
44 |
|
45 |
public void init( ServletConfig config ) throws ServletException { |
46 |
try {
|
47 |
this.config = config;
|
48 |
GssMemoryLockManager lockManager = new GssMemoryLockManager();
|
49 |
GssSecurityManager securityManager = new GssSecurityManager("PITHOS_WEBDAV"); |
50 |
AuthenticationService authService = new AuthenticationService();
|
51 |
authService.setDisableBasic(true);
|
52 |
authService.setDisableDigest(false);
|
53 |
DefaultWebDavResponseHandler responseHandler = new DefaultWebDavResponseHandler(authService);
|
54 |
CompressingResponseHandler compressHandler = new CompressingResponseHandler(responseHandler);
|
55 |
GSSResourceFactory resourceFactory = new GSSResourceFactory();
|
56 |
resourceFactory.setSecurityManager(securityManager); |
57 |
resourceFactory.setLockManager(lockManager); |
58 |
resourceFactory.setMaxAgeSeconds(3600l);
|
59 |
resourceFactory.setContextPath("webdav");
|
60 |
|
61 |
ConsoleResourceFactory consoleResourceFactory = new ConsoleResourceFactory(resourceFactory, "/console", "/webdav", Arrays.asList(new com.ettrema.console.LsFactory(), |
62 |
new com.ettrema.console.CdFactory(),
|
63 |
new com.ettrema.console.RmFactory(),
|
64 |
new com.ettrema.console.HelpFactory(),
|
65 |
new com.ettrema.console.CpFactory(),
|
66 |
new com.ettrema.console.MkFactory(),
|
67 |
new com.ettrema.console.MkdirFactory()), "webdav"); |
68 |
httpManager = new ServletHttpManager(consoleResourceFactory,compressHandler,authService);
|
69 |
}catch( Throwable ex ) { |
70 |
log.error( "Exception starting milton servlet", ex );
|
71 |
throw new RuntimeException( ex ); |
72 |
} |
73 |
} |
74 |
} |