servermethodcenter.java

来自「单点登陆」· Java 代码 · 共 65 行

JAVA
65
字号
package net.s3o.core.method;

import java.util.HashMap;

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

import net.s3o.common.S3OConstant;


public class ServerMethodCenter {
	

	private HashMap serverMethods=new HashMap();

	
	public boolean invokeServerMethod(HttpServletRequest request, HttpServletResponse response){
		boolean isBreak=false;
		
		String[] methodNames=getServerMethodNames(request);
		if (methodNames==null||serverMethods==null){
			return false;
		}
		IBaseServerMethod serverMethod=null;
		for (int i=0;i<methodNames.length;i++){
			serverMethod=(IBaseServerMethod)serverMethods.get(methodNames[i]);
			if (serverMethod!=null){
				try {
					boolean sucessed=serverMethod.doMethod(request, response);
					if (sucessed && serverMethod.isBreakOnSuessed() || !sucessed && serverMethod.isBreakOnFailed()){
						isBreak=true;
						break;
					}
				} catch (Exception e) {
					continue;
				}

			}
		}
		return isBreak;
	}
	
	public String[] getServerMethodNames(HttpServletRequest request){
		String[] rs=request.getParameterValues(S3OConstant.FIELD_SERVER_METHOD);
		return rs!=null && rs.length<1?null:rs;
	}

	public HashMap getServerMethods() {
		return serverMethods;
	}

	public void setServerMethods(HashMap serverMethods) {
		this.serverMethods = serverMethods;
	}
	

	






}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?