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

com.github.andyshaox.servlet.mapping.GenericMappingProcess Maven / Gradle / Ivy

There is a newer version: 3.2.10.RELEASE
Show newest version
package com.github.andyshaox.servlet.mapping;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.github.andyshao.reflect.MethodOperation;

/**
 * 
 * Title:
* Descript:
* Copyright: Copryright(c) Dec 28, 2015
* Encoding:UNIX UTF-8 * * @author Andy.Shao * */ public class GenericMappingProcess implements MappingProcess { @Override public View doProcess(ServletConfig config , HttpServletRequest request , HttpServletResponse response , Mapping mapping , ProcessType processType) throws ServletException , IOException { View view = null; if (mapping == null) view = View.defaultView(request.getRequestURI() , new PageViewProcess()); else if (processType.processObject != null) { Object result = MethodOperation.invoked(processType.processObject , mapping.getProcessMethod() , processType.args); if (result instanceof View) view = (View) result; else view = View.defaultView(result.toString() , new PageViewProcess()); } else view = View.defaultView(mapping.getUrl() , new PageViewProcess()); return view; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy