package com.chtt.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.login.interceptor.annotation.Interception;
@Controller
@RequestMapping("/test")
public class TestController {
@RequestMapping("/login")
public String login(HttpServletRequest request){
Map<String, String> userInfo = new HashMap<String, String>();
userInfo.put("user", "test");
request.getSession().setAttribute("userInfo", userInfo);
return "redirect:/test/index";
}
@Interception(url = "/index" , interceptionName = "userInfo")
@RequestMapping("/index")
public String index(HttpServletRequest request){
return "/index";
}
@Interception(url = "/testIndex" , interceptionName = "userInfo", isApi = true)
@RequestMapping("/testIndex")
public String testIndex(HttpServletRequest request){
return "/index";
}
public static void main(String[] args) {
String str = "abcdefg";
byte[] bytes = str.getBytes();
byte[] bytesJS = new byte[bytes.length];
byte[] bytesOS = new byte[bytes.length];
for (int i = 0; i < bytes.length; i++) {
if(bytes[i] % 2 == 0){
bytesOS[i] = bytes[i];
}else{
bytesJS[i] = bytes[i];
}
}
System.out.println("偶数");
int osCount = 0;
for (byte b : bytesOS) {
System.out.println(b);
if(b != 0){
osCount++;
}
}
System.out.println("奇数");
int jsCount = 0;
for (byte b : bytesJS) {
System.out.println(b);
if(b != 0){
jsCount++;
}
}
byte[] bytesOS1 = new byte[osCount];
byte[] bytesJS1 = new byte[jsCount];
for (int i = 0, k = 0; i < bytesOS1.length; ) {
if(bytesOS[k] != 0){
bytesOS1[i] = bytesOS[k];
i ++;
}
k ++;
}
for (int i = 0, k = 0; i < bytesJS1.length; ) {
if(bytesJS[k] != 0){
bytesJS1[i] = bytesJS[k];
i ++;
}
k ++;
}
System.out.println("-----------------------");
for (byte b : bytesOS1) {
System.out.println(b);
}
System.out.println("-----------------------");
for (byte b : bytesJS1) {
System.out.println(b);
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
LoginInterceptorDemo.rar (90个子文件)
LoginInterceptorDemo
.project 1KB
WebContent
WEB-INF
lib
commons-lang3-3.1.jar 308KB
spring-aop-3.2.3.RELEASE.jar 328KB
commons-collections-3.2.jar 558KB
commons-fileupload-1.3.1.jar 67KB
c3p0-0.9.2.1.jar 414KB
spring-webmvc-3.2.2.RELEASE.jar 621KB
commons-codec-1.6.jar 227KB
mysql-connector-java-5.1.19-bin.jar 783KB
dom4j-1.6.1.jar 307KB
ezmorph-1.0.6.jar 84KB
jedis-2.1.0.jar 136KB
jstl-1.2.jar 405KB
mchange-commons-java-0.2.3.4.jar 568KB
spring-beans-3.2.3.RELEASE.jar 593KB
ant-1.6.5.jar 1010KB
spring-date-redis-1.1.0.jar 496KB
spring-web-3.2.3.RELEASE.jar 611KB
gson-2.3.1.jar 206KB
urlrewritefilter-4.0.3.jar 173KB
jackson-mapper-asl-1.9.5.jar 761KB
commons-logging-1.1.1.jar 59KB
commons-beanutils-1.7.0.jar 184KB
spring-core-3.2.3.RELEASE.jar 847KB
log4j-1.2.17.jar 478KB
commons-pool-1.5.4.jar 94KB
mybatis-spring-1.2.0.jar 48KB
aspectjweaver-1.6.9.jar 1.59MB
mybatis-3.2.2.jar 683KB
json-lib-2.1.jar 122KB
aopalliance-1.0.jar 4KB
spring-context-3.2.3.RELEASE.jar 843KB
mail-1.4.7.jar 509KB
spring-jdbc-3.2.3.RELEASE.jar 396KB
spring-context-support-3.0.3.RELEASE.jar 98KB
spring-orm-3.2.3.RELEASE.jar 378KB
cglib-nodep-2.2.jar 315KB
loginInterceptor-1.2.jar 1020KB
commons-io-2.4.jar 181KB
commons-lang-2.5.jar 273KB
spring-tx-3.2.3.RELEASE.jar 237KB
httpclient-4.3.3.jar 576KB
httpcore-4.3.2.jar 276KB
spring-expression-3.2.3.RELEASE.jar 191KB
jackson-core-asl-1.9.5.jar 223KB
urlrewrite.xml 1KB
test
index.jsp 533B
web.xml 4KB
noLogin.jsp 361B
index.jsp 533B
test
index.jsp 533B
META-INF
MANIFEST.MF 39B
NewFile.jsp 370B
src
com
chtt
controller
TestController.java 2KB
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 345B
org.eclipse.jdt.core.prefs 364B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs 117B
org.eclipse.core.resources.prefs 103B
org.eclipse.wst.common.component 625B
.jsdtscope 503B
build
classes
wechat.properties 1KB
redis.properties 225B
config.properties 63B
applicationContext.xml 658B
loginInterceptor.xml 826B
img.properties 91B
com
chtt
controller
TestController.class 3KB
SqlMapConfig.xml 1KB
jdbc.properties 647B
applicationContext-base.xml 1KB
log4j.properties 2KB
annotation.properties 20B
des.properties 78B
springMVC.xml 2KB
baseConfig
wechat.properties 1KB
redis.properties 225B
config.properties 63B
img.properties 91B
jdbc.properties 647B
log4j.properties 2KB
annotation.properties 20B
des.properties 78B
resources
applicationContext.xml 658B
loginInterceptor.xml 826B
SqlMapConfig.xml 1KB
applicationContext-base.xml 1KB
springMVC.xml 2KB
.classpath 5KB
共 90 条
- 1
资源评论
思念的秋天
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功