<commit_before>package com.ettrema.http.caldav.demo.servlet;

import com.bradmcevoy.http.AuthenticationService;
import com.bradmcevoy.http.HandlerHelper;
import com.bradmcevoy.http.HttpManager;
import com.bradmcevoy.http.MiltonServlet;
import com.bradmcevoy.http.ProtocolHandlers;
import com.bradmcevoy.http.Request;
import com.bradmcevoy.http.Response;
import com.bradmcevoy.http.ServletRequest;
import com.bradmcevoy.http.ServletResponse;
import com.bradmcevoy.http.http11.Http11Protocol;
import com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler;
import com.bradmcevoy.http.webdav.WebDavProtocol;
import com.bradmcevoy.http.webdav.WebDavResourceTypeHelper;
import com.ettrema.http.acl.ACLProtocol;
import com.ettrema.http.caldav.CalDavProtocol;
import com.ettrema.http.caldav.CalendarResourceTypeHelper;
import com.ettrema.http.caldav.demo.TResourceFactory;
import java.io.IOException;
import java.util.Arrays;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author brad
 */
public class CaldavMiltonServlet implements Servlet {

    private Logger log = LoggerFactory.getLogger( MiltonServlet.class );



    private ServletConfig config;
    protected HttpManager httpManager;

	@Override
    public void init( ServletConfig config ) throws ServletException {
		TResourceFactory demoResourceFactory = new com.ettrema.http.caldav.demo.TResourceFactory();
		WebDavResourceTypeHelper rth = new com.bradmcevoy.http.webdav.WebDavResourceTypeHelper();
		CalendarResourceTypeHelper crth = new com.ettrema.http.caldav.CalendarResourceTypeHelper(
				new com.ettrema.http.acl.AccessControlledResourceTypeHelper(rth)
		);
		AuthenticationService authService = new com.bradmcevoy.http.AuthenticationService();
		HandlerHelper hh = new com.bradmcevoy.http.HandlerHelper(authService);
		DefaultWebDavResponseHandler defaultResponseHandler = new com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler(authService, crth);
		Http11Protocol http11 = new com.bradmcevoy.http.http11.Http11Protocol(defaultResponseHandler, hh);
		WebDavProtocol webdav = new com.bradmcevoy.http.webdav.WebDavProtocol(hh, crth, defaultResponseHandler, null);<commit_msg>example servlet to show using caldav without spring<commit_after>package com.ettrema.http.caldav.demo.servlet;

import com.bradmcevoy.http.AuthenticationService;
import com.bradmcevoy.http.HandlerHelper;
import com.bradmcevoy.http.HttpManager;
import com.bradmcevoy.http.MiltonServlet;
import com.bradmcevoy.http.ProtocolHandlers;
import com.bradmcevoy.http.Request;
import com.bradmcevoy.http.Response;
import com.bradmcevoy.http.ServletRequest;
import com.bradmcevoy.http.ServletResponse;
import com.bradmcevoy.http.http11.Http11Protocol;
import com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler;
import com.bradmcevoy.http.webdav.WebDavProtocol;
import com.bradmcevoy.http.webdav.WebDavResourceTypeHelper;
import com.ettrema.http.acl.ACLProtocol;
import com.ettrema.http.caldav.CalDavProtocol;
import com.ettrema.http.caldav.CalendarResourceTypeHelper;
import com.ettrema.http.caldav.demo.TResourceFactory;
import java.io.IOException;
import java.util.Arrays;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This is an example servlet to show how to use milton's caldav without spring
 * 
 * Currently this isnt used in this project.
 * 
 * Note that this is functionally equivalent to the spring xml configuration, just
 * uses simple substitution of xml constructs (eg <constructur-arg>) with plain
 * java equivalents.
 *
 * @author brad
 */
public class CaldavMiltonServlet implements Servlet {

    private Logger log = LoggerFactory.getLogger( MiltonServlet.class );



    private ServletConfig config;
    protected HttpManager httpManager;

	@Override
    public void init( ServletConfig config ) throws ServletException {
		TResourceFactory demoResourceFactory = new com.ettrema.http.caldav.demo.TResourceFactory();
		WebDavResourceTypeHelper rth = new com.bradmcevoy.http.webdav.WebDavResourceTypeHelper();
		CalendarResourceTypeHelper crth = new com.ettrema.http.caldav.CalendarResourceTypeHelper(
				new com.ettrema.http.acl.AccessControlledResourceTypeHelper(rth)
		);
		AuthenticationService authService = new com.bradmcevoy.http.AuthenticationService();
		HandlerHelper hh = new com.bradmcevoy.http.HandlerHelper(authService);
		DefaultWebDavResponseHandler defaultResponseHandler = new com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler(authService, crth);
		Http11Protocol http11 = new com.bradmcevoy.http.http11.Http11Protocol(defaultResponseHandler, hh);
		WebDavProtocol webdav = new com.bradmcevoy.http.webdav.WebDavProtocol(hh, crth, defaultResponseHandler, null);
{'fraction_non_alphanumeric': 0.08584367001378224, 'fraction_numerical': 0.005512896239417208, 'mean_word_length': 6.36231884057971, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3115042', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1560, 'n_words': 289}