本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}