[
https://issues.apache.org/jira/browse/CXF-9155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18014760#comment-18014760
]
Zhiying Yan edited comment on CXF-9155 at 8/19/25 12:56 AM:
------------------------------------------------------------
Hi [~ffang],
Thanks very much for checking the ticket.
>What does you exactly mean by "swagger-ui as /services"?
!server-in-swagger-ui.png!
If I add annotation( @Server(url = "/services") in my service, it works. but
for some reason, I could not use this way. so I tried to use java code as
following, but it does not work at all.
{code:java}
OpenApiCustomizer customizer = new OpenApiCustomizer();
OpenAPI openAPI = new OpenAPI();
openAPI.setServers(List.of(
new Server().url("/services").description("Production
server")));
customizer.customize(openAPI);
openApiFeature.setCustomizer(customizer);
{code}
All code is in the attachment project. [^cxf-openapifeature-test.zip]
was (Author: jill):
Hi [~ffang],
Thanks very much for checking the ticket.
>What does you exactly mean by "swagger-ui as /services"?
!server-in-swagger-ui.png!
If I add annotation( @Server(url = "/services") in my service, it works. but
for some reason, I could not use this way. so I tried to use java code as
following, but it does not work at all.
{code:java}
OpenApiCustomizer customizer = new OpenApiCustomizer();
OpenAPI openAPI = new OpenAPI();
openAPI.setServers(List.of(
new Server().url("/services").description("Production
server")));
customizer.customize(openAPI);
openApiFeature.setCustomizer(customizer);
{code}
> OpenApiFeature can not set Server or SwaggerUiConfig.url
> --------------------------------------------------------
>
> Key: CXF-9155
> URL: https://issues.apache.org/jira/browse/CXF-9155
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 4.1.0
> Reporter: Zhiying Yan
> Assignee: Freeman Yue Fang
> Priority: Minor
> Attachments: cxf-openapifeature-test.zip, server-in-swagger-ui.png
>
>
> I have _JAXRSServerFactoryBean_ and
> _setAddress("http://0.0.0.0:8080/services");_
> I'd like to customize the execute server in swagger-ui as _/services_, but
> this is not working as expected.
> Also the following section does not work.
> {code:java}
> openApiFeature.setSwaggerUiConfig(new
> org.apache.cxf.jaxrs.swagger.ui.SwaggerUiConfig()
>
> .url("/api/hello/api-docs?url=/services/api/hello/openapi.json"));
> {code}
> Please help to check!
> Thanks!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)