package com.chengjf.sparkdemo.filter.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import spark.Filter;
import spark.Request;
import spark.Response;

/**
 * 前置过滤器实现
 * 
 * @author sharp
 * @date 2015-9-3
 * 
 */
public class MyBeforeFilterImpl extends Filter {

	private static final Logger logger = LoggerFactory
			.getLogger(MyBeforeFilterImpl.class);

	@Override
	public void handle(Request req, Response res) {
		logger.debug("req: " + req.pathInfo());
	}

}

@@ -434,26 +434,159 @@
 %7B%0A%09%09
-logger.debug(%22req:
+req.session(true);%0A%09%09if (req.session().isNew()) %7B%0A%09%09%09req.session().attribute(%22user%22, %22chengjf%22);%0A%09%09%7D%0A%09%09logger.debug(%22req: %22 + req.raw().getMethod() + %22
  %22 +

修改前置过滤器，输入HTTP请求方式。