
com.ithit.webdav.integration.servlet.HttpServletDav Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakarta-integration Show documentation
Show all versions of jakarta-integration Show documentation
IT Hit WebDAV integration for new Jakarta Java servlet containers
package com.ithit.webdav.integration.servlet;
import java.io.IOException;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
/**
* WebDAV specific servlet. Encapsulates all required logic.
* Implement this servlet if you want to enable DAV support.
*/
public abstract class HttpServletDav extends HttpServlet {
/**
* Dav specific service method. Implement it if you want to enable DAV support.
* @param request HttpServletDavRequest.
* @param response HttpServletDavResponse.
* @throws HttpServletDavException in case of DAV exception.
* @throws IOException in case of IOException.
*/
protected abstract void serviceDav(HttpServletDavRequest request, HttpServletDavResponse response) throws HttpServletDavException, IOException;
/**
* Dav specific servlet initialization.
* @param servletConfig DavServletConfig.
* @throws HttpServletDavException in case of DAV exception.
*/
protected abstract void initDav(DavServletConfig servletConfig) throws HttpServletDavException;
@Override
protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
try {
this.serviceDav(new HttpServletDavRequest(servletRequest), new HttpServletDavResponse(servletResponse));
} catch (ServletException ex) {
throw new HttpServletDavException(ex);
}
}
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
this.initDav(new DavServletConfig(config));
} catch (ServletException ex) {
throw new HttpServletDavException(ex);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy