All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.docshare.mvc.BasePostIntercepter Maven / Gradle / Ivy

Go to download

An efficient, fast, convenient, easy to learn, easy to use MVC framework and ORM framework. It is seamless compatible with JSTL and supports FreeMarker. It can run independently, and it can also be applied to traditional Java Web projects. It is an efficient, fast, convenient, easy to learn and easy to use MVC framework and ORM framework. It is seamless compatible with JSTL and supports FreeMarker. It can be run on its own, or it can be applied to traditional Java Web projects

There is a newer version: 2023.06.19
Show newest version
package org.docshare.mvc;

import org.docshare.mvc.Controller.FreeMarker;
import org.docshare.mvc.Controller.JSP;

/**
 * 这个类适合做最后一个后处理器。
 * 这个后处理器是默认在后处理列表中的。
 * @author HP
 *
 */
public class BasePostIntercepter extends Interceptor {

	@Override
	public Object postProcess(String uri, Controller c, Object ret) {
		if(ret == null)return null;
		if(ret instanceof String){
			c.output((String) ret);
		}else if(ret instanceof JSP){
			JSP jsp = (JSP)ret;
			if(jsp.path == null) c.render();
			else c.render(jsp.path);
		}else if(ret instanceof FreeMarker){
			FreeMarker fm = (FreeMarker)ret;
			c.renderFreeMarker(fm.path);
		}else{
			c.outputJSON(ret);
		}
		return null;		
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy