xiaoymin / blog-comments

blog-comments
0 stars 0 forks source link

基于Spring Cloud Zuul方式 | swagger-bootstrap-ui #84

Open xiaoymin opened 5 years ago

xiaoymin commented 5 years ago

http://doc.xiaominfo.com/guide/ui-front-zuul.html

Vue 驱动的静态网站生成器

xiangyangsanren commented 5 years ago

我擦,还没文档啊……

xiaoymin commented 5 years ago

@xiangyangsanren 我擦,还没文档啊……

文档已更新,感谢关注!

lanlingyu commented 5 years ago

调试功能要怎么配置呀?

sfss5362 commented 5 years ago

Spring Cloud Zuul方式, 配置swagger.basic.password总是提示密码不对. 但是如果直接访问独立服务doc.html, 密码是正确的

Joy-zhuy commented 4 years ago

@zhuer0632 Spring Cloud Zuul方式, 配置swagger.basic.password总是提示密码不对. 但是如果直接访问独立服务doc.html, 密码是正确的

是啊,我也是这样。统一用basic,单独打开子服务输入密码可以。在zuul选择组输入密码一致弹框,返回:You do not have permission to access this resource

Joy-zhuy commented 4 years ago

@zhuer0632 Spring Cloud Zuul方式, 配置swagger.basic.password总是提示密码不对. 但是如果直接访问独立服务doc.html, 密码是正确的

找到问题了,是被zuul转发屏蔽了header的Authorization(zuul.sensitive-headers配置)

Joy-zhuy commented 4 years ago

zuul统一启用basic,个性化设置 - 启用SwaggerBootstrapUi提供的增强功能 ,会看不到接口(tag)。后台报错: 2019-12-05 18:43:07.780 ERROR 28048 --- [ XNIO-2 task-29] c.g.x.s.w.SwaggerBootstrapUiController : java.lang.NoClassDefFoundError:springfox/documentation/swagger/common/HostNameProvider 2019-12-05 18:43:07.780 DEBUG 28048 --- [ XNIO-2 task-29] c.s.f.e.RestExceptionResponseHandler : Resolving exception from handler [public org.springframework.http.ResponseEntity com.github.xiaoymin.swaggerbootstrapui.web.SwaggerBootstrapUiController.apiSorts(java.lang.String,javax.servlet.http.HttpServletRequest)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: springfox/documentation/swagger/common/SpringVersionCapability 2019-12-05 18:43:07.780 ERROR 28048 --- [ XNIO-2 task-29] c.s.f.e.RestExceptionResponseHandler : Acquiring Application for Exception [org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: springfox/documentation/swagger/common/SpringVersionCapability] resulted in an exception.

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: springfox/documentation/swagger/common/SpringVersionCapability at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:978) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at com.github.xiaoymin.swaggerbootstrapui.filter.SecurityBasicAuthFilter.doFilter(SecurityBasicAuthFilter.java:70) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at com.github.xiaoymin.swaggerbootstrapui.filter.ProductionSecurityFilter.doFilter(ProductionSecurityFilter.java:53) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:108) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:210) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:809) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: springfox/documentation/swagger/common/SpringVersionCapability at com.github.xiaoymin.swaggerbootstrapui.common.SwaggerBootstrapUiXForwardPrefixPathAdjuster.adjustedPath(SwaggerBootstrapUiXForwardPrefixPathAdjuster.java:37) at com.github.xiaoymin.swaggerbootstrapui.common.SwaggerBootstrapUiHostNameProvider.fromServletMapping(SwaggerBootstrapUiHostNameProvider.java:62) at com.github.xiaoymin.swaggerbootstrapui.common.SwaggerBootstrapUiHostNameProvider.componentsFrom(SwaggerBootstrapUiHostNameProvider.java:38) at com.github.xiaoymin.swaggerbootstrapui.web.SwaggerBootstrapUiController.apiSorts(SwaggerBootstrapUiController.java:142) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ... 57 common frames omitted

Jakgong commented 4 years ago

用zuul集成各微服务的swagger文档,各微服务设置了Authorzation的参数输入, 那有有没有什么方法可以只设置一次当前Authorzation的值,不用每个微服务设置呢, 全局变量除外

wangpeng849 commented 4 years ago

请问为什么swagger-ui.html是可以的,但是doc.html不显示接口

janepjing commented 4 years ago

您好,请问如何单独访问某个服务的文档? 通过service-doc可以访问各个service的文档(http://service-doc-ip:port/doc.html)。 但是想访问单独某个服务的文档(http://ip:网关port/applicationName/doc.html),结果返回了:We're sorry but knife4j-vue doesn't work properly without JavaScript enabled. Please enable it to continue.