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

ASF GitHub Bot commented on CXF-7734:
-------------------------------------

deki closed pull request #416: CXF-7734 Fix media type for the root page
URL: https://github.com/apache/cxf/pull/416
 
 
   

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/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
 
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
index 7ea8d4c2220..e786c919c01 100644
--- 
a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
+++ 
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
@@ -620,6 +620,7 @@ public Response getResource(@Context UriInfo uriInfo, 
@PathParam("resource") Str
             
             try {
                 URL resourceURL = locator.locate(resourcePath);
+                resourcePath = resourceURL.getPath();
                 
                 String mediaType = null;
                 int ind = resourcePath.lastIndexOf('.');


 

----------------------------------------------------------------
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:
[email protected]


> Swagger2Feature - application/octet-stream media type is returned for 
> index.html
> --------------------------------------------------------------------------------
>
>                 Key: CXF-7734
>                 URL: https://issues.apache.org/jira/browse/CXF-7734
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.15
>            Reporter: Yury Molchan
>            Assignee: Dennis Kieselhorst
>            Priority: Major
>             Fix For: 3.1.16
>
>
> Reproduced after CXF-7581.
> org.apache.cxf.jaxrs.swagger.Swagger2Feature.SwaggerUIService#getResource 
> does not set media type for the root resource ("" or "/" paths)
> So, *application/octet-stream* type is set by default instead of *text/html*
> Steps to reproduce (See [Swagger2Feature - Automatic UI 
> Activation|http://cxf.apache.org/docs/swaggerfeature-swagger2feature.html#SwaggerFeature/Swagger2Feature-AutomaticUIActivation]):
>  * Setup Swagger2Feature
>  * Open swagger-ui in a browser _$base_rest_url/api-docs?url=swagger.json_
> Actual: The file is downloading
> Expected: The index.html page is displayed
> Pull request: https://github.com/apache/cxf/pull/416



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

Reply via email to