53 Star 318 Fork 34

smartboot / smart-servlet

 / 详情

smart-servlet-spring-boot-starter 与springsecurity 不兼容

进行中
创建于  
2023-03-25 22:22

[INFO] [smart-socket:Thread-1] [HttpServletRequestImpl(getUserPrincipal:223)]unSupport getUserPrincipal
org.smartboot.servlet.exception.WrappedRuntimeException: java.lang.UnsupportedOperationException
at org.smartboot.servlet.ContainerRuntime.doHandle(ContainerRuntime.java:255)
at org.smartboot.springboot.starter.SmartServletServer$2.handle(SmartServletServer.java:46)
at org.smartboot.springboot.starter.SmartServletServer$2.handle(SmartServletServer.java:43)
at org.smartboot.http.server.ServerHandler.handle(ServerHandler.java:38)
at org.smartboot.http.server.impl.HttpMessageProcessor.handleHttpRequest(HttpMessageProcessor.java:109)
at org.smartboot.http.server.impl.HttpMessageProcessor.process0(HttpMessageProcessor.java:68)
at org.smartboot.http.server.impl.HttpMessageProcessor.process0(HttpMessageProcessor.java:39)
at org.smartboot.socket.extension.processor.AbstractMessageProcessor.process(AbstractMessageProcessor.java:79)
at org.smartboot.socket.transport.TcpAioSession.signalRead(TcpAioSession.java:320)
at org.smartboot.socket.transport.TcpAioSession.readCompleted(TcpAioSession.java:293)
at org.smartboot.socket.transport.TcpAioSession$1.completed(TcpAioSession.java:65)
at org.smartboot.socket.transport.TcpAioSession$1.completed(TcpAioSession.java:61)
at org.smartboot.socket.enhance.EnhanceAsynchronousSocketChannel.doRead(EnhanceAsynchronousSocketChannel.java:356)
at org.smartboot.socket.enhance.EnhanceAsynchronousChannelGroup.lambda$new$0(EnhanceAsynchronousChannelGroup.java:76)
at org.smartboot.socket.enhance.EnhanceAsynchronousChannelGroup$Worker.run(EnhanceAsynchronousChannelGroup.java:219)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.UnsupportedOperationException
at org.smartboot.servlet.impl.HttpServletRequestImpl.isSecure(HttpServletRequestImpl.java:583)
at javax.servlet.ServletRequestWrapper.isSecure(ServletRequestWrapper.java:296)
at org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher.matches(HstsHeaderWriter.java:244)
at org.springframework.security.web.header.writers.HstsHeaderWriter.writeHeaders(HstsHeaderWriter.java:150)
at org.springframework.security.web.header.HeaderWriterFilter.writeHeaders(HeaderWriterFilter.java:99)
at org.springframework.security.web.header.HeaderWriterFilter$HeaderWriterResponse.writeHeaders(HeaderWriterFilter.java:132)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:93)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:112)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:221)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:186)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
at org.smartboot.servlet.handler.FilterMatchHandler$FilterChainImpl.doFilter(FilterMatchHandler.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.smartboot.servlet.handler.FilterMatchHandler$FilterChainImpl.doFilter(FilterMatchHandler.java:162)
at org.smartboot.servlet.handler.FilterMatchHandler.handleRequest(FilterMatchHandler.java:71)
at org.smartboot.servlet.handler.Handler.doNext(Handler.java:42)
at org.smartboot.servlet.handler.ServletMatchHandler.handleRequest(ServletMatchHandler.java:100)
at org.smartboot.servlet.handler.Handler.doNext(Handler.java:42)
at org.smartboot.servlet.handler.ServletRequestListenerHandler.handleRequest(ServletRequestListenerHandler.java:38)
at org.smartboot.servlet.handler.HandlerPipeline.handleRequest(HandlerPipeline.java:45)
at org.smartboot.servlet.ContainerRuntime.doHandle(ContainerRuntime.java:251)
... 17 more

评论 (7)

heshujing 创建了任务
heshujing 修改了描述
三刀 任务状态待办的 修改为进行中
展开全部操作日志

从日志来看应该是图中的接口规范未实现所致。
输入图片说明

试一下快照包:0.2.1-SNAPSHOT

快照包仓库哪里拉?

<repository>
    <id>sonatype-nexus-snapshots</id>
    <name>Sonatype Nexus Snapshots</name>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

输入图片说明
输入图片说明
输入图片说明
输入图片说明
输入图片说明
最后这个写的时候,直接就来了一个抛异常,兄弟,是不是手抖写错了呀, :joy:

大概知道问题了,response.getOutputStream().write(new String(msg).getBytes(StandardCharsets.UTF_8));
中文编码,没有处理。默认是iso-8859-1,测试一下看看是不是这样
输入图片说明

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
351975 smartdms 1578921064
Java
1
https://gitee.com/smartboot/smart-servlet.git
git@gitee.com:smartboot/smart-servlet.git
smartboot
smart-servlet
smart-servlet

搜索帮助