<commit_before>package org.twuni.common.net.http.responder;

import java.util.HashMap;
import java.util.Map;

import org.twuni.common.net.http.Method;
import org.twuni.common.net.http.request.Request;
import org.twuni.common.net.http.response.Response;
import org.twuni.common.net.http.response.Status;

public class RequestMapping implements Responder {

	private final Map<String, Map<Method, Responder>> handlers = new HashMap<String, Map<Method, Responder>>();

	public void map( Method method, String pattern, Responder handler ) {

		Map<Method, Responder> methods = handlers.get( pattern );

		if( methods == null ) {
			methods = new HashMap<Method, Responder>();
			handlers.put( pattern, methods );
		}

		methods.put( method, handler );

	}<commit_msg>Adding the ability for RequestMapping to instantiate a Responder class.<commit_after>package org.twuni.common.net.http.responder;

import java.util.HashMap;
import java.util.Map;

import org.twuni.common.net.http.Method;
import org.twuni.common.net.http.request.Request;
import org.twuni.common.net.http.response.Response;
import org.twuni.common.net.http.response.Status;

public class RequestMapping implements Responder {

	private final Map<String, Map<Method, Responder>> handlers = new HashMap<String, Map<Method, Responder>>();

	public void map( Method method, String pattern, Class<? extends Responder> type ) throws InstantiationException, IllegalAccessException {
		map( method, pattern, type.newInstance() );
	}

	public void map( Method method, String pattern, Responder handler ) {

		Map<Method, Responder> methods = handlers.get( pattern );

		if( methods == null ) {
			methods = new HashMap<Method, Responder>();
			handlers.put( pattern, methods );
		}

		methods.put( method, handler );

	}
{'fraction_non_alphanumeric': 0.11900733220530176, 'fraction_numerical': 0.0, 'mean_word_length': 4.933110367892977, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2654452', 'n_tokens_mistral': 568, 'n_tokens_neox': 517, 'n_words': 139}