├── .idea ├── .name ├── artifacts │ └── PackServer_war_exploded.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── libraries │ ├── hibernate.xml │ ├── sdk.xml │ ├── spring.xml │ └── struts2.xml ├── misc.xml ├── modules.xml ├── scopes │ └── scope_settings.xml ├── uiDesigner.xml ├── vcs.xml └── workspace.xml ├── LISENCE.txt ├── PackServer.iml ├── README.md ├── lib └── jars │ ├── hibernate │ ├── antlr-2.7.6.jar │ ├── c3p0-0.9.1.2.jar │ ├── commons-collections-3.1.jar │ ├── dom4j-1.6.jar │ ├── ejb3-persistence.jar │ ├── hibernate-annotations.jar │ ├── hibernate-commons-annotations.jar │ ├── hibernate-entitymanager.jar │ ├── hibernate-validator.jar │ ├── hibernate3.jar │ ├── javassist-3.9.0.GA.jar │ ├── jta-1.1.jar │ ├── log4j.jar │ ├── mysql-connector-java-5.1.22-bin.jar │ ├── slf4j-api-1.5.8.jar │ └── slf4j-log4j12-1.5.8.jar │ ├── httpclient │ ├── httpasyncclient-4.1.2.jar │ ├── httpclient-4.5.2.jar │ ├── httpcore-4.4.5.jar │ └── httpcore-nio-4.4.5.jar │ ├── sdk │ ├── cglib-nodep-2.2.jar │ ├── commons-codec-1.4.jar │ ├── commons-lang3-3.1.jar │ ├── dom4j-1.6.1.jar │ ├── fastjson-1.2.50.jar │ ├── httpasyncclient-4.0.2.jar │ ├── httpclient-4.4.jar │ ├── httpclient-cache-4.4.jar │ ├── httpcore-4.4.jar │ ├── httpcore-nio-4.4.1.jar │ ├── jackson-all-1.9.1.jar │ ├── jdom-1.1.3.jar │ ├── jdom2-2.0.5.jar │ ├── jettison-1.2.jar │ ├── joda-time-1.6.jar │ ├── kxml2-2.3.0.jar │ ├── kxml2-min-2.3.0.jar │ ├── lenovo_pay_sign-1.0.0.5.jar │ ├── oppo_oauth_1.0.jar │ ├── stax-1.2.0.jar │ ├── stax-api-1.0.1.jar │ ├── urlrewritefilter-4.0.3.jar │ ├── wstx-asl-3.2.7.jar │ ├── xmlpull-1.1.3.1.jar │ ├── xom-1.1.jar │ ├── xpp3_min-1.1.4c.jar │ ├── xstream-1.4.8.jar │ └── xstream-benchmark-1.4.8.jar │ ├── spring │ ├── spring-aop-3.2.2.jar │ ├── spring-aspects-3.2.2.jar │ ├── spring-beans-3.2.2.jar │ ├── spring-build-src-3.2.2.jar │ ├── spring-context-3.2.2.jar │ ├── spring-context-support-3.2.2.jar │ ├── spring-core-3.2.2.jar │ ├── spring-expression-3.2.2.jar │ ├── spring-instrument-3.2.2.jar │ ├── spring-instrument-tomcat-3.2.2.jar │ ├── spring-jdbc-3.2.2.jar │ ├── spring-jms-3.2.2.jar │ ├── spring-orm-3.2.2.jar │ ├── spring-oxm-3.2.2.jar │ ├── spring-struts-3.2.2.jar │ ├── spring-test-3.2.2.jar │ ├── spring-tx-3.2.2.jar │ ├── spring-web-3.2.2.jar │ ├── spring-webmvc-3.2.2.jar │ └── spring-webmvc-portlet-3.2.2.jar │ └── struts2 │ ├── aopalliance-1.0.jar │ ├── asm-2.2.3.jar │ ├── asm-commons-2.2.3.jar │ ├── asm-util-2.2.3.jar │ ├── aspectjrt.jar │ ├── aspectjweaver.jar │ ├── cglib-nodep-2.1_3.jar │ ├── classworlds-1.1.jar │ ├── commons-beanutils-1.7.0.jar │ ├── commons-chain-1.2.jar │ ├── commons-dbcp-1.4.jar │ ├── commons-digester-1.8.jar │ ├── commons-fileupload-1.2.1.jar │ ├── commons-io-1.3.2.jar │ ├── commons-lang-2.3.jar │ ├── commons-logging-1.0.4.jar │ ├── commons-logging-api-1.1.jar │ ├── commons-pool-1.6.jar │ ├── commons-validator-1.3.1.jar │ ├── dwr-1.1.1.jar │ ├── ezmorph-1.0.3.jar │ ├── freemarker-2.3.13.jar │ ├── json-lib-2.1.jar │ ├── ognl-2.6.11.jar │ ├── servlet-api.jar │ ├── struts2-convention-plugin-2.1.6.jar │ ├── struts2-core-2.1.6.jar │ ├── struts2-junit-plugin-2.1.6.jar │ ├── struts2-spring-plugin-2.1.6.jar │ ├── xpp3_min-1.1.3.4.O.jar │ ├── xstream-1.2.2.jar │ └── xwork-2.1.2.jar ├── src ├── applicationContext.xml ├── com │ └── u8 │ │ └── server │ │ ├── PackServer.java │ │ ├── cache │ │ └── UApplicationListener.java │ │ ├── common │ │ ├── IHibernateTemplate.java │ │ ├── OrderParameter.java │ │ ├── OrderParameters.java │ │ ├── Page.java │ │ ├── PageParameter.java │ │ ├── UActionSupport.java │ │ └── UHibernateTemplate.java │ │ ├── dao │ │ └── UUserDao.java │ │ ├── data │ │ └── UUser.java │ │ ├── filters │ │ └── LoginInterceptor.java │ │ ├── log │ │ └── Log.java │ │ ├── service │ │ └── UUserManager.java │ │ ├── utils │ │ ├── Base64.java │ │ ├── EncryptUtils.java │ │ ├── HmacSHA1Encryption.java │ │ ├── JsonUtils.java │ │ └── RSAUtils.java │ │ └── web │ │ └── UserAction.java ├── jdbc.properties ├── log4j.properties └── struts.xml └── web ├── WEB-INF ├── admin │ └── users.jsp ├── urlrewrite.xml └── web.xml └── index.jsp /.idea/.name: -------------------------------------------------------------------------------- 1 | PackServer -------------------------------------------------------------------------------- /.idea/artifacts/PackServer_war_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/PackServer_war_exploded 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/libraries/hibernate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/sdk.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.idea/libraries/spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/struts2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 114 | 115 | 116 | 117 | 118 | 119 | 126 | 127 | 128 | 132 | 133 | 134 | 145 | 146 | 147 | 160 | 161 | 162 | 163 | 181 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 99 | 100 | 101 | true 102 | 103 | 104 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 141 | 142 | 145 | 146 | 147 | 148 | 151 | 152 | 155 | 156 | 157 | 158 | 161 | 162 | 165 | 166 | 169 | 170 | 171 | 172 | 175 | 176 | 179 | 180 | 183 | 184 | 187 | 188 | 189 | 190 | 193 | 194 | 197 | 198 | 201 | 202 | 205 | 206 | 209 | 210 | 211 | 212 | 215 | 216 | 219 | 220 | 223 | 224 | 225 | 226 | 229 | 230 | 233 | 234 | 237 | 238 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 296 | 297 | 318 | 319 | 320 | 321 | 324 | 325 | 340 | 341 | 342 | 343 | 346 | 347 | 368 | 369 | 370 | 371 | 374 | 375 | 390 | 391 | 392 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 414 | 415 | 416 | 417 | 418 | 419 | 430 | 431 | 432 | 433 | 451 | 458 | 459 | 460 | 461 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | true 484 | 485 | 486 | 487 | 488 | 563 | 564 | 585 | 598 | 599 | 600 | 619 | 620 | 621 | 625 | 626 | 627 | 634 | 637 | 639 | 640 | 641 | 642 | 651 | 655 | 656 | 657 | 674 | 675 | 676 | 689 | 690 | 691 | 709 | 710 | 786 | 787 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 1418106136312 894 | 976 | 977 | 978 | 979 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1041 | 1044 | 1045 | 1046 | 1048 | 1049 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1060 | 1061 | 1062 | 1063 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | PackServer:war exploded 1392 | 1393 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | Web (PackServer)|Web 1405 | 1406 | 1411 | 1412 | 1413 | 1414 | 1415 | 1416 | sdk 1417 | 1418 | 1423 | 1424 | 1425 | 1426 | 1427 | 1428 | 1.6 1429 | 1430 | 1435 | 1436 | 1437 | 1438 | 1439 | 1440 | PackServer 1441 | 1442 | 1447 | 1448 | 1449 | 1450 | 1451 | 1452 | sdk 1453 | 1454 | 1459 | 1460 | 1461 | 1462 | 1463 | 1464 | -------------------------------------------------------------------------------- /LISENCE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-present, U8Framework4SSH 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /PackServer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # U8Framework4SSH 2 | 3 | U8Server中使用的SSH2(Struts2+Spring3+Hibernate4)框架,包括U8Server集成好的配置文件,以及抽象出来的一些通用组件,使得基于J2EE框架开发的同学可以快速展开工作。 4 | 5 | U8Server是U8SDK统一渠道SDK接入框架的服务器端。U8Server采用成熟的SSH2(J2EE框架)研发。性能可靠,结构简单。 6 | 7 | 采用SSH2框架研发的项目,开发其实很简单。主要就是框架的整合和搭建,需要花费点时间。问题主要集中在配置方式和框架的使用。 8 | 9 | 之前很多同学在问U8Server采用的配置和整个框架,往往就败在了框架整合上面。这里,我们将U8Server采用的框架和配置开源出来。需要采用SSH2研发的项目,可以直接在该框架基础上进行,免去了从头配置的繁琐。 10 | 11 | 整个框架,基于MVC思想模式,同时所有配置通过注解进行。避免通过配置文件配置带来的繁琐和复杂。 12 | 13 | ###依赖Jar包: 14 | 15 | lib/jars目录下为SSH2框架所依赖的一些jar包。添加新的jar包注意,不要导致jar包冲突。 16 | 17 | ###框架配置说明: 18 | 19 | applicationContext.xml:Spring容器的配置,所有的组件管理和依赖注入(IOC)都由Spring管理,基本固定,不用修改 20 | jdbc.properties:数据库相关配置,在这里修改数据库连接信息即可 21 | log4j.properties:日志配置, 如果需要配置包名下面的日志级别,就在这里配置 22 | struts.xml:struts2的配置,因为我们采用注解配置方式,所以该文件配置很少,而且固定 23 | WEB-INF\web.xml:这个是web项目的固定配置,需要配置struts2,spring,hibernate等的过滤器和监听器等。基本固定,不用修改 24 | 25 | ###源码目录(根目录为com.u8.server): 26 | 27 | * cache/ :缓存相关类目录。U8Server中对游戏对象,渠道对象,渠道商对象进行了缓存 28 | * common/ :该目录下为U8Server对SSH2框架的一个简单封装 29 | * dao/ :MVC模式典型的DAO层(数据访问层) 30 | * data/ :数据对象 31 | * filters/:struts2过滤器,比如后台管理操作,需要登录用户和拥有相关权限的用户才能进行,通过过滤器来拦截 32 | * log/ :日志目录 33 | * service/:MVC模式典型的Service层(业务逻辑层) 34 | * utils/ :常用辅助工具类 35 | * web/ :MVC模式典型的Web层,这里写struts2的Action 36 | 37 | ###框架使用: 38 | 39 | 比如现在需要开发一个用户管理系统, 40 | 41 | #####1、我们会抽象出来一个User对象。那么在data目录下,新建一个UUser对象: 42 | 43 | ```java 44 | /** 45 | * 用户数据对象 46 | * 约定:所有字段的名称,都需要和数据库表格中的字段名称一致 47 | */ 48 | @Entity //说明该对象为一个数据类 49 | @Table(name = "uuser") //该数据库和数据库中某张表格一一对应。name为数据库表的名称 50 | public class UUser { 51 | 52 | @Id //说明该字段为主键 53 | @GeneratedValue(strategy = GenerationType.IDENTITY) //主键生成方式,这里自动递增。具体其他方式,自行查阅资料了解 54 | private int id; 55 | 56 | 57 | private int appID; 58 | private int channelID; 59 | private String name; 60 | private String channelUserID; 61 | private String channelUserName; 62 | private String channelUserNick; 63 | private Date createTime; 64 | private Date lastLoginTime; 65 | private String token; 66 | 67 | public JSONObject toJSON(){ 68 | JSONObject json = new JSONObject(); 69 | json.put("id", id); 70 | json.put("appID", appID); 71 | json.put("channelID", channelID); 72 | json.put("name", name); 73 | json.put("channelUserID", channelUserID); 74 | json.put("channelUserName", channelUserName); 75 | json.put("channelUserNick", channelUserNick); 76 | return json; 77 | } 78 | 79 | public int getId() { 80 | return id; 81 | } 82 | 83 | public void setId(int id) { 84 | this.id = id; 85 | } 86 | 87 | public int getAppID() { 88 | return appID; 89 | } 90 | 91 | public void setAppID(int appID) { 92 | this.appID = appID; 93 | } 94 | 95 | public int getChannelID() { 96 | return channelID; 97 | } 98 | 99 | public void setChannelID(int channelID) { 100 | this.channelID = channelID; 101 | } 102 | 103 | public String getName() { 104 | return name; 105 | } 106 | 107 | public void setName(String name) { 108 | this.name = name; 109 | } 110 | 111 | public String getChannelUserID() { 112 | return channelUserID; 113 | } 114 | 115 | public void setChannelUserID(String channelUserID) { 116 | this.channelUserID = channelUserID; 117 | } 118 | 119 | public String getChannelUserName() { 120 | return channelUserName; 121 | } 122 | 123 | public void setChannelUserName(String channelUserName) { 124 | this.channelUserName = channelUserName; 125 | } 126 | 127 | public String getChannelUserNick() { 128 | return channelUserNick; 129 | } 130 | 131 | public void setChannelUserNick(String channelUserNick) { 132 | this.channelUserNick = channelUserNick; 133 | } 134 | 135 | public Date getCreateTime() { 136 | return createTime; 137 | } 138 | 139 | public void setCreateTime(Date createTime) { 140 | this.createTime = createTime; 141 | } 142 | 143 | public Date getLastLoginTime() { 144 | return lastLoginTime; 145 | } 146 | 147 | public void setLastLoginTime(Date lastLoginTime) { 148 | this.lastLoginTime = lastLoginTime; 149 | } 150 | 151 | public String getToken() { 152 | return token; 153 | } 154 | 155 | public void setToken(String token) { 156 | this.token = token; 157 | } 158 | } 159 | ``` 160 | 161 | ##### 2、有了UUser对象之后,我们需要对该对象进行一些操作。首先就是数据访问,我们需要从数据库中获取到该对象对应的数据表,所以,我们在dao目录下新建一个UUserDao类,作为UUser对象的数据访问类。所有Dao数据访问类都继承UHibernateTemplate。这个抽象类有两个泛型参数。第一个是当前数据访问类需要访问的数据对象,第二个参数是当前数据对象的主键类型 162 | 163 | `注意:所有数据访问类,都需要使用@Repository注解来声明,括号里面的名称为后面其他地方申明该类的对象时所必须使用的名称。` 164 | 165 | 166 | ```java 167 | /** 168 | * 用户数据访问类 169 | */ 170 | @Repository("userDao") 171 | public class UUserDao extends UHibernateTemplate{ 172 | 173 | //data operate 174 | 175 | } 176 | ``` 177 | 178 | ##### 3、有了UUserDao,我们还需要在service目录下新建一个UUserManager作为UUser对象的业务操作类。 179 | 180 | `注意:所有业务操作类,都必须使用@Service注解来声明,括号里面的名称为后面其他地方申明该类的对象时所必须使用的名称。` 181 | 182 | 183 | ```java 184 | /** 185 | * 这里处理UUser相关的逻辑操作 186 | */ 187 | @Service("userManager") 188 | public class UUserManager { 189 | 190 | @Autowired //使用Autowired注解来声明,采用Spring依赖注入来自动实例化该对象。 191 | private UUserDao userDao; //这里变量的名称必须为userDao和上面@Repository声明该类时,指定的名称一致 192 | 193 | //根据渠道用户ID获取用户信息 194 | public UUser getUserByCpID(int appID, int channelID, String cpUserID){ 195 | 196 | String hql = "from UUser where appID = ? and channelID = ? and channelUserID = ?"; 197 | 198 | return (UUser)userDao.findUnique(hql, appID, channelID, cpUserID); 199 | 200 | } 201 | 202 | //获取指定渠道下的所有用户 203 | public List getUsersByChannel(int channelID){ 204 | String hql = "from UUser where channelID = ?"; 205 | 206 | return userDao.find(hql, new Object[]{channelID}, null); 207 | } 208 | 209 | //分页查找 210 | public Page queryPage(int currPage, int num){ 211 | 212 | PageParameter page = new PageParameter(currPage, num, true); 213 | OrderParameters order = new OrderParameters(); 214 | order.add("id", OrderParameter.OrderType.DESC); 215 | String hql = "from UUser"; 216 | return userDao.find(page, hql, null, order); 217 | } 218 | 219 | 220 | public UUser getUser(int userID){ 221 | 222 | return userDao.get(userID); 223 | } 224 | 225 | public void saveUser(UUser user){ 226 | userDao.save(user); 227 | } 228 | 229 | public void deleteUser(UUser user){ 230 | userDao.delete(user); 231 | } 232 | } 233 | ``` 234 | 235 | 236 | ##### 4、有了UUser相关的数据对象和业务操作之后,我们需要一个控制器,来控制URL的访问,参数解析验证,调用业务层的逻辑进行处理,然后返回给客户端对应的结果。我们在web目录下,新建一个UserAction类。 237 | 238 | `注意:所有的Action类,都必须继承UActionSupport类。UActionSupport是common目录下,对struts2的一个简单的封装。` 239 | `如果需要该Action采用数据驱动方式传递参数,那么还要实现ModelDriven接口。` 240 | 241 | 建议,将同一个业务的方法写在一个Action类中。比如这里User对象的操作。增删改查等操作,都在该类中 242 | 243 | http://localhost:8080/users/showUsers : 打开用户列表界面 244 | 245 | http://localhost:8080/users/getAllUsers : 分页获取用户数据 246 | 247 | http://localhost:8080/users/saveUser : 增加或者编辑用户数据 248 | 249 | http://localhost:8080/users/removeUser : 删除某个用户数据 250 | 251 | 252 | ```java 253 | @Controller //所有Action都加上Controller注解 254 | @Namespace("/users") //根据业务区分Namespace,用Namespace主要防止命名冲突,并格式规范URL 255 | public class UserAction extends UActionSupport implements ModelDriven{ 256 | 257 | 258 | private int page; //当前请求的页码 259 | private int rows; //当前每页显示的行数 260 | 261 | private UUser user; 262 | 263 | private int currUserID; 264 | 265 | @Autowired 266 | private UUserManager userManager; 267 | 268 | //http://localhost:8080/users/showUsers 269 | //访问这个地址,会访问到WEB-INF/admin/users.jsp 270 | @Action(value = "showUsers", 271 | results = {@Result(name = "success", location = "/WEB-INF/admin/users.jsp")}) 272 | public String showUsers(){ 273 | 274 | return "success"; 275 | } 276 | 277 | //http://localhost:8080/users/getAllUsers 278 | @Action("getAllUsers") 279 | public void getAllUsers(){ 280 | try{ 281 | 282 | Page currPage = this.userManager.queryPage(page, rows); 283 | 284 | JSONObject json = new JSONObject(); 285 | json.put("total", currPage.getTotalCount()); 286 | JSONArray users = new JSONArray(); 287 | for(UUser m : currPage.getResultList()){ 288 | users.add(m.toJSON()); 289 | } 290 | json.put("rows", users); 291 | 292 | renderJson(json.toString()); 293 | 294 | }catch(Exception e){ 295 | e.printStackTrace(); 296 | } 297 | } 298 | 299 | 300 | //添加或者编辑 301 | //http://localhost:8080/users/saveUser 302 | @Action("saveUser") 303 | public void saveUser(){ 304 | try{ 305 | 306 | userManager.saveUser(this.user); 307 | renderState(true); 308 | 309 | return; 310 | 311 | }catch(Exception e){ 312 | e.printStackTrace(); 313 | } 314 | 315 | renderState(false); 316 | } 317 | 318 | 319 | //http://localhost:8080/users/removeUser 320 | @Action("removeUser") 321 | public void removeUser(){ 322 | try{ 323 | Log.d("Curr userID is " + this.currUserID); 324 | 325 | UUser user = userManager.getUser(this.currUserID); 326 | 327 | if(user == null){ 328 | renderState(false); 329 | return; 330 | } 331 | 332 | userManager.deleteUser(user); 333 | 334 | renderState(true); 335 | 336 | return; 337 | 338 | }catch(Exception e){ 339 | e.printStackTrace(); 340 | } 341 | 342 | renderState(false); 343 | } 344 | 345 | 346 | 347 | private void renderState(boolean suc){ 348 | JSONObject json = new JSONObject(); 349 | json.put("state", suc? 1 : 0); 350 | json.put("msg", suc? "操作成功" : "操作失败"); 351 | renderText(json.toString()); 352 | } 353 | 354 | 355 | @Override 356 | public UUser getModel() { 357 | if(this.user == null){ 358 | this.user = new UUser(); 359 | } 360 | return this.user; 361 | } 362 | 363 | public UUser getUser() { 364 | return user; 365 | } 366 | 367 | public void setUser(UUser user) { 368 | this.user = user; 369 | } 370 | 371 | public int getPage() { 372 | return page; 373 | } 374 | 375 | public void setPage(int page) { 376 | this.page = page; 377 | } 378 | 379 | public int getRows() { 380 | return rows; 381 | } 382 | 383 | public void setRows(int rows) { 384 | this.rows = rows; 385 | } 386 | 387 | public int getCurrUserID() { 388 | return currUserID; 389 | } 390 | 391 | public void setCurrUserID(int currUserID) { 392 | this.currUserID = currUserID; 393 | } 394 | } 395 | ``` 396 | 397 | 开发SSH2项目,建议使用IntelliJ IDEA ,该框架也是基于该IDE开发的。如果是其他IDE,可能需要手动转换并重新配置下。 398 | 399 | ######另外,欢迎大家访问我们的官方博客,并加入我们的技术群 400 | 401 | ######官方博客:[http://www.uustory.com](http://www.uustory.com) 402 | ######技术QQ群:`207609068` 403 | 404 | 405 | 406 | 407 | 408 | -------------------------------------------------------------------------------- /lib/jars/hibernate/antlr-2.7.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/antlr-2.7.6.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/c3p0-0.9.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/c3p0-0.9.1.2.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/commons-collections-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/commons-collections-3.1.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/dom4j-1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/dom4j-1.6.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/ejb3-persistence.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/ejb3-persistence.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/hibernate-annotations.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/hibernate-annotations.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/hibernate-commons-annotations.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/hibernate-commons-annotations.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/hibernate-entitymanager.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/hibernate-entitymanager.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/hibernate-validator.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/hibernate-validator.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/hibernate3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/hibernate3.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/javassist-3.9.0.GA.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/javassist-3.9.0.GA.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/jta-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/jta-1.1.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/log4j.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/log4j.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/mysql-connector-java-5.1.22-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/mysql-connector-java-5.1.22-bin.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/slf4j-api-1.5.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/slf4j-api-1.5.8.jar -------------------------------------------------------------------------------- /lib/jars/hibernate/slf4j-log4j12-1.5.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/hibernate/slf4j-log4j12-1.5.8.jar -------------------------------------------------------------------------------- /lib/jars/httpclient/httpasyncclient-4.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/httpclient/httpasyncclient-4.1.2.jar -------------------------------------------------------------------------------- /lib/jars/httpclient/httpclient-4.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/httpclient/httpclient-4.5.2.jar -------------------------------------------------------------------------------- /lib/jars/httpclient/httpcore-4.4.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/httpclient/httpcore-4.4.5.jar -------------------------------------------------------------------------------- /lib/jars/httpclient/httpcore-nio-4.4.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/httpclient/httpcore-nio-4.4.5.jar -------------------------------------------------------------------------------- /lib/jars/sdk/cglib-nodep-2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/cglib-nodep-2.2.jar -------------------------------------------------------------------------------- /lib/jars/sdk/commons-codec-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/commons-codec-1.4.jar -------------------------------------------------------------------------------- /lib/jars/sdk/commons-lang3-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/commons-lang3-3.1.jar -------------------------------------------------------------------------------- /lib/jars/sdk/dom4j-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/dom4j-1.6.1.jar -------------------------------------------------------------------------------- /lib/jars/sdk/fastjson-1.2.50.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/fastjson-1.2.50.jar -------------------------------------------------------------------------------- /lib/jars/sdk/httpasyncclient-4.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/httpasyncclient-4.0.2.jar -------------------------------------------------------------------------------- /lib/jars/sdk/httpclient-4.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/httpclient-4.4.jar -------------------------------------------------------------------------------- /lib/jars/sdk/httpclient-cache-4.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/httpclient-cache-4.4.jar -------------------------------------------------------------------------------- /lib/jars/sdk/httpcore-4.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/httpcore-4.4.jar -------------------------------------------------------------------------------- /lib/jars/sdk/httpcore-nio-4.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/httpcore-nio-4.4.1.jar -------------------------------------------------------------------------------- /lib/jars/sdk/jackson-all-1.9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/jackson-all-1.9.1.jar -------------------------------------------------------------------------------- /lib/jars/sdk/jdom-1.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/jdom-1.1.3.jar -------------------------------------------------------------------------------- /lib/jars/sdk/jdom2-2.0.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/jdom2-2.0.5.jar -------------------------------------------------------------------------------- /lib/jars/sdk/jettison-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/jettison-1.2.jar -------------------------------------------------------------------------------- /lib/jars/sdk/joda-time-1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/joda-time-1.6.jar -------------------------------------------------------------------------------- /lib/jars/sdk/kxml2-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/kxml2-2.3.0.jar -------------------------------------------------------------------------------- /lib/jars/sdk/kxml2-min-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/kxml2-min-2.3.0.jar -------------------------------------------------------------------------------- /lib/jars/sdk/lenovo_pay_sign-1.0.0.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/lenovo_pay_sign-1.0.0.5.jar -------------------------------------------------------------------------------- /lib/jars/sdk/oppo_oauth_1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/oppo_oauth_1.0.jar -------------------------------------------------------------------------------- /lib/jars/sdk/stax-1.2.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/stax-1.2.0.jar -------------------------------------------------------------------------------- /lib/jars/sdk/stax-api-1.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/stax-api-1.0.1.jar -------------------------------------------------------------------------------- /lib/jars/sdk/urlrewritefilter-4.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/urlrewritefilter-4.0.3.jar -------------------------------------------------------------------------------- /lib/jars/sdk/wstx-asl-3.2.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/wstx-asl-3.2.7.jar -------------------------------------------------------------------------------- /lib/jars/sdk/xmlpull-1.1.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/xmlpull-1.1.3.1.jar -------------------------------------------------------------------------------- /lib/jars/sdk/xom-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/xom-1.1.jar -------------------------------------------------------------------------------- /lib/jars/sdk/xpp3_min-1.1.4c.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/xpp3_min-1.1.4c.jar -------------------------------------------------------------------------------- /lib/jars/sdk/xstream-1.4.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/xstream-1.4.8.jar -------------------------------------------------------------------------------- /lib/jars/sdk/xstream-benchmark-1.4.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/sdk/xstream-benchmark-1.4.8.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-aop-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-aop-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-aspects-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-aspects-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-beans-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-beans-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-build-src-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-build-src-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-context-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-context-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-context-support-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-context-support-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-core-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-core-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-expression-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-expression-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-instrument-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-instrument-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-instrument-tomcat-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-instrument-tomcat-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-jdbc-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-jdbc-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-jms-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-jms-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-orm-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-orm-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-oxm-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-oxm-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-struts-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-struts-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-test-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-test-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-tx-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-tx-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-web-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-web-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-webmvc-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-webmvc-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/spring/spring-webmvc-portlet-3.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/spring/spring-webmvc-portlet-3.2.2.jar -------------------------------------------------------------------------------- /lib/jars/struts2/aopalliance-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/aopalliance-1.0.jar -------------------------------------------------------------------------------- /lib/jars/struts2/asm-2.2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/asm-2.2.3.jar -------------------------------------------------------------------------------- /lib/jars/struts2/asm-commons-2.2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/asm-commons-2.2.3.jar -------------------------------------------------------------------------------- /lib/jars/struts2/asm-util-2.2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/asm-util-2.2.3.jar -------------------------------------------------------------------------------- /lib/jars/struts2/aspectjrt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/aspectjrt.jar -------------------------------------------------------------------------------- /lib/jars/struts2/aspectjweaver.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/aspectjweaver.jar -------------------------------------------------------------------------------- /lib/jars/struts2/cglib-nodep-2.1_3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/cglib-nodep-2.1_3.jar -------------------------------------------------------------------------------- /lib/jars/struts2/classworlds-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/classworlds-1.1.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-beanutils-1.7.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-beanutils-1.7.0.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-chain-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-chain-1.2.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-dbcp-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-dbcp-1.4.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-digester-1.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-digester-1.8.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-fileupload-1.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-fileupload-1.2.1.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-io-1.3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-io-1.3.2.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-lang-2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-lang-2.3.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-logging-1.0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-logging-1.0.4.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-logging-api-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-logging-api-1.1.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-pool-1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-pool-1.6.jar -------------------------------------------------------------------------------- /lib/jars/struts2/commons-validator-1.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/commons-validator-1.3.1.jar -------------------------------------------------------------------------------- /lib/jars/struts2/dwr-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/dwr-1.1.1.jar -------------------------------------------------------------------------------- /lib/jars/struts2/ezmorph-1.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/ezmorph-1.0.3.jar -------------------------------------------------------------------------------- /lib/jars/struts2/freemarker-2.3.13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/freemarker-2.3.13.jar -------------------------------------------------------------------------------- /lib/jars/struts2/json-lib-2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/json-lib-2.1.jar -------------------------------------------------------------------------------- /lib/jars/struts2/ognl-2.6.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/ognl-2.6.11.jar -------------------------------------------------------------------------------- /lib/jars/struts2/servlet-api.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/servlet-api.jar -------------------------------------------------------------------------------- /lib/jars/struts2/struts2-convention-plugin-2.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/struts2-convention-plugin-2.1.6.jar -------------------------------------------------------------------------------- /lib/jars/struts2/struts2-core-2.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/struts2-core-2.1.6.jar -------------------------------------------------------------------------------- /lib/jars/struts2/struts2-junit-plugin-2.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/struts2-junit-plugin-2.1.6.jar -------------------------------------------------------------------------------- /lib/jars/struts2/struts2-spring-plugin-2.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/struts2-spring-plugin-2.1.6.jar -------------------------------------------------------------------------------- /lib/jars/struts2/xpp3_min-1.1.3.4.O.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/xpp3_min-1.1.3.4.O.jar -------------------------------------------------------------------------------- /lib/jars/struts2/xstream-1.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/xstream-1.2.2.jar -------------------------------------------------------------------------------- /lib/jars/struts2/xwork-2.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/u8-xiaohei/U8Framework4SSH/9ff96b4ed59d1dca19fc08dd7f3bad409faa5933/lib/jars/struts2/xwork-2.1.2.jar -------------------------------------------------------------------------------- /src/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | classpath:jdbc.properties 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | ${hibernate.dialect} 52 | ${hibernate.show_sql} 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/com/u8/server/PackServer.java: -------------------------------------------------------------------------------- 1 | package com.u8.server; 2 | 3 | import org.springframework.context.ApplicationContext; 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | 7 | /** 8 | * 控制台方式直接启动Spring容器 9 | * Created by ant on 2014/12/9. 10 | */ 11 | public class PackServer { 12 | 13 | 14 | public static void main(String[] args){ 15 | 16 | ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); 17 | 18 | try{ 19 | 20 | //Do something not in web container. 21 | 22 | }catch (Exception e){ 23 | e.printStackTrace(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/u8/server/cache/UApplicationListener.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.cache; 2 | 3 | import com.u8.server.log.Log; 4 | import org.springframework.context.ApplicationEvent; 5 | import org.springframework.context.ApplicationListener; 6 | import org.springframework.stereotype.Repository; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | /** 10 | * 在Spring启动的时候,加载需要缓存的数据 11 | */ 12 | @Repository 13 | @Transactional(readOnly = true) 14 | public class UApplicationListener implements ApplicationListener{ 15 | 16 | // @Autowired 17 | // private UGameDao gameDao; 18 | // @Autowired 19 | // private UChannelDao channelDao; 20 | // @Autowired 21 | // private UChannelMasterDao channelMasterDao; 22 | 23 | private boolean loaded = false; 24 | 25 | @Override 26 | public void onApplicationEvent(ApplicationEvent applicationEvent) { 27 | 28 | try{ 29 | 30 | if(!loaded){ 31 | //To load cache data 32 | loaded = true; 33 | } 34 | 35 | }catch (Exception e){ 36 | Log.e("Load Data on server inited error.", e); 37 | } 38 | 39 | 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/com/u8/server/common/IHibernateTemplate.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.common; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | import org.hibernate.Criteria; 6 | import org.hibernate.Query; 7 | import org.hibernate.Session; 8 | import org.hibernate.SessionFactory; 9 | 10 | public abstract interface IHibernateTemplate 11 | { 12 | public abstract Session getSession(); 13 | 14 | public abstract T get(PK id); 15 | 16 | public abstract void save(T data); 17 | 18 | public abstract void delete(T data); 19 | 20 | public abstract void delete(PK id); 21 | 22 | public abstract List findAll(OrderParameters orderParams); 23 | 24 | public abstract Criteria getCriteria(); 25 | 26 | public abstract List find(String sql, Object[] params, OrderParameters orderParams); 27 | 28 | public abstract Page find(PageParameter page, String sql, Object[] params, OrderParameters orderParams); 29 | 30 | public abstract Query createQuery(String sql, Object[] params); 31 | 32 | public abstract Object findUnique(String sql, Object[] params); 33 | 34 | public abstract Integer findInt(String sql, Object[] params); 35 | 36 | public abstract Long findLong(String sql, Object[] params); 37 | 38 | public abstract SessionFactory getSessionFactory(); 39 | } -------------------------------------------------------------------------------- /src/com/u8/server/common/OrderParameter.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.common; 2 | 3 | import org.hibernate.criterion.Order; 4 | 5 | /*** 6 | * 排序参数 7 | */ 8 | public class OrderParameter 9 | { 10 | private String fieldName; 11 | private OrderType orderType; 12 | 13 | public OrderParameter(String fieldName, OrderType orderType) 14 | { 15 | this.fieldName = fieldName; 16 | this.orderType = orderType; 17 | } 18 | 19 | public static OrderParameter asc(String fieldName) 20 | { 21 | return new OrderParameter(fieldName, OrderType.ASC); 22 | } 23 | 24 | public static OrderParameter desc(String fieldName) 25 | { 26 | return new OrderParameter(fieldName, OrderType.DESC); 27 | } 28 | 29 | public String getField() 30 | { 31 | return this.fieldName; 32 | } 33 | 34 | public Order getOrder() 35 | { 36 | Order localOrder = null; 37 | if (OrderType.ASC.equals(this.orderType)) 38 | localOrder = Order.asc(this.fieldName); 39 | else if (OrderType.DESC.equals(this.orderType)) 40 | localOrder = Order.desc(this.fieldName); 41 | return localOrder; 42 | } 43 | 44 | public boolean isAsc() 45 | { 46 | return this.orderType.equals(OrderType.ASC); 47 | } 48 | 49 | public boolean isDesc() 50 | { 51 | return this.orderType.equals(OrderType.DESC); 52 | } 53 | 54 | public static enum OrderType 55 | { 56 | ASC, DESC; 57 | } 58 | } -------------------------------------------------------------------------------- /src/com/u8/server/common/OrderParameters.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.common; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | /*** 8 | * 多个排序组合 9 | */ 10 | public class OrderParameters 11 | { 12 | private List parameters = new ArrayList(); 13 | 14 | public void add(String fieldName, OrderParameter.OrderType orderType) 15 | { 16 | OrderParameter localOrderParameter = new OrderParameter(fieldName, orderType); 17 | this.parameters.add(localOrderParameter); 18 | } 19 | 20 | public String toString() 21 | { 22 | String str = ""; 23 | if (getSize() > 0) 24 | { 25 | StringBuilder localStringBuilder = new StringBuilder(" order by "); 26 | Iterator localIterator = this.parameters.iterator(); 27 | while (localIterator.hasNext()) 28 | { 29 | OrderParameter localOrderParameter = (OrderParameter)localIterator.next(); 30 | localStringBuilder.append(localOrderParameter.getField()); 31 | if (localOrderParameter.isAsc()) 32 | localStringBuilder.append(" asc,"); 33 | else 34 | localStringBuilder.append(" desc,"); 35 | } 36 | str = localStringBuilder.substring(0, localStringBuilder.length() - 1); 37 | } 38 | return str; 39 | } 40 | 41 | public List getParameters() 42 | { 43 | return this.parameters; 44 | } 45 | 46 | public void setParameters(List paramList) 47 | { 48 | this.parameters = paramList; 49 | } 50 | 51 | public int getSize() 52 | { 53 | return this.parameters.size(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/com/u8/server/common/Page.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.common; 2 | 3 | import java.util.List; 4 | 5 | /*** 6 | * 分页 7 | * @param 8 | */ 9 | public class Page 10 | { 11 | private PageParameter pageParameter; 12 | private List resultList = null; 13 | private int totalCount = -1; 14 | 15 | public Page() 16 | { 17 | this.pageParameter = new PageParameter(1, 10, false); 18 | } 19 | 20 | public Page(PageParameter params) 21 | { 22 | this.pageParameter = params; 23 | } 24 | 25 | public int getTotalPages() 26 | { 27 | if (this.totalCount == -1) 28 | return -1; 29 | int i = this.totalCount / this.pageParameter.getPageSize(); 30 | if (this.totalCount % this.pageParameter.getPageSize() > 0) 31 | i++; 32 | return i; 33 | } 34 | 35 | public List getResultList() 36 | { 37 | return this.resultList; 38 | } 39 | 40 | public void setResultList(List paramList) 41 | { 42 | this.resultList = paramList; 43 | } 44 | 45 | public int getTotalCount() 46 | { 47 | return this.totalCount; 48 | } 49 | 50 | public void setTotalCount(int paramInt) 51 | { 52 | this.totalCount = paramInt; 53 | } 54 | 55 | public PageParameter getPageParameter() 56 | { 57 | return this.pageParameter; 58 | } 59 | 60 | public void setPageParameter(PageParameter params) 61 | { 62 | this.pageParameter = params; 63 | } 64 | } -------------------------------------------------------------------------------- /src/com/u8/server/common/PageParameter.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.common; 2 | 3 | /*** 4 | * 分页参数 5 | */ 6 | public class PageParameter 7 | { 8 | protected int pageNo = 1; 9 | protected int pageSize = -1; 10 | protected boolean autoCount = false; 11 | 12 | public PageParameter(int pageSize) 13 | { 14 | this.pageSize = pageSize; 15 | } 16 | 17 | public PageParameter(int pageNo, int pageSize, boolean autoCount) 18 | { 19 | this.pageNo = pageNo; 20 | this.pageSize = pageSize; 21 | this.autoCount = autoCount; 22 | } 23 | 24 | public boolean isPageSizeSetted() 25 | { 26 | return this.pageSize > -1; 27 | } 28 | 29 | public int getFirst() 30 | { 31 | if ((this.pageNo < 1) || (this.pageSize < 1)) 32 | return -1; 33 | return (this.pageNo - 1) * this.pageSize; 34 | } 35 | 36 | public boolean isFirstSetted() 37 | { 38 | return (this.pageNo > 0) && (this.pageSize > 0); 39 | } 40 | 41 | public int getPageNo() 42 | { 43 | return this.pageNo; 44 | } 45 | 46 | public void setPageNo(int pageNo) 47 | { 48 | this.pageNo = pageNo; 49 | } 50 | 51 | public int getPageSize() 52 | { 53 | return this.pageSize; 54 | } 55 | 56 | public void setPageSize(int pageSize) 57 | { 58 | this.pageSize = pageSize; 59 | } 60 | 61 | public boolean isAutoCount() 62 | { 63 | return this.autoCount; 64 | } 65 | 66 | public void setAutoCount(boolean autoCount) 67 | { 68 | this.autoCount = autoCount; 69 | } 70 | } -------------------------------------------------------------------------------- /src/com/u8/server/common/UActionSupport.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.common; 2 | 3 | import com.opensymphony.xwork2.ActionSupport; 4 | import java.io.IOException; 5 | import java.util.Map; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import org.apache.commons.logging.Log; 9 | import org.apache.commons.logging.LogFactory; 10 | import org.apache.struts2.ServletActionContext; 11 | import org.apache.struts2.interceptor.ServletRequestAware; 12 | import org.apache.struts2.interceptor.ServletResponseAware; 13 | import org.apache.struts2.interceptor.SessionAware; 14 | 15 | /** 16 | * 所有Action继承该类 17 | */ 18 | public class UActionSupport extends ActionSupport 19 | implements ServletRequestAware, SessionAware, ServletResponseAware 20 | { 21 | protected HttpServletRequest request; 22 | protected HttpServletResponse response; 23 | protected Map session; 24 | protected String scripts; 25 | private final Log logger = LogFactory.getLog(getClass()); 26 | 27 | protected void render(String content, String contentType) 28 | { 29 | try 30 | { 31 | HttpServletResponse localHttpServletResponse = ServletActionContext.getResponse(); 32 | if (localHttpServletResponse != null) 33 | { 34 | localHttpServletResponse.setHeader("Pragma", "No-cache"); 35 | localHttpServletResponse.setHeader("Cache-Control", "no-cache"); 36 | localHttpServletResponse.setDateHeader("Expires", 0L); 37 | localHttpServletResponse.setContentType(contentType); 38 | localHttpServletResponse.getWriter().write(content); 39 | } 40 | } 41 | catch (IOException localIOException) 42 | { 43 | this.logger.error(localIOException.getMessage(), localIOException); 44 | } 45 | } 46 | 47 | protected boolean isPost() 48 | { 49 | return "POST".equals(this.request.getMethod()); 50 | } 51 | 52 | protected void renderText(String content) 53 | { 54 | render(content, "text/plain; charset=UTF-8"); 55 | } 56 | 57 | protected void renderJson(String content) 58 | { 59 | render(content, "text/json; charset=UTF-8"); 60 | } 61 | 62 | protected void renderHtml(String content) 63 | { 64 | render(content, "text/html; charset=UTF-8"); 65 | } 66 | 67 | protected void renderXml(String content) 68 | { 69 | render(content, "text/xml; charset=UTF-8"); 70 | } 71 | 72 | protected void putIntoSession(String key, Object value) 73 | { 74 | this.session.put(key, value); 75 | } 76 | 77 | public void setServletRequest(HttpServletRequest req) 78 | { 79 | this.request = req; 80 | } 81 | 82 | public void setServletResponse(HttpServletResponse response) 83 | { 84 | this.response = response; 85 | } 86 | 87 | public void setSession(Map session) 88 | { 89 | this.session = session; 90 | } 91 | 92 | public Map getSession() 93 | { 94 | return this.session; 95 | } 96 | 97 | public String getScripts() 98 | { 99 | return this.scripts; 100 | } 101 | 102 | public void setScripts(String scripts) 103 | { 104 | this.scripts = scripts; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/com/u8/server/common/UHibernateTemplate.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.common; 2 | 3 | import java.io.Serializable; 4 | import java.lang.reflect.ParameterizedType; 5 | import java.lang.reflect.Type; 6 | import java.util.ArrayList; 7 | import java.util.Iterator; 8 | import java.util.List; 9 | import org.hibernate.Criteria; 10 | import org.hibernate.Query; 11 | import org.hibernate.Session; 12 | import org.hibernate.SessionFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.beans.factory.annotation.Qualifier; 15 | import org.springframework.util.Assert; 16 | 17 | /*** 18 | * Hibernate Dao 层默认继承该类 19 | * @param 20 | * @param 21 | */ 22 | public class UHibernateTemplate 23 | implements IHibernateTemplate 24 | { 25 | public SessionFactory sessionFactory; 26 | protected Class entityClass; 27 | 28 | @SuppressWarnings("unchecked") 29 | public UHibernateTemplate() 30 | { 31 | this.entityClass = null; 32 | Class localClass = getClass(); 33 | Type localType = localClass.getGenericSuperclass(); 34 | if ((localType instanceof ParameterizedType)) 35 | { 36 | Type[] arrayOfType = ((ParameterizedType)localType).getActualTypeArguments(); 37 | this.entityClass = ((Class)arrayOfType[0]); 38 | } 39 | } 40 | 41 | public UHibernateTemplate(SessionFactory sessionFactory, Class clazz) 42 | { 43 | this.sessionFactory = sessionFactory; 44 | this.entityClass = clazz; 45 | } 46 | 47 | public Session getSession() 48 | { 49 | return this.sessionFactory.getCurrentSession(); 50 | } 51 | 52 | @SuppressWarnings("unchecked") 53 | public T get(PK id) 54 | { 55 | return (T)getSession().get(this.entityClass, id); 56 | } 57 | 58 | public void save(T data) 59 | { 60 | Assert.notNull(data); 61 | getSession().saveOrUpdate(data); 62 | } 63 | 64 | public void delete(T data) 65 | { 66 | Assert.notNull(data); 67 | getSession().delete(data); 68 | } 69 | 70 | public void delete(PK id) 71 | { 72 | delete(get(id)); 73 | } 74 | 75 | @SuppressWarnings("unchecked") 76 | public List findAll(OrderParameters orderParams) 77 | { 78 | Criteria localCriteria = getCriteria(); 79 | if (orderParams != null) 80 | { 81 | Iterator localIterator = orderParams.getParameters().iterator(); 82 | while (localIterator.hasNext()) 83 | { 84 | OrderParameter localOrderParameter = (OrderParameter)localIterator.next(); 85 | localCriteria.addOrder(localOrderParameter.getOrder()); 86 | } 87 | } 88 | return new ArrayList(localCriteria.list()); 89 | } 90 | 91 | public List findAll(){ 92 | 93 | return findAll(null); 94 | } 95 | 96 | public Criteria getCriteria() 97 | { 98 | return getSession().createCriteria(this.entityClass); 99 | } 100 | 101 | @SuppressWarnings("unchecked") 102 | public List find(String sql, Object[] params, OrderParameters orderParams) 103 | { 104 | Assert.hasText(sql); 105 | sql = sql + (orderParams==null?"":orderParams.toString()); 106 | return new ArrayList(createQuery(sql, params).list()); 107 | } 108 | 109 | @SuppressWarnings("unchecked") 110 | public Page find(PageParameter page, String sql, Object[] params, OrderParameters orderParams) 111 | { 112 | Assert.notNull(page); 113 | Assert.notNull(sql); 114 | Page localPage = new Page(); 115 | localPage.setPageParameter(page); 116 | Query localQuery; 117 | if (page.isAutoCount()) 118 | { 119 | String str = "select count(*) " + sql; 120 | localQuery = createQuery(str, params); 121 | localPage.setTotalCount(localQuery.list().size()); 122 | } 123 | if (localPage.getTotalCount() > 0) 124 | { 125 | sql = sql + orderParams.toString(); 126 | localQuery = createQuery(sql, params); 127 | if (page.isFirstSetted()) 128 | localQuery.setFirstResult(page.getFirst()); 129 | if (page.isPageSizeSetted()) 130 | localQuery.setMaxResults(page.getPageSize()); 131 | localPage.setResultList(localQuery.list()); 132 | return localPage; 133 | } 134 | return null; 135 | } 136 | 137 | public Query createQuery(String sql, Object[] params) 138 | { 139 | Assert.hasText(sql); 140 | Query localQuery = getSession().createQuery(sql); 141 | if (params != null) 142 | for (int i = 0; i < params.length; i++) 143 | localQuery.setParameter(i, params[i]); 144 | return localQuery; 145 | } 146 | 147 | public Object findUnique(String sql, Object... params) 148 | { 149 | return createQuery(sql, params).uniqueResult(); 150 | } 151 | 152 | public Integer findInt(String sql, Object[] params) 153 | { 154 | return Integer.valueOf(findLong(sql, params).intValue()); 155 | } 156 | 157 | public Long findLong(String sql, Object[] params) 158 | { 159 | return (Long)findUnique(sql, params); 160 | } 161 | 162 | public SessionFactory getSessionFactory() 163 | { 164 | return this.sessionFactory; 165 | } 166 | 167 | @Autowired 168 | public void setSessionFactory(@Qualifier("sessionFactory") SessionFactory paramSessionFactory) 169 | { 170 | this.sessionFactory = paramSessionFactory; 171 | } 172 | 173 | public Class getEntityClass() 174 | { 175 | return this.entityClass; 176 | } 177 | 178 | public void setEntityClass(Class paramClass) 179 | { 180 | this.entityClass = paramClass; 181 | } 182 | } -------------------------------------------------------------------------------- /src/com/u8/server/dao/UUserDao.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.dao; 2 | 3 | import com.u8.server.common.UHibernateTemplate; 4 | import com.u8.server.data.UUser; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * 用户数据访问类 9 | */ 10 | @Repository("userDao") 11 | public class UUserDao extends UHibernateTemplate{ 12 | 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/com/u8/server/data/UUser.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.data; 2 | 3 | import net.sf.json.JSONObject; 4 | 5 | import javax.persistence.*; 6 | import java.util.Date; 7 | 8 | /** 9 | * 用户数据对象 10 | */ 11 | 12 | @Entity 13 | @Table(name = "uuser") 14 | public class UUser { 15 | 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | private int id; 19 | private int appID; 20 | private int channelID; 21 | private String name; 22 | private String channelUserID; 23 | private String channelUserName; 24 | private String channelUserNick; 25 | private Date createTime; 26 | private Date lastLoginTime; 27 | private String token; 28 | 29 | public JSONObject toJSON(){ 30 | JSONObject json = new JSONObject(); 31 | json.put("id", id); 32 | json.put("appID", appID); 33 | json.put("channelID", channelID); 34 | json.put("name", name); 35 | json.put("channelUserID", channelUserID); 36 | json.put("channelUserName", channelUserName); 37 | json.put("channelUserNick", channelUserNick); 38 | return json; 39 | } 40 | 41 | public int getId() { 42 | return id; 43 | } 44 | 45 | public void setId(int id) { 46 | this.id = id; 47 | } 48 | 49 | public int getAppID() { 50 | return appID; 51 | } 52 | 53 | public void setAppID(int appID) { 54 | this.appID = appID; 55 | } 56 | 57 | public int getChannelID() { 58 | return channelID; 59 | } 60 | 61 | public void setChannelID(int channelID) { 62 | this.channelID = channelID; 63 | } 64 | 65 | public String getName() { 66 | return name; 67 | } 68 | 69 | public void setName(String name) { 70 | this.name = name; 71 | } 72 | 73 | public String getChannelUserID() { 74 | return channelUserID; 75 | } 76 | 77 | public void setChannelUserID(String channelUserID) { 78 | this.channelUserID = channelUserID; 79 | } 80 | 81 | public String getChannelUserName() { 82 | return channelUserName; 83 | } 84 | 85 | public void setChannelUserName(String channelUserName) { 86 | this.channelUserName = channelUserName; 87 | } 88 | 89 | public String getChannelUserNick() { 90 | return channelUserNick; 91 | } 92 | 93 | public void setChannelUserNick(String channelUserNick) { 94 | this.channelUserNick = channelUserNick; 95 | } 96 | 97 | public Date getCreateTime() { 98 | return createTime; 99 | } 100 | 101 | public void setCreateTime(Date createTime) { 102 | this.createTime = createTime; 103 | } 104 | 105 | public Date getLastLoginTime() { 106 | return lastLoginTime; 107 | } 108 | 109 | public void setLastLoginTime(Date lastLoginTime) { 110 | this.lastLoginTime = lastLoginTime; 111 | } 112 | 113 | public String getToken() { 114 | return token; 115 | } 116 | 117 | public void setToken(String token) { 118 | this.token = token; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/com/u8/server/filters/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.filters; 2 | 3 | import com.opensymphony.xwork2.Action; 4 | import com.opensymphony.xwork2.ActionInvocation; 5 | import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor; 6 | import com.u8.server.common.UActionSupport; 7 | import org.apache.struts2.ServletActionContext; 8 | 9 | import javax.servlet.http.HttpServletRequest; 10 | import java.util.Map; 11 | 12 | /** 13 | * Created by ant on 2015/8/29. 14 | */ 15 | public class LoginInterceptor extends MethodFilterInterceptor { 16 | 17 | 18 | @Override 19 | protected String doIntercept(ActionInvocation actionInvocation) throws Exception { 20 | 21 | HttpServletRequest request= ServletActionContext.getRequest(); 22 | String path=request.getRequestURI(); 23 | if(!path.startsWith("/admin")){ 24 | 25 | return actionInvocation.invoke(); 26 | } 27 | 28 | UActionSupport action = (UActionSupport)actionInvocation.getAction(); 29 | Map session = action.getSession(); 30 | 31 | if(session.containsKey("adminName")){ 32 | return actionInvocation.invoke(); 33 | }else{ 34 | return Action.LOGIN; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/com/u8/server/log/Log.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.log; 2 | 3 | import org.apache.log4j.Logger; 4 | 5 | /** 6 | * 日志接口 7 | */ 8 | public class Log { 9 | 10 | private static Logger logger = Logger.getLogger(Log.class.getName()); 11 | 12 | public static void i(String msg){ 13 | logger.info(msg); 14 | } 15 | 16 | public static void d(String msg){ logger.info(msg); } 17 | 18 | public static void e(String msg){ 19 | logger.error(msg); 20 | } 21 | 22 | public static void e(String msg, Throwable throwable){ 23 | logger.error(msg, throwable); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/u8/server/service/UUserManager.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.service; 2 | 3 | import com.u8.server.common.OrderParameter; 4 | import com.u8.server.common.OrderParameters; 5 | import com.u8.server.common.Page; 6 | import com.u8.server.common.PageParameter; 7 | import com.u8.server.dao.UUserDao; 8 | import com.u8.server.data.UUser; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * 这里处理UUser相关的逻辑操作 16 | */ 17 | @Service("userManager") 18 | public class UUserManager { 19 | 20 | @Autowired 21 | private UUserDao userDao; 22 | 23 | //根据渠道用户ID获取用户信息 24 | public UUser getUserByCpID(int appID, int channelID, String cpUserID){ 25 | 26 | String hql = "from UUser where appID = ? and channelID = ? and channelUserID = ?"; 27 | 28 | return (UUser)userDao.findUnique(hql, appID, channelID, cpUserID); 29 | 30 | } 31 | 32 | //获取指定渠道下的所有用户 33 | public List getUsersByChannel(int channelID){ 34 | String hql = "from UUser where channelID = ?"; 35 | 36 | return userDao.find(hql, new Object[]{channelID}, null); 37 | } 38 | 39 | //分页查找 40 | public Page queryPage(int currPage, int num){ 41 | 42 | PageParameter page = new PageParameter(currPage, num, true); 43 | OrderParameters order = new OrderParameters(); 44 | order.add("id", OrderParameter.OrderType.DESC); 45 | String hql = "from UUser"; 46 | return userDao.find(page, hql, null, order); 47 | } 48 | 49 | 50 | public UUser getUser(int userID){ 51 | 52 | return userDao.get(userID); 53 | } 54 | 55 | public void saveUser(UUser user){ 56 | userDao.save(user); 57 | } 58 | 59 | public void deleteUser(UUser user){ 60 | userDao.delete(user); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/com/u8/server/utils/Base64.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The MobileSecurePay Project 3 | * All right reserved. 4 | * author: shiqun.shi@alipay.com 5 | */ 6 | 7 | package com.u8.server.utils; 8 | 9 | import java.nio.charset.Charset; 10 | 11 | public final class Base64 { 12 | 13 | static private final int BASELENGTH = 128; 14 | static private final int LOOKUPLENGTH = 64; 15 | static private final int TWENTYFOURBITGROUP = 24; 16 | static private final int EIGHTBIT = 8; 17 | static private final int SIXTEENBIT = 16; 18 | static private final int FOURBYTE = 4; 19 | static private final int SIGN = -128; 20 | static private final char PAD = '='; 21 | static private final boolean fDebug = false; 22 | static final private byte[] base64Alphabet = new byte[BASELENGTH]; 23 | static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; 24 | 25 | static { 26 | for (int i = 0; i < BASELENGTH; ++i) { 27 | base64Alphabet[i] = -1; 28 | } 29 | for (int i = 'Z'; i >= 'A'; i--) { 30 | base64Alphabet[i] = (byte) (i - 'A'); 31 | } 32 | for (int i = 'z'; i >= 'a'; i--) { 33 | base64Alphabet[i] = (byte) (i - 'a' + 26); 34 | } 35 | 36 | for (int i = '9'; i >= '0'; i--) { 37 | base64Alphabet[i] = (byte) (i - '0' + 52); 38 | } 39 | 40 | base64Alphabet['+'] = 62; 41 | base64Alphabet['/'] = 63; 42 | 43 | for (int i = 0; i <= 25; i++) { 44 | lookUpBase64Alphabet[i] = (char) ('A' + i); 45 | } 46 | 47 | for (int i = 26, j = 0; i <= 51; i++, j++) { 48 | lookUpBase64Alphabet[i] = (char) ('a' + j); 49 | } 50 | 51 | for (int i = 52, j = 0; i <= 61; i++, j++) { 52 | lookUpBase64Alphabet[i] = (char) ('0' + j); 53 | } 54 | lookUpBase64Alphabet[62] = (char) '+'; 55 | lookUpBase64Alphabet[63] = (char) '/'; 56 | 57 | } 58 | 59 | private static boolean isWhiteSpace(char octect) { 60 | return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); 61 | } 62 | 63 | private static boolean isPad(char octect) { 64 | return (octect == PAD); 65 | } 66 | 67 | private static boolean isData(char octect) { 68 | return (octect < BASELENGTH && base64Alphabet[octect] != -1); 69 | } 70 | 71 | /** 72 | * Encodes hex octects into Base64 73 | * 74 | * @param binaryData Array containing binaryData 75 | * @return Encoded Base64 array 76 | */ 77 | public static String encode(byte[] binaryData) { 78 | 79 | if (binaryData == null) { 80 | return null; 81 | } 82 | 83 | int lengthDataBits = binaryData.length * EIGHTBIT; 84 | if (lengthDataBits == 0) { 85 | return ""; 86 | } 87 | 88 | int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; 89 | int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; 90 | int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; 91 | char encodedData[] = null; 92 | 93 | encodedData = new char[numberQuartet * 4]; 94 | 95 | byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; 96 | 97 | int encodedIndex = 0; 98 | int dataIndex = 0; 99 | if (fDebug) { 100 | System.out.println("number of triplets = " + numberTriplets); 101 | } 102 | 103 | for (int i = 0; i < numberTriplets; i++) { 104 | b1 = binaryData[dataIndex++]; 105 | b2 = binaryData[dataIndex++]; 106 | b3 = binaryData[dataIndex++]; 107 | 108 | if (fDebug) { 109 | System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3); 110 | } 111 | 112 | l = (byte) (b2 & 0x0f); 113 | k = (byte) (b1 & 0x03); 114 | 115 | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); 116 | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); 117 | byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); 118 | 119 | if (fDebug) { 120 | System.out.println("val2 = " + val2); 121 | System.out.println("k4 = " + (k << 4)); 122 | System.out.println("vak = " + (val2 | (k << 4))); 123 | } 124 | 125 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; 126 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; 127 | encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; 128 | encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; 129 | } 130 | 131 | // form integral number of 6-bit groups 132 | if (fewerThan24bits == EIGHTBIT) { 133 | b1 = binaryData[dataIndex]; 134 | k = (byte) (b1 & 0x03); 135 | if (fDebug) { 136 | System.out.println("b1=" + b1); 137 | System.out.println("b1<<2 = " + (b1 >> 2)); 138 | } 139 | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); 140 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; 141 | encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; 142 | encodedData[encodedIndex++] = PAD; 143 | encodedData[encodedIndex++] = PAD; 144 | } else if (fewerThan24bits == SIXTEENBIT) { 145 | b1 = binaryData[dataIndex]; 146 | b2 = binaryData[dataIndex + 1]; 147 | l = (byte) (b2 & 0x0f); 148 | k = (byte) (b1 & 0x03); 149 | 150 | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); 151 | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); 152 | 153 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; 154 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; 155 | encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; 156 | encodedData[encodedIndex++] = PAD; 157 | } 158 | 159 | return new String(encodedData); 160 | } 161 | 162 | /** 163 | * Decodes Base64 data into octects 164 | * 165 | * @param encoded string containing Base64 data 166 | * @return Array containind decoded data. 167 | */ 168 | public static byte[] decode2Bytes(String encoded) { 169 | 170 | if (encoded == null) { 171 | return null; 172 | } 173 | 174 | char[] base64Data = encoded.toCharArray(); 175 | // remove white spaces 176 | int len = removeWhiteSpace(base64Data); 177 | 178 | if (len % FOURBYTE != 0) { 179 | return null;//should be divisible by four 180 | } 181 | 182 | int numberQuadruple = (len / FOURBYTE); 183 | 184 | if (numberQuadruple == 0) { 185 | return new byte[0]; 186 | } 187 | 188 | byte decodedData[] = null; 189 | byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; 190 | char d1 = 0, d2 = 0, d3 = 0, d4 = 0; 191 | 192 | int i = 0; 193 | int encodedIndex = 0; 194 | int dataIndex = 0; 195 | decodedData = new byte[(numberQuadruple) * 3]; 196 | 197 | for (; i < numberQuadruple - 1; i++) { 198 | 199 | if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) 200 | || !isData((d3 = base64Data[dataIndex++])) 201 | || !isData((d4 = base64Data[dataIndex++]))) { 202 | return null; 203 | }//if found "no data" just return null 204 | 205 | b1 = base64Alphabet[d1]; 206 | b2 = base64Alphabet[d2]; 207 | b3 = base64Alphabet[d3]; 208 | b4 = base64Alphabet[d4]; 209 | 210 | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); 211 | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); 212 | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); 213 | } 214 | 215 | if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) { 216 | return null;//if found "no data" just return null 217 | } 218 | 219 | b1 = base64Alphabet[d1]; 220 | b2 = base64Alphabet[d2]; 221 | 222 | d3 = base64Data[dataIndex++]; 223 | d4 = base64Data[dataIndex++]; 224 | if (!isData((d3)) || !isData((d4))) {//Check if they are PAD characters 225 | if (isPad(d3) && isPad(d4)) { 226 | if ((b2 & 0xf) != 0)//last 4 bits should be zero 227 | { 228 | return null; 229 | } 230 | byte[] tmp = new byte[i * 3 + 1]; 231 | System.arraycopy(decodedData, 0, tmp, 0, i * 3); 232 | tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); 233 | return tmp; 234 | } else if (!isPad(d3) && isPad(d4)) { 235 | b3 = base64Alphabet[d3]; 236 | if ((b3 & 0x3) != 0)//last 2 bits should be zero 237 | { 238 | return null; 239 | } 240 | byte[] tmp = new byte[i * 3 + 2]; 241 | System.arraycopy(decodedData, 0, tmp, 0, i * 3); 242 | tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); 243 | tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); 244 | return tmp; 245 | } else { 246 | return null; 247 | } 248 | } else { //No PAD e.g 3cQl 249 | b3 = base64Alphabet[d3]; 250 | b4 = base64Alphabet[d4]; 251 | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); 252 | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); 253 | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); 254 | 255 | } 256 | 257 | return decodedData; 258 | } 259 | 260 | public static String encode(String s, String encode){ 261 | try{ 262 | 263 | return encode(s.getBytes(Charset.forName(encode))); 264 | 265 | }catch (Exception e){ 266 | e.printStackTrace(); 267 | } 268 | 269 | return ""; 270 | } 271 | 272 | public static String decode(String s) 273 | { 274 | 275 | byte buf[]; 276 | try { 277 | buf = decode2Bytes(s); 278 | 279 | s=new String(buf,"UTF-8"); 280 | s=s.replaceAll("[\\n|\\r]",""); 281 | } catch (Exception e) { 282 | e.printStackTrace(); 283 | return ""; 284 | } 285 | return s; 286 | } 287 | 288 | /** 289 | * remove WhiteSpace from MIME containing encoded Base64 data. 290 | * 291 | * @param data the byte array of base64 data (with WS) 292 | * @return the new length 293 | */ 294 | private static int removeWhiteSpace(char[] data) { 295 | if (data == null) { 296 | return 0; 297 | } 298 | 299 | // count characters that's not whitespace 300 | int newSize = 0; 301 | int len = data.length; 302 | for (int i = 0; i < len; i++) { 303 | if (!isWhiteSpace(data[i])) { 304 | data[newSize++] = data[i]; 305 | } 306 | } 307 | return newSize; 308 | } 309 | } 310 | -------------------------------------------------------------------------------- /src/com/u8/server/utils/EncryptUtils.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.utils; 2 | 3 | import com.u8.server.log.Log; 4 | 5 | import java.nio.charset.Charset; 6 | import java.security.MessageDigest; 7 | 8 | /** 9 | * 数据加密处理 10 | */ 11 | public class EncryptUtils { 12 | 13 | public static String md5(String txt){ 14 | 15 | return encrypt(txt, "MD5"); 16 | } 17 | 18 | public static String sha(String txt){ 19 | 20 | return encrypt(txt, "SHA"); 21 | } 22 | 23 | public static String sha1(String txt){ 24 | 25 | return encrypt(txt, "SHA1"); 26 | } 27 | 28 | private static String encrypt(String txt, String algorithName){ 29 | 30 | if(txt == null || txt.trim().length() == 0){ 31 | return null; 32 | } 33 | 34 | if(algorithName == null || algorithName.trim().length() == 0){ 35 | algorithName = "MD5"; 36 | } 37 | 38 | String result = null; 39 | 40 | try{ 41 | MessageDigest m = MessageDigest.getInstance(algorithName); 42 | m.reset(); 43 | m.update(txt.getBytes(Charset.forName("UTF-8"))); 44 | byte[] bts = m.digest(); 45 | 46 | return hex(bts); 47 | }catch (Exception e){ 48 | Log.e("encrypt error.", e); 49 | } 50 | 51 | 52 | return null; 53 | } 54 | 55 | private static String hex(byte[] bts){ 56 | StringBuilder sb = new StringBuilder(); 57 | for(int i=0; i data){ 45 | 46 | if(data == null || data.size() == 0){ 47 | return new JSONObject(); 48 | } 49 | 50 | JSONObject json = new JSONObject(); 51 | 52 | Iterator keyItor = data.keySet().iterator(); 53 | while(keyItor.hasNext()){ 54 | String key = keyItor.next(); 55 | json.put(key, data.get(key)); 56 | } 57 | 58 | return json; 59 | } 60 | 61 | public static String map2JsonStr(Map data){ 62 | 63 | return map2Json(data).toString(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/com/u8/server/utils/RSAUtils.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.utils; 2 | 3 | import java.security.*; 4 | import java.security.interfaces.RSAPrivateKey; 5 | import java.security.interfaces.RSAPublicKey; 6 | import java.security.spec.PKCS8EncodedKeySpec; 7 | import java.security.spec.X509EncodedKeySpec; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * Created by ant on 2015/4/11. 13 | */ 14 | public class RSAUtils { 15 | 16 | public static final String KEY_ALGORITHM = "RSA"; 17 | public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; 18 | 19 | private static final String PUBLIC_KEY = "RSAPublicKey"; 20 | private static final String PRIVATE_KEY = "RSAPrivateKey"; 21 | 22 | /** 23 | * 生成公钥和私钥 24 | * 25 | * @return 26 | * @throws Exception 27 | */ 28 | public static Map generateKeys() throws Exception { 29 | KeyPairGenerator keyPairGen = KeyPairGenerator 30 | .getInstance(KEY_ALGORITHM); 31 | keyPairGen.initialize(1024); 32 | 33 | KeyPair keyPair = keyPairGen.generateKeyPair(); 34 | 35 | // 公钥 36 | RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); 37 | 38 | // 私钥 39 | RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); 40 | 41 | Map keyMap = new HashMap(2); 42 | 43 | keyMap.put(PUBLIC_KEY, publicKey); 44 | keyMap.put(PRIVATE_KEY, privateKey); 45 | return keyMap; 46 | } 47 | 48 | /** 49 | * 使用公钥对RSA签名有效性进行检查 50 | * @param content 待签名数据 51 | * @param sign 签名值 52 | * @param publicKey 爱贝公钥 53 | * @param input_charset 编码格式 54 | * @return 布尔值 55 | */ 56 | public static boolean verify(String content, String sign, String publicKey, String input_charset) 57 | { 58 | try 59 | { 60 | KeyFactory keyFactory = KeyFactory.getInstance("RSA"); 61 | byte[] encodedKey = Base64.decode2Bytes(publicKey); 62 | PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); 63 | 64 | 65 | java.security.Signature signature = java.security.Signature 66 | .getInstance(SIGNATURE_ALGORITHM); 67 | 68 | signature.initVerify(pubKey); 69 | signature.update( content.getBytes(input_charset) ); 70 | 71 | return signature.verify( Base64.decode2Bytes(sign) ); 72 | 73 | } 74 | catch (Exception e) 75 | { 76 | e.printStackTrace(); 77 | } 78 | 79 | return false; 80 | } 81 | 82 | /** 83 | * 使用私钥对数据进行RSA签名 84 | * @param content 待签名数据 85 | * @param privateKey 商户私钥 86 | * @param input_charset 编码格式 87 | * @return 签名值 88 | */ 89 | public static String sign(String content, String privateKey, String input_charset) 90 | { 91 | try 92 | { 93 | PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( Base64.decode2Bytes(privateKey) ); 94 | KeyFactory keyf = KeyFactory.getInstance("RSA"); 95 | PrivateKey priKey = keyf.generatePrivate(priPKCS8); 96 | 97 | java.security.Signature signature = java.security.Signature 98 | .getInstance(SIGNATURE_ALGORITHM); 99 | 100 | signature.initSign(priKey); 101 | signature.update( content.getBytes(input_charset) ); 102 | 103 | byte[] signed = signature.sign(); 104 | 105 | return Base64.encode(signed); 106 | } 107 | catch (Exception e) 108 | { 109 | e.printStackTrace(); 110 | } 111 | 112 | return null; 113 | } 114 | 115 | 116 | /** 117 | * 取得私钥 118 | * 119 | * @param keyMap 120 | * @return 121 | * @throws Exception 122 | */ 123 | public static String getPrivateKey(Map keyMap) 124 | throws Exception { 125 | Key key = (Key) keyMap.get(PRIVATE_KEY); 126 | 127 | return Base64.encode(key.getEncoded()); 128 | } 129 | 130 | /** 131 | * 取得公钥 132 | * 133 | * @param keyMap 134 | * @return 135 | * @throws Exception 136 | */ 137 | public static String getPublicKey(Map keyMap) 138 | throws Exception { 139 | Key key = (Key) keyMap.get(PUBLIC_KEY); 140 | 141 | return Base64.encode(key.getEncoded()); 142 | } 143 | 144 | public static void main(String[] args) throws Exception { 145 | 146 | Map keys = generateKeys(); 147 | 148 | String pubKey = getPublicKey(keys); 149 | String priKey = getPrivateKey(keys); 150 | 151 | System.out.println("The pubKey is "); 152 | System.out.println(pubKey); 153 | System.out.println(priKey); 154 | 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /src/com/u8/server/web/UserAction.java: -------------------------------------------------------------------------------- 1 | package com.u8.server.web; 2 | 3 | import com.opensymphony.xwork2.ModelDriven; 4 | import com.u8.server.common.Page; 5 | import com.u8.server.common.UActionSupport; 6 | import com.u8.server.data.UUser; 7 | import com.u8.server.log.Log; 8 | import com.u8.server.service.UUserManager; 9 | import net.sf.json.JSONArray; 10 | import net.sf.json.JSONObject; 11 | import org.apache.struts2.convention.annotation.Action; 12 | import org.apache.struts2.convention.annotation.Namespace; 13 | import org.apache.struts2.convention.annotation.Result; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Controller; 16 | 17 | /** 18 | * 用户管理 19 | * Created by ant on 2015/8/28. 20 | */ 21 | @Controller 22 | @Namespace("/users") 23 | public class UserAction extends UActionSupport implements ModelDriven{ 24 | 25 | 26 | private int page; //当前请求的页码 27 | private int rows; //当前每页显示的行数 28 | 29 | private UUser user; 30 | 31 | private int currUserID; 32 | 33 | @Autowired 34 | private UUserManager userManager; 35 | 36 | //http://localhost:8080/users/showUsers 37 | //访问这个地址,会访问到WEB-INF/admin/users.jsp 38 | @Action(value = "showUsers", 39 | results = {@Result(name = "success", location = "/WEB-INF/admin/users.jsp")}) 40 | public String showUsers(){ 41 | 42 | return "success"; 43 | } 44 | 45 | //http://localhost:8080/users/getAllUsers 46 | @Action("getAllUsers") 47 | public void getAllUsers(){ 48 | try{ 49 | 50 | Page currPage = this.userManager.queryPage(page, rows); 51 | 52 | JSONObject json = new JSONObject(); 53 | json.put("total", currPage.getTotalCount()); 54 | JSONArray users = new JSONArray(); 55 | for(UUser m : currPage.getResultList()){ 56 | users.add(m.toJSON()); 57 | } 58 | json.put("rows", users); 59 | 60 | renderJson(json.toString()); 61 | 62 | }catch(Exception e){ 63 | e.printStackTrace(); 64 | } 65 | } 66 | 67 | //添加或者编辑 68 | //http://localhost:8080/users/saveUser 69 | @Action("saveUser") 70 | public void saveUser(){ 71 | try{ 72 | 73 | userManager.saveUser(this.user); 74 | renderState(true); 75 | 76 | return; 77 | 78 | }catch(Exception e){ 79 | e.printStackTrace(); 80 | } 81 | 82 | renderState(false); 83 | } 84 | 85 | //http://localhost:8080/users/removeUser 86 | @Action("removeUser") 87 | public void removeUser(){ 88 | try{ 89 | Log.d("Curr userID is " + this.currUserID); 90 | 91 | UUser user = userManager.getUser(this.currUserID); 92 | 93 | if(user == null){ 94 | renderState(false); 95 | return; 96 | } 97 | 98 | userManager.deleteUser(user); 99 | 100 | renderState(true); 101 | 102 | return; 103 | 104 | }catch(Exception e){ 105 | e.printStackTrace(); 106 | } 107 | 108 | renderState(false); 109 | } 110 | 111 | 112 | 113 | private void renderState(boolean suc){ 114 | JSONObject json = new JSONObject(); 115 | json.put("state", suc? 1 : 0); 116 | json.put("msg", suc? "操作成功" : "操作失败"); 117 | renderText(json.toString()); 118 | } 119 | 120 | 121 | @Override 122 | public UUser getModel() { 123 | if(this.user == null){ 124 | this.user = new UUser(); 125 | } 126 | return this.user; 127 | } 128 | 129 | public UUser getUser() { 130 | return user; 131 | } 132 | 133 | public void setUser(UUser user) { 134 | this.user = user; 135 | } 136 | 137 | public int getPage() { 138 | return page; 139 | } 140 | 141 | public void setPage(int page) { 142 | this.page = page; 143 | } 144 | 145 | public int getRows() { 146 | return rows; 147 | } 148 | 149 | public void setRows(int rows) { 150 | this.rows = rows; 151 | } 152 | 153 | public int getCurrUserID() { 154 | return currUserID; 155 | } 156 | 157 | public void setCurrUserID(int currUserID) { 158 | this.currUserID = currUserID; 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /src/jdbc.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/udb 3 | jdbc.username=dbuser 4 | jdbc.password=dbpassword 5 | hibernate.dialect=org.hibernate.dialect.MySQLDialect 6 | hibernate.show_sql=true 7 | hibernate.hbm2ddl.auto=update 8 | hibernate.current_session_context_class=thread -------------------------------------------------------------------------------- /src/log4j.properties: -------------------------------------------------------------------------------- 1 | # Output pattern : date [thread] priority category - message 2 | log4j.rootLogger=INFO, console, logFile 3 | 4 | #Console 5 | log4j.appender.console=org.apache.log4j.ConsoleAppender 6 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.console.layout.ConversionPattern=%d %p [%c] - <%m>%n 8 | 9 | #RollingFile 10 | log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender 11 | log4j.appender.logFile.File=../logs/test.log 12 | log4j.appender.logFile.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.logFile.layout.ConversionPattern=%d %p [%c] - <%m>%n 14 | 15 | #Project defalult level 16 | #log4j.logger.com.ssh.packserver=DEBUG -------------------------------------------------------------------------------- /src/struts.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | login,showLogin 25 | 26 | 27 | 28 | 29 | 30 | 31 | /WEB-INF/admin/login.jsp 32 | 33 | 34 | -------------------------------------------------------------------------------- /web/WEB-INF/admin/users.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: ant 4 | Date: 2015/8/22 5 | Time: 14:01 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | <% 10 | String path = request.getContextPath(); 11 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path; 12 | 13 | %> 14 | 15 | 16 | 17 | Users 18 | 19 | 20 | 21 | 用户协议 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /web/WEB-INF/urlrewrite.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | ^/(.*)/payCallback/([0-9]+) 15 | /$1/payCallback?u8ChannelID=$2 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | upackserver 8 | 9 | 11 | 12 | contextConfigLocation 13 | classpath:applicationContext*.xml 14 | 15 | 16 | 17 | 18 | 19 | encodingFilter 20 | org.springframework.web.filter.CharacterEncodingFilter 21 | 22 | encoding 23 | UTF-8 24 | 25 | 26 | forceEncoding 27 | true 28 | 29 | 30 | 31 | 32 | 33 | hibernateOpenSessionInViewFilter 34 | org.springframework.orm.hibernate3.support.OpenSessionInViewFilter 35 | 36 | 37 | 38 | UrlRewriteFilter 39 | org.tuckey.web.filters.urlrewrite.UrlRewriteFilter 40 | 41 | 42 | 43 | 44 | struts-prepare 45 | org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter 46 | 47 | 48 | 49 | struts2Filter 50 | org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter 51 | 52 | 53 | 54 | 55 | 56 | 57 | encodingFilter 58 | /* 59 | 60 | 61 | 62 | hibernateOpenSessionInViewFilter 63 | /* 64 | 65 | 66 | 67 | UrlRewriteFilter 68 | /* 69 | REQUEST 70 | FORWARD 71 | 72 | 73 | 74 | struts-prepare 75 | /* 76 | REQUEST 77 | FORWARD 78 | 79 | 80 | 81 | struts2Filter 82 | /* 83 | REQUEST 84 | FORWARD 85 | 86 | 87 | 88 | 89 | 90 | 91 | org.springframework.web.context.ContextLoaderListener 92 | 93 | 94 | 95 | 96 | org.springframework.web.util.IntrospectorCleanupListener 97 | 98 | 99 | 100 | 101 | 60 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: chenjie 4 | Date: 2014/12/9 5 | Time: 14:22 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | 13 | 14 | SSH Demo框架 15 | 16 | 17 | --------------------------------------------------------------------------------