Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对Jackrabbit WebDAV的疑问 #22

Open
Heachy opened this issue Mar 6, 2024 · 1 comment
Open

对Jackrabbit WebDAV的疑问 #22

Heachy opened this issue Mar 6, 2024 · 1 comment

Comments

@Heachy
Copy link

Heachy commented Mar 6, 2024

请问,Jackrabbit对WebDAV是只支持增删改查的是吗

Jackrabbit有没有能够作为webDAV服务器的功能,我看到里面有个AbstractWebdavServlet抽象类。但没有细读下去,请问是否有这个功能,或者有没有用java实现webDAV服务器,并且可以进行挂载的项目。就是不需要再额外安装httpd就可以运行的。

@hks2002
Copy link

hks2002 commented Jun 10, 2024

如果只是简单需求,可以直接继承

import org.apache.catalina.servlets.WebdavServlet;

@WebServlet(name = "MyWebdavServlet", urlPatterns = { "/docs/*" }, initParams = {
        @WebInitParam(name = "listings", value = "true"),
        @WebInitParam(name = "readonly", value = "false"),
        @WebInitParam(name = "debug", value = "0")
})
public class WebdavSupport extends WebdavServlet {
    @Value("${attachment.path.linux}")
    private String attachmentPathLinux;

    @Value("${attachment.path.windows}")
    private String attachmentPathWindows;

     @Override
    public void init() throws ServletException {
    WebResourceRoot webResourceRoot = (WebResourceRoot) getServletContext().getAttribute(Globals.RESOURCES_ATTR);
    File additionPath = Utils.isWin() ? new File(attachmentPathWindows) : new File(attachmentPathLinux);

    DirResourceSet dirResourceSet = new DirResourceSet(webResourceRoot, "/",  additionPath.getAbsolutePath(), "/");
    webResourceRoot.addPreResources(dirResourceSet);

    super.init();
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants