当前位置: 首页>>代码示例>>Java>>正文


Java TurbineRunData类代码示例

本文整理汇总了Java中com.alibaba.citrus.turbine.TurbineRunData的典型用法代码示例。如果您正苦于以下问题:Java TurbineRunData类的具体用法?Java TurbineRunData怎么用?Java TurbineRunData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TurbineRunData类属于com.alibaba.citrus.turbine包,在下文中一共展示了TurbineRunData类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: invoke

import com.alibaba.citrus.turbine.TurbineRunData; //导入依赖的package包/类
public void invoke(PipelineContext pipelineContext) throws Exception {
    TurbineRunData rundata = getTurbineRunData(request);
    if (ignoreTarget(rundata.getTarget())) {
        pipelineContext.invokeNext();
        return;
    }

    //默认是中文
    String[] temp = rundata.getCookies().getStrings("locale");
    String locale = null;
    if (temp != null) {
        if (temp.length > 1) {
            locale = temp[temp.length - 1];
        } else if (temp.length == 1) {
            locale = temp[0];
        }
    }
    if (locale == null || "".equals(locale)) {
        locale = "zh";
    }

    Locale newLocale = Locale.SIMPLIFIED_CHINESE;
    if ("en".equals(locale)) {
        newLocale = Locale.ENGLISH;
    } else if ("zh".equals(locale)) {
        newLocale = Locale.SIMPLIFIED_CHINESE;
    } else if ("zh_TW".equals(locale)) {
        newLocale = Locale.TRADITIONAL_CHINESE;
    }
    LocaleUtil.setLocale(newLocale);

    pipelineContext.invokeNext();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:34,代码来源:LocaleValve.java

示例2: invokeCheckServicePrivilege

import com.alibaba.citrus.turbine.TurbineRunData; //导入依赖的package包/类
private void invokeCheckServicePrivilege(User user) {
   	TurbineRunData rundata = getTurbineRunData(request);
   	HttpSession session = request.getSession();
   	
   	@SuppressWarnings("unchecked")
   	Map<String, String[]> requestMapping = request.getParameterMap();
   	
   	//记录上次操作到请求中
	String returnURL = "";
	if(session.getAttribute("returnURL")==null){
		returnURL = request.getContextPath();
	}else{
		returnURL = (String)session.getAttribute("returnURL");
	}
   	
   	if(requestMapping.get("service").length>0){
   		String service = ((String[]) requestMapping.get("service"))[0];
   		String method = "index";
   		if(requestMapping.get("_method").length>0){
   			method = requestMapping.get("_method")[0];
   		}
   		
   		boolean exclude = "index".equals(method) || "show".equals(method);
   		if(!exclude){
          	 	if (user != null && !user.hasServicePrivilege(service)) {
          	 		request.setAttribute("returnURL",returnURL);
          	 		redirectToNoRight(rundata);
               }
   		}
   	}
   	String type = requestMapping.get("_type").length == 0 ? null : requestMapping.get("_type")[0];
   	if(!"noServicePrivilege".equals(type)){
   		session.setAttribute("returnURL", request.getRequestURI());
   	}
   	return;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:37,代码来源:ServicePrivilegeCheckValve.java

示例3: redirectToNoRight

import com.alibaba.citrus.turbine.TurbineRunData; //导入依赖的package包/类
/**
    * 无权限跳转
    * @param rundata
    */
   private void redirectToNoRight(TurbineRunData rundata) {
       if(logger.isInfoEnabled()) {
           logger.info("No right to access: " + request.getRequestURI());
       }
       
   	rundata.getParameters().setString("returnURL1", (String)rundata.getRequest().getAttribute("returnURL"));
       rundata.setRedirectLocation("http://localhost:8080/governance/noServicePrivilege?returnURL="+rundata.getRequest().getAttribute("returnURL"));
   	return;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:14,代码来源:ServicePrivilegeCheckValve.java

示例4: isAuthenticated

import com.alibaba.citrus.turbine.TurbineRunData; //导入依赖的package包/类
public boolean isAuthenticated(TurbineRunData rundata) {
	Map<String, String> user = (Map<String, String>) rundata.getRequest().getSession().getAttribute(WebConstant.OTTER_USER_SESSION_KEY);
	if (user == null) {
		return false;
	}
	return true;
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:8,代码来源:AuthContextValve.java

示例5: redirect

import com.alibaba.citrus.turbine.TurbineRunData; //导入依赖的package包/类
private void redirect(PipelineContext pipelineContext, TurbineRunData rundata, String uriBroker) {
	URIBroker urlBroker = assertNotNull(uriBrokerService.getURIBroker(uriBroker),
			"uriBroker get from loginLink should not be null");

	urlBroker.addQueryData(redirectParmeter, getRequestUrlWithQueryString());
	rundata.setRedirectLocation(urlBroker.render());
	pipelineContext.breakPipeline(Pipeline.TOP_LABEL);
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:9,代码来源:AuthContextValve.java

示例6: invokeCheckServicePrivilege

import com.alibaba.citrus.turbine.TurbineRunData; //导入依赖的package包/类
private void invokeCheckServicePrivilege(User user) {
    TurbineRunData rundata = getTurbineRunData(request);
    HttpSession session = request.getSession();

    @SuppressWarnings("unchecked")
    Map<String, String[]> requestMapping = request.getParameterMap();

    //记录上次操作到请求中
    String returnURL = "";
    if (session.getAttribute("returnURL") == null) {
        returnURL = request.getContextPath();
    } else {
        returnURL = (String) session.getAttribute("returnURL");
    }

    if (requestMapping.get("service").length > 0) {
        String service = ((String[]) requestMapping.get("service"))[0];
        String method = "index";
        if (requestMapping.get("_method").length > 0) {
            method = requestMapping.get("_method")[0];
        }

        boolean exclude = "index".equals(method) || "show".equals(method);
        if (!exclude) {
            if (user != null && !user.hasServicePrivilege(service)) {
                request.setAttribute("returnURL", returnURL);
                redirectToNoRight(rundata);
            }
        }
    }
    String type = requestMapping.get("_type").length == 0 ? null : requestMapping.get("_type")[0];
    if (!"noServicePrivilege".equals(type)) {
        session.setAttribute("returnURL", request.getRequestURI());
    }
    return;
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:37,代码来源:ServicePrivilegeCheckValve.java

示例7: redirectToNoRight

import com.alibaba.citrus.turbine.TurbineRunData; //导入依赖的package包/类
/**
 * 无权限跳转
 * @param rundata
 */
private void redirectToNoRight(TurbineRunData rundata) {
    if (logger.isInfoEnabled()) {
        logger.info("No right to access: " + request.getRequestURI());
    }

    rundata.getParameters().setString("returnURL1", (String) rundata.getRequest().getAttribute("returnURL"));
    rundata.setRedirectLocation("http://localhost:8080/governance/noServicePrivilege?returnURL=" + rundata.getRequest().getAttribute("returnURL"));
    return;
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:14,代码来源:ServicePrivilegeCheckValve.java


注:本文中的com.alibaba.citrus.turbine.TurbineRunData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。