[jira] [Commented] (CXF-8116) Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF Project

2019-09-18 Thread Marco Tenti (Jira)


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

Marco Tenti commented on CXF-8116:
--

Wow it's finally work.
ty very much Andriy your workaround work just fine.

Can i ask if there is a way to disable the generation of the "default" 
operation on the Swagger2Feature?  

> Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF 
> Project
> ---
>
> Key: CXF-8116
> URL: https://issues.apache.org/jira/browse/CXF-8116
> Project: CXF
>  Issue Type: Bug
>  Components: Bus, Documentation, JAX-RS, OSGi
>Affects Versions: 3.2.7
>Reporter: Marco Tenti
>Priority: Major
>
> Hi, i really need a full example for integrate the webjars "swaggerui" on 
> OSGI Camel CXF Project.
> I followed the documentation and add the webjars swagger-ui on compile mode 
> on my pom.xml 
> I don't know why but my "Swagger2Feature" generate only the swagger.json 
> endpoint and never load the SwaggerUi page.
> Here the blueprint.xml configuration i'm try to use:
> {code:xml}
>   address="${https.serviceHost}:${https.servicePort}/cxf/my/rest"
> id="rsServerTestServiceEndpointSSL"
> loggingFeatureEnabled="true" loggingSizeLimit="20"
> serviceClass="bug.test.endpoint.TestEndpoint" 
> staticSubresourceResolution="true">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> 
> 
>
>  class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
>  value="${https.serviceHost}:${https.servicePort}"/>
>  value="${https.serviceHost}:${https.servicePort}/cxf/my/rest"/>
> 
> 
> 
>  
> 
> 
> {code}
> i even get this exception , but i don't know how resolve:
> {code}
> org.apache.cxf.interceptor.Fault: Direct self-reference leading to cycle 
> (through reference chain: 
> org.apache.cxf.message.MessageContentsList[1]->org.apache.cxf.jaxrs.swagger.SyntheticServletConfig["servletContext"]->io.undertow.servlet.spec.ServletContextImpl["deployment"]->io.undertow.servlet.core.DeploymentImpl["deploymentInfo"]->io.undertow.servlet.api.DeploymentInfo["classLoader"]->org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader["bundle"]->org.apache.felix.framework.BundleImpl["bundle"])
>  while invoking public javax.ws.rs.core.Response 
> io.swagger.jaxrs.listing.ApiListingResource.getListing(javax.ws.rs.core.Application,javax.servlet.ServletConfig,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo,java.lang.String)
>  with params 
> [org.apache.cxf.jaxrs.swagger.Swagger2Feature$DefaultApplication@7fc8f668, 
> org.apache.cxf.jaxrs.swagger.SyntheticServletConfig@470a7e15, 
> org.apache.cxf.jaxrs.impl.HttpHeadersImpl@237f91e8, 
> org.apache.cxf.jaxrs.impl.UriInfoImpl@1ade3492, json].
>   at 
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
>   at 
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
>   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
>   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
>   at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>   at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:278)
>   at 
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
>   at 
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
>   at 
> org.apache.cxf.transport.http_undertow.UndertowHTTPDestination.doService(UndertowHTTPDestination.java:200)
>   at 
> org.apache.cxf.transport.http_undertow.CxfUndertowServlet.invoke(CxfUndertowServlet.java:52)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:225)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
>   at 
> io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
>   at 
> io.undertow.servlet.handlers.security.ServletS

[jira] [Commented] (CXF-8116) Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF Project

2019-09-18 Thread Marco Tenti (Jira)


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

Marco Tenti commented on CXF-8116:
--

For anyone want to remove the "default" i have success with this custom 
versione of the Jackson Json Provider

{code:java}
import java.io.IOException;

import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * @author ddrag...@gmail.com
 */
@Provider
@Consumes(MediaType.WILDCARD) // NOTE: required to support "non-standard" JSON 
variants
@Produces(MediaType.WILDCARD)
@Component(immediate = true, metatype = false)
@Service(value = {CustomJacksonJaxbJsonProvider.class})
public class CustomJacksonJaxbJsonProvider extends 
com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider implements 
ContextResolver{
private static final ObjectMapper OBJECT_MAPPER = buildObjectMapper();

public CustomJacksonJaxbJsonProvider() {
super();
super.setMapper(OBJECT_MAPPER);
}

public static ObjectMapper buildObjectMapper() {
ObjectMapper mapper = new ObjectMapper();

mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
//mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, 
false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, 
false);
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(SerializationFeature.FAIL_ON_SELF_REFERENCES, false);
//mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
//mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); 
//DROP ROOT ELEMENT
//https://www.baeldung.com/jackson-jsonmappingexception
//mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);

//https://stackoverflow.com/questions/15261456/how-do-i-disable-fail-on-empty-beans-in-jackson/15261908#15261908
//mapper.setVisibility(PropertyAccessor.GETTER, Visibility.NONE);
//mapper.setVisibility(PropertyAccessor.SETTER, Visibility.NONE);
//mapper.setVisibility(PropertyAccessor.CREATOR, Visibility.NONE);
// Michal Gajdos
//mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
//mapper.configure(SerializationFeature.INDENT_OUTPUT, true);

//mapper.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
//.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
//.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
//.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));


//https://stackoverflow.com/questions/11757487/how-to-tell-jackson-to-ignore-a-field-during-serialization-if-its-value-is-null
mapper.getSerializerProvider().setNullValueSerializer(new 
JsonSerializer() {
@Override
public void serialize(Object obj, JsonGenerator jsonGen, 
SerializerProvider unused)
throws IOException
{
//IGNORES NULL VALUES!
}
});

return mapper;
}

@Override
public ObjectMapper getContext(final Class type) {
//return new ObjectMapper()
//.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true)
//.configure(SerializationFeature.INDENT_OUTPUT, true);
return OBJECT_MAPPER;
}
}

{code}


> Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF 
> Project
> ---
>
> Key: CXF-8116
> URL: https://issues.apache.org/jira/browse/CXF-8116
> Project: CXF
>  Issue Type: Bug
>  Components: Bus, Documentation, JAX-RS, OSGi
>Affects Versions: 3.2.7
>Reporter: Marco Tenti
>Priority: Major
>
> Hi, i really need a full example for integrate the webjars "swaggerui" on 
> OSGI Camel CXF Project.
> I followed the documentation and add the webjars swagger-ui on compile mode 
> on my pom.xml 
> I don't know why but my "Swagger2Feature" generate only the swagger.json 
> endpoint and never load the SwaggerUi page.
> Here the blueprint.xml configuration i'm try to use:
> {code:xml

[jira] [Commented] (CXF-8116) Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF Project

2019-09-18 Thread Andriy Redko (Jira)


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

Andriy Redko commented on CXF-8116:
---

Thanks [~4535992], my apologies, didn't have time to look at the "default" one, 
but you found the solution.

> Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF 
> Project
> ---
>
> Key: CXF-8116
> URL: https://issues.apache.org/jira/browse/CXF-8116
> Project: CXF
>  Issue Type: Bug
>  Components: Bus, Documentation, JAX-RS, OSGi
>Affects Versions: 3.2.7
>Reporter: Marco Tenti
>Priority: Major
>
> Hi, i really need a full example for integrate the webjars "swaggerui" on 
> OSGI Camel CXF Project.
> I followed the documentation and add the webjars swagger-ui on compile mode 
> on my pom.xml 
> I don't know why but my "Swagger2Feature" generate only the swagger.json 
> endpoint and never load the SwaggerUi page.
> Here the blueprint.xml configuration i'm try to use:
> {code:xml}
>   address="${https.serviceHost}:${https.servicePort}/cxf/my/rest"
> id="rsServerTestServiceEndpointSSL"
> loggingFeatureEnabled="true" loggingSizeLimit="20"
> serviceClass="bug.test.endpoint.TestEndpoint" 
> staticSubresourceResolution="true">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> 
> 
>
>  class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
>  value="${https.serviceHost}:${https.servicePort}"/>
>  value="${https.serviceHost}:${https.servicePort}/cxf/my/rest"/>
> 
> 
> 
>  
> 
> 
> {code}
> i even get this exception , but i don't know how resolve:
> {code}
> org.apache.cxf.interceptor.Fault: Direct self-reference leading to cycle 
> (through reference chain: 
> org.apache.cxf.message.MessageContentsList[1]->org.apache.cxf.jaxrs.swagger.SyntheticServletConfig["servletContext"]->io.undertow.servlet.spec.ServletContextImpl["deployment"]->io.undertow.servlet.core.DeploymentImpl["deploymentInfo"]->io.undertow.servlet.api.DeploymentInfo["classLoader"]->org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader["bundle"]->org.apache.felix.framework.BundleImpl["bundle"])
>  while invoking public javax.ws.rs.core.Response 
> io.swagger.jaxrs.listing.ApiListingResource.getListing(javax.ws.rs.core.Application,javax.servlet.ServletConfig,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo,java.lang.String)
>  with params 
> [org.apache.cxf.jaxrs.swagger.Swagger2Feature$DefaultApplication@7fc8f668, 
> org.apache.cxf.jaxrs.swagger.SyntheticServletConfig@470a7e15, 
> org.apache.cxf.jaxrs.impl.HttpHeadersImpl@237f91e8, 
> org.apache.cxf.jaxrs.impl.UriInfoImpl@1ade3492, json].
>   at 
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
>   at 
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
>   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
>   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
>   at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>   at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:278)
>   at 
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
>   at 
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
>   at 
> org.apache.cxf.transport.http_undertow.UndertowHTTPDestination.doService(UndertowHTTPDestination.java:200)
>   at 
> org.apache.cxf.transport.http_undertow.CxfUndertowServlet.invoke(CxfUndertowServlet.java:52)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:225)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
>   at 
> io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
>   at 
> io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
>   

[jira] [Resolved] (CXF-8116) Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF Project

2019-09-18 Thread Andriy Redko (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andriy Redko resolved CXF-8116.
---
Resolution: Information Provided

> Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF 
> Project
> ---
>
> Key: CXF-8116
> URL: https://issues.apache.org/jira/browse/CXF-8116
> Project: CXF
>  Issue Type: Bug
>  Components: Bus, Documentation, JAX-RS, OSGi
>Affects Versions: 3.2.7
>Reporter: Marco Tenti
>Priority: Major
>
> Hi, i really need a full example for integrate the webjars "swaggerui" on 
> OSGI Camel CXF Project.
> I followed the documentation and add the webjars swagger-ui on compile mode 
> on my pom.xml 
> I don't know why but my "Swagger2Feature" generate only the swagger.json 
> endpoint and never load the SwaggerUi page.
> Here the blueprint.xml configuration i'm try to use:
> {code:xml}
>   address="${https.serviceHost}:${https.servicePort}/cxf/my/rest"
> id="rsServerTestServiceEndpointSSL"
> loggingFeatureEnabled="true" loggingSizeLimit="20"
> serviceClass="bug.test.endpoint.TestEndpoint" 
> staticSubresourceResolution="true">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> 
> 
>
>  class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
>  value="${https.serviceHost}:${https.servicePort}"/>
>  value="${https.serviceHost}:${https.servicePort}/cxf/my/rest"/>
> 
> 
> 
>  
> 
> 
> {code}
> i even get this exception , but i don't know how resolve:
> {code}
> org.apache.cxf.interceptor.Fault: Direct self-reference leading to cycle 
> (through reference chain: 
> org.apache.cxf.message.MessageContentsList[1]->org.apache.cxf.jaxrs.swagger.SyntheticServletConfig["servletContext"]->io.undertow.servlet.spec.ServletContextImpl["deployment"]->io.undertow.servlet.core.DeploymentImpl["deploymentInfo"]->io.undertow.servlet.api.DeploymentInfo["classLoader"]->org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader["bundle"]->org.apache.felix.framework.BundleImpl["bundle"])
>  while invoking public javax.ws.rs.core.Response 
> io.swagger.jaxrs.listing.ApiListingResource.getListing(javax.ws.rs.core.Application,javax.servlet.ServletConfig,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo,java.lang.String)
>  with params 
> [org.apache.cxf.jaxrs.swagger.Swagger2Feature$DefaultApplication@7fc8f668, 
> org.apache.cxf.jaxrs.swagger.SyntheticServletConfig@470a7e15, 
> org.apache.cxf.jaxrs.impl.HttpHeadersImpl@237f91e8, 
> org.apache.cxf.jaxrs.impl.UriInfoImpl@1ade3492, json].
>   at 
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
>   at 
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
>   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
>   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
>   at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>   at 
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>   at 
> org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:278)
>   at 
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
>   at 
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
>   at 
> org.apache.cxf.transport.http_undertow.UndertowHTTPDestination.doService(UndertowHTTPDestination.java:200)
>   at 
> org.apache.cxf.transport.http_undertow.CxfUndertowServlet.invoke(CxfUndertowServlet.java:52)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:225)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
>   at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
>   at 
> io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
>   at 
> io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
>   at 
> io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
>   at 
> io.undertow.servlet.hand

[jira] [Resolved] (CXF-8118) CXF LoggingInInterceptor: CachedWriter leaks

2019-09-18 Thread Freeman Fang (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Freeman Fang resolved CXF-8118.
---
Fix Version/s: 3.3.4
   3.2.11
   3.4.0
   Resolution: Fixed

> CXF LoggingInInterceptor: CachedWriter leaks
> 
>
> Key: CXF-8118
> URL: https://issues.apache.org/jira/browse/CXF-8118
> Project: CXF
>  Issue Type: Bug
>Reporter: Freeman Fang
>Assignee: Freeman Fang
>Priority: Major
> Fix For: 3.4.0, 3.2.11, 3.3.4
>
>
> when Reader is dectected in Message, will create CachedWriter for logging, 
> but never close this CachedWriter. Which will cause there's always a 
> reference in CachedWriter.streamList(never empty), so can't delete the tmp 
> file on the disk



--
This message was sent by Atlassian Jira
(v8.3.4#803005)