17 changed files with 610 additions and 1 deletions
@ -1,3 +1,4 @@ |
|||||||
# demo-controller-register |
# demo-controller-register |
||||||
|
|
||||||
spring的controller在插件中引入的demo |
spring的controller在插件中引入的demo\ |
||||||
|
AnnotationServer中注释部分的代码因为接口本身还有些缺陷,暂时无法使用 |
@ -0,0 +1,124 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
|
||||||
|
[compileJava,compileTestJava]*.options*.encoding = 'UTF-8' |
||||||
|
|
||||||
|
ext { |
||||||
|
/** |
||||||
|
* 项目中依赖的jar的路径 |
||||||
|
* 1.如果依赖的jar需要打包到zip中,放置在lib根目录下 |
||||||
|
* 2.如果依赖的jar仅仅是编译时需要,防止在lib下子目录下即可 |
||||||
|
*/ |
||||||
|
libPath = "$projectDir/../webroot/WEB-INF/lib" |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否对插件的class进行加密保护,防止反编译 |
||||||
|
*/ |
||||||
|
guard = false |
||||||
|
|
||||||
|
def pluginInfo = getPluginInfo() |
||||||
|
pluginPre = "fine-plugin" |
||||||
|
pluginName = pluginInfo.id |
||||||
|
pluginVersion = pluginInfo.version |
||||||
|
|
||||||
|
outputPath = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/classes" |
||||||
|
} |
||||||
|
|
||||||
|
group = 'com.fr.plugin' |
||||||
|
version = '10.0' |
||||||
|
sourceCompatibility = '8' |
||||||
|
|
||||||
|
sourceSets { |
||||||
|
main { |
||||||
|
java.outputDir = file(outputPath) |
||||||
|
output.resourcesDir = file(outputPath) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
ant.importBuild("encrypt.xml") |
||||||
|
//定义ant变量 |
||||||
|
ant.projectDir = projectDir |
||||||
|
ant.references["compile.classpath"] = ant.path { |
||||||
|
fileset(dir: libPath, includes: '**/*.jar') |
||||||
|
fileset(dir: ".",includes:"**/*.jar" ) |
||||||
|
} |
||||||
|
|
||||||
|
classes.dependsOn('clean') |
||||||
|
|
||||||
|
task copyFiles(type: Copy,dependsOn: 'classes'){ |
||||||
|
from outputPath |
||||||
|
into "$projectDir/classes" |
||||||
|
} |
||||||
|
|
||||||
|
task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ |
||||||
|
from "$projectDir/classes" |
||||||
|
into "$projectDir/transform-classes" |
||||||
|
include "**/*.*" |
||||||
|
} |
||||||
|
jar.dependsOn("preJar") |
||||||
|
|
||||||
|
task makeJar(type: Jar,dependsOn: preJar){ |
||||||
|
from fileTree(dir: "$projectDir/transform-classes") |
||||||
|
baseName pluginPre |
||||||
|
appendix pluginName |
||||||
|
version pluginVersion |
||||||
|
destinationDir = file("$buildDir/libs") |
||||||
|
|
||||||
|
doLast(){ |
||||||
|
delete file("$projectDir/classes") |
||||||
|
delete file("$projectDir/transform-classes") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
task copyFile(type: Copy,dependsOn: ["makeJar"]){ |
||||||
|
from "$buildDir/libs" |
||||||
|
from("$projectDir/lib") { |
||||||
|
include "*.jar" |
||||||
|
} |
||||||
|
from "$projectDir/plugin.xml" |
||||||
|
into file("$buildDir/temp/plugin") |
||||||
|
} |
||||||
|
|
||||||
|
task zip(type:Zip,dependsOn:["copyFile"]){ |
||||||
|
from "$buildDir/temp/plugin" |
||||||
|
destinationDir file("$buildDir/install") |
||||||
|
baseName pluginPre |
||||||
|
appendix pluginName |
||||||
|
version pluginVersion |
||||||
|
} |
||||||
|
|
||||||
|
//控制build时包含哪些文件,排除哪些文件 |
||||||
|
processResources { |
||||||
|
// exclude everything |
||||||
|
// 用*.css没效果 |
||||||
|
// exclude '**/*.css' |
||||||
|
// except this file |
||||||
|
// include 'xx.xml' |
||||||
|
} |
||||||
|
|
||||||
|
/*读取plugin.xml中的version*/ |
||||||
|
def getPluginInfo(){ |
||||||
|
def xmlFile = file("plugin.xml") |
||||||
|
if (!xmlFile.exists()) { |
||||||
|
return ["id":"none", "version":"1.0.0"] |
||||||
|
} |
||||||
|
def plugin = new XmlParser().parse(xmlFile) |
||||||
|
def version = plugin.version[0].text() |
||||||
|
def id = plugin.id[0].text() |
||||||
|
return ["id":id,"version":version] |
||||||
|
} |
||||||
|
|
||||||
|
repositories { |
||||||
|
mavenLocal() |
||||||
|
maven { |
||||||
|
url = uri('http://mvn.finedevelop.com/repository/maven-public/') |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
//使用本地jar |
||||||
|
implementation fileTree(dir: 'lib', include: ['**/*.jar']) |
||||||
|
implementation fileTree(dir: libPath, include: ['**/*.jar']) |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||||
|
<project> |
||||||
|
<target name="compile_encrypt_javas" depends="copyFiles"> |
||||||
|
<echo message="加密文件"/> |
||||||
|
<echo message="${projectDir}"/> |
||||||
|
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask"> |
||||||
|
<classpath refid="compile.classpath"/> |
||||||
|
</taskdef> |
||||||
|
<pretreatment baseDir="${projectDir}"/> |
||||||
|
</target> |
||||||
|
<target name="compile_plain_javas" depends="copyFiles"> |
||||||
|
</target> |
||||||
|
</project> |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,16 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin> |
||||||
|
<id>com.tptj.demo.hg.controller.register.v10</id> |
||||||
|
<name><![CDATA[ spring controller demo ]]></name> |
||||||
|
<active>yes</active> |
||||||
|
<version>1.0</version> |
||||||
|
<env-version>10.0</env-version> |
||||||
|
<vendor>tptj</vendor> |
||||||
|
<jartime>2019-07-18</jartime> |
||||||
|
<description><![CDATA[ ]]></description> |
||||||
|
<change-notes><![CDATA[]]></change-notes> |
||||||
|
<main-package>com.tptj.demo.hg.controller.register</main-package> |
||||||
|
<function-recorder class="com.tptj.demo.hg.controller.register.Demo"/> |
||||||
|
<extra-decision> |
||||||
|
<ControllerRegisterProvider class="com.tptj.demo.hg.controller.register.Demo"/> |
||||||
|
</extra-decision> |
||||||
|
</plugin> |
@ -0,0 +1,139 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
import com.fanruan.api.decision.AuthorityKit; |
||||||
|
import com.fr.decision.webservice.Response; |
||||||
|
import com.fr.decision.webservice.annotation.*; |
||||||
|
import com.fr.decision.webservice.bean.entry.TemplateBean; |
||||||
|
import com.fr.decision.webservice.bean.template.TemplateProductType; |
||||||
|
import com.fr.license.function.VT4FR; |
||||||
|
import com.fr.third.springframework.stereotype.Controller; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-22 |
||||||
|
* 这个demo专门用来讲解FR特有的服务接口注解的用法和含义 |
||||||
|
**/ |
||||||
|
@Controller |
||||||
|
@RequestMapping(value = "/annotation/info") |
||||||
|
@LoginStatusChecker(required = false) |
||||||
|
public class AnnotationServer { |
||||||
|
|
||||||
|
@VisitRefer(refer= AuthorityKit.Management.USER) |
||||||
|
@LoginStatusChecker |
||||||
|
@RequestMapping(value = "/visit/refer",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
public String visitRefer( @PathVariable("username") String username )throws Exception{ |
||||||
|
return "@VisitRefer注解根据模块权限进行切面鉴权。没有用户管理权限的用户是看不到这个信息的"; |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/fine/path/variable/{val}/{tp}",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
public Response finePathVariable(@FinePathVariable("val") String val, |
||||||
|
@PathVariable("tp") String tp){ |
||||||
|
//http://localhost:8075/webroot/decision/annotation/info/fine/path/variable/124%E4%B7%84%E4%B7%85ESD/124ASD
|
||||||
|
Map<String,String> data = new HashMap<String,String>(); |
||||||
|
data.put("val",val); |
||||||
|
data.put("tp",tp); |
||||||
|
data.put("doc","@FinePathVariable注解用于解析URI中符合FR特殊转义规则(EncodeDictionary中定义)的字符"); |
||||||
|
data.put("/","\u4DC0\u4DC1"); |
||||||
|
data.put(".","\u4DC2\u4DC3"); |
||||||
|
data.put("\\\\","\u4DC4\u4DC5"); |
||||||
|
data.put(" ","\u4DC6\u4DC7"); |
||||||
|
return Response.ok(data); |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/lock",method = RequestMethod.GET) |
||||||
|
@Lock(Config.class) |
||||||
|
@ResponseBody |
||||||
|
public String lock(){ |
||||||
|
return "@Lock注解用于并发修改配置时保证数据的一致性。"; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/template/auth",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@LoginStatusChecker |
||||||
|
@TemplateAuth(product= TemplateProductType.FINE_REPORT) |
||||||
|
public String templateAuth(){ |
||||||
|
return "@TemplateAuth注解用于控制模板权类型是报表还是BI还是平台的一个标识,插件里面一般用不到"; |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/function/support",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@FunctionSupport(function={VT4FR.RemoteDesign}) |
||||||
|
public String functionSupport(){ |
||||||
|
return "@FunctionSupport注解用于根据产品授权文件对请求进行授权访问,插件里面用不到"; |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/decision/service/log",method = RequestMethod.GET) |
||||||
|
@DecisionServiceLog(resource="AnnotationServer[/annotation/info/decision/service/log]",detail="DecisionServiceLog注解demo") |
||||||
|
@ResponseBody |
||||||
|
public String decisionServiceLog(){ |
||||||
|
return "@DecisionServiceLog本意是通过注解配合切面进行web服务的埋点。但是目前实际上这个切面功能并未实现"; |
||||||
|
} |
||||||
|
|
||||||
|
// @RequestMapping(value = "/decision/service/log",method = RequestMethod.GET)
|
||||||
|
// @DecisionCacheRefresh(cacheClass=DemoCache.class)
|
||||||
|
// @ResponseBody
|
||||||
|
// public String decisionCacheRefresh(){
|
||||||
|
// return "访问方法加上@DecisionCacheRefresh注解之后,将被切面拦截,刷新对应的缓存项";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping(value = "/device/binding",method = RequestMethod.GET)
|
||||||
|
// @ResponseBody
|
||||||
|
// @LoginStatusChecker
|
||||||
|
// @DeviceBinding(autoBindFirstDevice=true)
|
||||||
|
// public String deviceBinding(){
|
||||||
|
// return "@DeviceBinding注解用于移动端请求且产品开启了移动端设备绑定功能的前提下,如果请求接口申明了这个注解且auto_bind值为true" +
|
||||||
|
// "则设备首次访问这个接口时会自动绑定移动端(绑定是指用户和设备绑定),插件里面目前用不到" ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// @RequestMapping(value = "/dcs/user/checker",method = RequestMethod.POST)
|
||||||
|
// @DecisionUserChecker(targetIndex = {1})
|
||||||
|
// @ResponseBody
|
||||||
|
// @LoginStatusChecker
|
||||||
|
// public String decisionUserChecker( @RequestBody UserBean userBean ){
|
||||||
|
// return "@DecisionUserChecker注解用于帆软平台用户(RoleCheckerType.USER)/部门/角色管理权限鉴权的切面控制。" +
|
||||||
|
// "通过对服务方法的入参下标申明," +
|
||||||
|
// "指定入参中需要确认权限的实体对象(该实体必须继承于RoleChecker,产品内部目前只有用户相关的bean)具体可以参照UserResource。" +
|
||||||
|
// "插件中需要对帆软的用户进行管理权限判断时会用到,当然也可以定义";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping(value = "/decision/entry/checker",method = RequestMethod.GET)
|
||||||
|
// @DecisionEntryChecker(targetIndex = 1)
|
||||||
|
// @ResponseBody
|
||||||
|
// @LoginStatusChecker
|
||||||
|
// public String decisionEntryChecker( @PathVariable("directoryId") String directoryId ){
|
||||||
|
// return "@DecisionEntryChecker注解用于平台鉴权功能中的每一种权限实体(用户编辑权限、用户授权权限、报表查看权限、" +
|
||||||
|
// "报表编辑权限、报表授权权限等等 AuthorityStaticItemId.(VIEW/EDIT/AUTHORIZE)_AUTHORITY_TYPE)的用户鉴权" +
|
||||||
|
// "通过对服务方法的入参下标申明," +
|
||||||
|
// "指定入参中需要确认权限的实体对象(该权限实体是登记在权限实体表中的一个ID)具体可以参照TemplateResource。" +
|
||||||
|
// "插件中需要对帆软报表访问功能鉴权时会用到,实际需要使用的场景不多";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping(value = "/decision/controller/log",method = RequestMethod.GET)
|
||||||
|
// @ResponseBody
|
||||||
|
// @DecisionControllerLog
|
||||||
|
// public String decisionControllerLog(){
|
||||||
|
// return "@DecisionControllerLog注解作用于resource层方法上,用于平台管理日志埋点记录切面处理。插件中谨慎使用!";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @RequestMapping(value = "/dcs/cfg/checker/{version}",method = RequestMethod.POST)
|
||||||
|
// @ResponseBody
|
||||||
|
// @DecisionConfigChecker
|
||||||
|
// @LoginStatusChecker
|
||||||
|
// public String decisionConfigChecker(HttpServletRequest req, HttpServletResponse res,
|
||||||
|
// @PathVariable("version") String version){
|
||||||
|
// return "@DecisionConfigChecker,配置项检查注解,作用于resource层方法上。加上该注解的方法,只有管理员有权限访问";
|
||||||
|
// }
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
import com.fr.config.Configuration; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-23 |
||||||
|
**/ |
||||||
|
public class Config extends Configuration { |
||||||
|
@Override |
||||||
|
public String getNameSpace() { |
||||||
|
return "Config"; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-22 |
||||||
|
**/ |
||||||
|
public class DataBean { |
||||||
|
private String key; |
||||||
|
private int val; |
||||||
|
private boolean enable; |
||||||
|
private Date time; |
||||||
|
private List<SubBean> list; |
||||||
|
private Map<String,Object> data; |
||||||
|
|
||||||
|
public String getKey() { |
||||||
|
return key; |
||||||
|
} |
||||||
|
|
||||||
|
public void setKey(String key) { |
||||||
|
this.key = key; |
||||||
|
} |
||||||
|
|
||||||
|
public int getVal() { |
||||||
|
return val; |
||||||
|
} |
||||||
|
|
||||||
|
public void setVal(int val) { |
||||||
|
this.val = val; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isEnable() { |
||||||
|
return enable; |
||||||
|
} |
||||||
|
|
||||||
|
public void setEnable(boolean enable) { |
||||||
|
this.enable = enable; |
||||||
|
} |
||||||
|
|
||||||
|
public Date getTime() { |
||||||
|
return time; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTime(Date time) { |
||||||
|
this.time = time; |
||||||
|
} |
||||||
|
|
||||||
|
public List<SubBean> getList() { |
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
public void setList(List<SubBean> list) { |
||||||
|
this.list = list; |
||||||
|
} |
||||||
|
|
||||||
|
public Map<String, Object> getData() { |
||||||
|
return data; |
||||||
|
} |
||||||
|
|
||||||
|
public void setData(Map<String, Object> data) { |
||||||
|
this.data = data; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
import com.fr.decision.fun.impl.AbstractControllerRegisterProvider; |
||||||
|
import com.fr.intelli.record.Focus; |
||||||
|
import com.fr.record.analyzer.EnableMetrics; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-22 |
||||||
|
**/ |
||||||
|
@EnableMetrics |
||||||
|
public class Demo extends AbstractControllerRegisterProvider { |
||||||
|
@Override |
||||||
|
@Focus(id = "com.tptj.demo.hg.controller.register.v10",text = "spring controller demo") |
||||||
|
public Class<?>[] getControllers() { |
||||||
|
//同名情况下,后注册的会把先注册的抵消掉
|
||||||
|
return new Class[]{ |
||||||
|
HelloWorld.class, |
||||||
|
SimpleServer.class, |
||||||
|
AnnotationServer.class, |
||||||
|
com.tptj.demo.hg.controller.register.pkg1.Server.class, |
||||||
|
com.tptj.demo.hg.controller.register.pkg2.Server.class |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
import com.fanruan.api.log.LogKit; |
||||||
|
import com.fr.decision.cache.DecisionLoadingCache; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-24 |
||||||
|
**/ |
||||||
|
public class DemoCache implements DecisionLoadingCache { |
||||||
|
@Override |
||||||
|
public String getKey() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object get(Object o) throws Exception { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void refresh() { |
||||||
|
LogKit.info("DemoCache Refresh!"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
||||||
|
import com.fr.third.springframework.stereotype.Controller; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-24 |
||||||
|
**/ |
||||||
|
@Controller |
||||||
|
@LoginStatusChecker(required = false) |
||||||
|
public class HelloWorld { |
||||||
|
|
||||||
|
@RequestMapping(value = "/hello/world") |
||||||
|
@ResponseBody |
||||||
|
public String hello()throws Exception{ |
||||||
|
return "Hello World"; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,80 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
import com.fanruan.api.net.NetworkKit; |
||||||
|
import com.fr.decision.webservice.Response; |
||||||
|
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
||||||
|
import com.fr.decision.webservice.utils.WebServiceUtils; |
||||||
|
import com.fr.third.springframework.http.MediaType; |
||||||
|
import com.fr.third.springframework.stereotype.Controller; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-22 |
||||||
|
* 这个demo用于讲解spring Controller 的常见写法 |
||||||
|
**/ |
||||||
|
@Controller |
||||||
|
/** |
||||||
|
* http(s):ip:port/webroot/decision/usr/info/Anna |
||||||
|
*/ |
||||||
|
@RequestMapping(value = "/usr/info/{username}") |
||||||
|
/** |
||||||
|
* 不需要校验登录状态, |
||||||
|
*/ |
||||||
|
@LoginStatusChecker(required = false) |
||||||
|
public class SimpleServer { |
||||||
|
|
||||||
|
@RequestMapping(value = "/simple", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) |
||||||
|
@ResponseBody |
||||||
|
public String page( @PathVariable("username") String username ) throws Exception { |
||||||
|
Map<String, Object> param = new HashMap<String, Object>(1); |
||||||
|
param.put("username",username); |
||||||
|
return WebServiceUtils.parseWebPageResourceSafe( |
||||||
|
"/com/tptj/demo/hg/controller/register/hello.html", param); |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/base", method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@LoginStatusChecker |
||||||
|
public Response getInfo( @RequestParam(value = "key", defaultValue = "hello") String key ) throws Exception { |
||||||
|
DataBean data = new DataBean(); |
||||||
|
data.setKey(key); |
||||||
|
data.setVal(123); |
||||||
|
data.setTime(new Date()); |
||||||
|
data.setEnable(true); |
||||||
|
List<SubBean> list = new ArrayList<SubBean>(2); |
||||||
|
list.add(new SubBean().key("A")); |
||||||
|
list.add(new SubBean().key("B")); |
||||||
|
data.setList(list); |
||||||
|
Map<String, Object> map = new HashMap<String, Object>(2); |
||||||
|
map.put("A","1"); |
||||||
|
map.put("B","2"); |
||||||
|
data.setData(map); |
||||||
|
return Response.ok(data); |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/base", method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
public Response setInfo( @RequestBody DataBean bean ) throws Exception { |
||||||
|
return Response.ok(bean); |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/redirect", method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
public Response redirect( HttpServletRequest request, HttpServletResponse response ) throws Exception{ |
||||||
|
String key = NetworkKit.getHTTPRequestParameter(request,"key"); |
||||||
|
response.sendRedirect("http://localhost:8075/webroot/decision?key="+key); |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/redirect2", method = RequestMethod.GET) |
||||||
|
public void redirect2( HttpServletRequest request, HttpServletResponse response ) throws Exception{ |
||||||
|
String key = NetworkKit.getHTTPRequestParameter(request,"key"); |
||||||
|
response.sendRedirect("http://localhost:8075/webroot/decision?key="+key); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-22 |
||||||
|
**/ |
||||||
|
public class SubBean { |
||||||
|
private String key; |
||||||
|
|
||||||
|
public String getKey() { |
||||||
|
return key; |
||||||
|
} |
||||||
|
|
||||||
|
public void setKey(String key) { |
||||||
|
this.key = key; |
||||||
|
} |
||||||
|
|
||||||
|
public SubBean key(String key) { |
||||||
|
this.key = key; |
||||||
|
return this; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register.pkg1; |
||||||
|
|
||||||
|
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
||||||
|
import com.fr.third.springframework.stereotype.Controller; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-22 |
||||||
|
**/ |
||||||
|
@Controller("Server1") |
||||||
|
@LoginStatusChecker(required = false) |
||||||
|
@RequestMapping(value = "/sv1") |
||||||
|
public class Server { |
||||||
|
|
||||||
|
@RequestMapping(value = "/value", method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
public String call(){ |
||||||
|
return "Server1 Is Running!"; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.tptj.demo.hg.controller.register.pkg2; |
||||||
|
|
||||||
|
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
||||||
|
import com.fr.third.springframework.stereotype.Controller; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import com.fr.third.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-03-22 |
||||||
|
**/ |
||||||
|
@Controller("Server2") |
||||||
|
@LoginStatusChecker(required = false) |
||||||
|
@RequestMapping(value = "/sv2") |
||||||
|
public class Server { |
||||||
|
@RequestMapping(value = "/value", method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
public String call(){ |
||||||
|
return "Server2 Is Running!"; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue