Restful风格请求报错 Missing or invalid X-AUTH-TOKEN header
@Api(value="TbSbtz",description="设备台帐",tags="tbSbtzController")@Controller
@RequestMapping("/tbSbtzController")
public class TbSbtzController extends BaseController {//此类中有下面的根据id获得编号的方法:
@RequestMapping(value = "getZcbhBySbtzId2/{id}", method = RequestMethod.GET)
@ResponseBody
public String getZcbhBySbtzId2(@PathVariable("id") String id){
StringBuffer sb = new StringBuffer();
try{
if(StringUtils.isNotEmpty(id)) {
TbSbtzEntity tbSbtz = tbSbtzService.get(TbSbtzEntity.class, id);
sb.append(tbSbtz.getZcbh());
}
}catch(Exception e){
e.printStackTrace();
}
return sb.toString();
}
jeecg3.7.2版本登陆系统后用下面restful风格url请求访问
http://192.168.1.79:8080/sdaf/rest/tbSbtzController/getZcbhBySbtzId2/2cb2489466579799016660e129850044
报错信息如下:
javax.servlet.ServletException: Missing or invalid X-AUTH-TOKEN header.
at org.jeecgframework.jwt.aop.RestAuthTokenInterceptor.preHandle(RestAuthTokenInterceptor.java:49)
at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:134)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:932)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:111)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
看常见问题贴 admin 发表于 2018-10-17 12:11 static/image/common/back.gif
看常见问题贴
常见问题贴中 第41条: jeecg restful请求如何访问?
只说 control的请求需要加上“rest/”前缀,我请求路径中加了这个前缀依然报上述错误,不知何故? admin 发表于 2018-10-17 12:11 static/image/common/back.gif
看常见问题贴
还请帮解决为盼呐!!! http://jeecg3.mydoc.io/
看: 专项功能介绍-- 平台JWT接口文档
页:
[1]