[jira] [Commented] (CXF-7746) Swagger2Feature - SwaggerUiResolver & JBoss 7.0 EAP

2018-06-05 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16501741#comment-16501741
 ] 

ASF GitHub Bot commented on CXF-7746:
-

deki closed pull request #422: CXF-7746 Swagger2Feature - SwaggerUiResolver & 
JBoss 7.0 EAP
URL: https://github.com/apache/cxf/pull/422
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerUiResolver.java
 
b/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerUiResolver.java
index 331e9f35643..d6b306d6870 100644
--- 
a/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerUiResolver.java
+++ 
b/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/SwaggerUiResolver.java
@@ -58,19 +58,15 @@ public String findSwaggerUiRootInternal(String 
swaggerUiMavenGroupAndArtifact,
 
 protected static String checkUiRoot(String urlStr, String 
swaggerUiVersion) {
 int swaggerUiIndex = urlStr.lastIndexOf("/swagger-ui-");
-if (swaggerUiIndex != -1) {
-boolean urlEndsWithJarSep = urlStr.endsWith(".jar!/");
-if (urlEndsWithJarSep || urlStr.endsWith(".jar")) {
-int offset = urlEndsWithJarSep ? 6 : 4;
-String version = urlStr.substring(swaggerUiIndex + 12, 
urlStr.length() - offset);
-if (swaggerUiVersion != null && 
!swaggerUiVersion.equals(version)) {
-return null;
-}
-if (!urlEndsWithJarSep) {
-urlStr = "jar:" + urlStr + "!/";
-}
-return urlStr + UI_RESOURCES_ROOT_START + version + "/";
+if (swaggerUiIndex != -1 && urlStr.matches("^.*\\.jar!?/?$")) {
+String version = urlStr.substring(swaggerUiIndex + 12, 
urlStr.lastIndexOf(".jar"));
+if (swaggerUiVersion != null && !swaggerUiVersion.equals(version)) 
{
+return null;
+}
+if (!urlStr.endsWith("/")) {
+urlStr = "jar:" + urlStr + "!/";
 }
+return urlStr + UI_RESOURCES_ROOT_START + version + "/";
 }
 return null;
 }


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Swagger2Feature - SwaggerUiResolver & JBoss 7.0 EAP
> ---
>
> Key: CXF-7746
> URL: https://issues.apache.org/jira/browse/CXF-7746
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.2.4
>Reporter: Etienne Dumont
>Assignee: Dennis Kieselhorst
>Priority: Major
> Fix For: 3.2.5
>
>
> Hi,
> Same problem as CXF-7474, but for JBoss EAP 7.0 & CXF 3.2.4.
> The SwaggerUiResolver is not able to find the swagger-ui jar, included in our 
> war via maven; the path returned by the class loader ends with ".jar/" 
> instead of the expected ".jar" or ".jar!/".
> To bypass the problem, we modified the checkUiRoot as follow:
> {code:java}
> // Artifact: cxf-rt-rs-service-description-swagger
> // Class: org.apache.cxf.jaxrs.swagger.SwaggerUiResolver
> protected static String checkUiRoot(String urlStr, String swaggerUiVersion)
> {
>   int swaggerUiIndex = urlStr.lastIndexOf("/swagger-ui-");
>   if (swaggerUiIndex != -1)
>   {
> boolean urlEndsWithJarSep = urlStr.endsWith(".jar!/");
> int offset = -1;
> if (urlEndsWithJarSep || urlStr.endsWith(".jar"))
> {
>   offset = urlEndsWithJarSep ? 6 : 4;
> }
> else if (urlStr.endsWith(".jar/"))
> {
>   offset = 5;
>   urlEndsWithJarSep = true;
> }
> if (offset > -1)
> {
>   String version = urlStr.substring(swaggerUiIndex + 12, urlStr.length() 
> - offset);
>   if (swaggerUiVersion != null && !swaggerUiVersion.equals(version))
>   {
> return null;
>   }
>   else
>   {
> if (!urlEndsWithJarSep)
> {
>   urlStr = "jar:" + urlStr + "!/";
> }
> return urlStr + "META-INF/resources/webjars/swagger-ui/" + version + 
> "/";
>   }
> }
>   }
>   return null;
> }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7746) Swagger2Feature - SwaggerUiResolver & JBoss 7.0 EAP

2018-06-05 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16501649#comment-16501649
 ] 

ASF GitHub Bot commented on CXF-7746:
-

EDumdum opened a new pull request #422: CXF-7746 Swagger2Feature - 
SwaggerUiResolver & JBoss 7.0 EAP
URL: https://github.com/apache/cxf/pull/422
 
 
   Add support for JBoss 7.0 EAP class loader which is returning an url ending 
with ".jar/" instead of the expected ".jar" or ".jar!/"


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Swagger2Feature - SwaggerUiResolver & JBoss 7.0 EAP
> ---
>
> Key: CXF-7746
> URL: https://issues.apache.org/jira/browse/CXF-7746
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.2.4
>Reporter: Etienne Dumont
>Assignee: Dennis Kieselhorst
>Priority: Major
> Fix For: 3.2.5
>
>
> Hi,
> Same problem as CXF-7474, but for JBoss EAP 7.0 & CXF 3.2.4.
> The SwaggerUiResolver is not able to find the swagger-ui jar, included in our 
> war via maven; the path returned by the class loader ends with ".jar/" 
> instead of the expected ".jar" or ".jar!/".
> To bypass the problem, we modified the checkUiRoot as follow:
> {code:java}
> // Artifact: cxf-rt-rs-service-description-swagger
> // Class: org.apache.cxf.jaxrs.swagger.SwaggerUiResolver
> protected static String checkUiRoot(String urlStr, String swaggerUiVersion)
> {
>   int swaggerUiIndex = urlStr.lastIndexOf("/swagger-ui-");
>   if (swaggerUiIndex != -1)
>   {
> boolean urlEndsWithJarSep = urlStr.endsWith(".jar!/");
> int offset = -1;
> if (urlEndsWithJarSep || urlStr.endsWith(".jar"))
> {
>   offset = urlEndsWithJarSep ? 6 : 4;
> }
> else if (urlStr.endsWith(".jar/"))
> {
>   offset = 5;
>   urlEndsWithJarSep = true;
> }
> if (offset > -1)
> {
>   String version = urlStr.substring(swaggerUiIndex + 12, urlStr.length() 
> - offset);
>   if (swaggerUiVersion != null && !swaggerUiVersion.equals(version))
>   {
> return null;
>   }
>   else
>   {
> if (!urlEndsWithJarSep)
> {
>   urlStr = "jar:" + urlStr + "!/";
> }
> return urlStr + "META-INF/resources/webjars/swagger-ui/" + version + 
> "/";
>   }
> }
>   }
>   return null;
> }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)