⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 securityinterceptor.java

📁 华为java接口反编译结果!其中包含其所有接口实现过程
💻 JAVA
字号:
package com.kelefa.sms.interceptor;

import com.opensymphony.xwork.Action;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.ActionSupport;
import com.opensymphony.xwork.interceptor.Interceptor;

public class SecurityInterceptor
    implements Interceptor

{
  public SecurityInterceptor()
  {
  }

  public void destroy()
  {
  }

  public void init()
  {
  }

  public String intercept( ActionInvocation invocation )
      throws Exception
  {
    if ( !isAuthorized( invocation ) ) {
      return Action.LOGIN;
    }

    return invocation.invoke();
  }

  protected boolean isAuthorized( ActionInvocation actionInvocation )
  {
    boolean logined = "true".equals( actionInvocation
	.getInvocationContext()
	.getSession()
	.get( "login" ) );


    if ( !logined ) {
      ActionSupport action = ( ActionSupport ) actionInvocation.getAction();
      action.addActionError( "请你先登陆" );

      return false;
    }

    return true;
  }

}

⌨️ 快捷键说明

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