[jira] [Commented] (CXF-8119) Can't Inject "javax.ws.rs.core.Context" annotation with camel blueprint

2019-09-30 Thread Marco Tenti (Jira)


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

Marco Tenti commented on CXF-8119:
--

I maybe found a "patch" solution, but i need help to finalize.
I'have tried to customize a cxf inteceptor to capture the value on the body of 
the message and try to set on the header of the message.
here a example of the interceptors


{code:java}
public class MessageChangeInterceptor extends AbstractPhaseInterceptor 
{

public MessageChangeInterceptor() {
super(Phase.PRE_STREAM);   
}

public MessageChangeInterceptor(String phase) {
super(phase);
}

@Override
public void handleMessage(Message message) throws Fault {
try { 
HttpServletRequest httpRequest1 = (HttpServletRequest) 
message.get(AbstractHTTPDestination.HTTP_REQUEST); 
String method = httpRequest1.getMethod();

//https://stackoverflow.com/questions/9179375/servlet-filter-vs-cxf-interceptor-for-modifying-request-response-content

//https://stackoverflow.com/questions/10743000/how-to-get-parameters-name-and-value-in-requesthandler-of-jax-rs-based-service-i
String queryString = (String) 
message.get(Message.QUERY_STRING);
MultivaluedMap queryMap = 
JAXRSUtils.getStructuredParams(queryString, "&", false, false);
Map> headers = (Map>) 
message.get(Message.PROTOCOL_HEADERS);  

   //HOW CAN I PAS THE VALUE TO THE HEADER SO I CAN MAKE WORK
   //THE INJECT FOR "javax.ws.rs.core.Context" ?
  ...

} catch (Exception ce) {
Fault fault = new Fault(ce.getMessage(), Logger.getGlobal());
fault.setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode());
fault.setMessage(ce.getMessage());
throw fault;
}


{code}

It's not a ideal solution, but if anyone know how to do this , i can in the 
meanwhile go on with the project.

> Can't Inject "javax.ws.rs.core.Context" annotation with camel blueprint
> ---
>
> Key: CXF-8119
> URL: https://issues.apache.org/jira/browse/CXF-8119
> Project: CXF
>  Issue Type: Bug
>  Components: Bus, Core, JAX-RS, OSGi, Resources
>Affects Versions: 3.2.7
>Reporter: Marco Tenti
>Priority: Major
>
> I have a REST Service project build for a Red Hat Fuse.
> it's a simple set up of a rest service with a "blueprint.xml" and the 
> "cxf:rsServer" and it's work just fine.
> But i need to use the @Context annotation of javax.ws.rs and i ca't find a 
> way to inject dynamically the @Context on my java class.
> A full project for test of the problem can be found here:
> [bug-load-context-annotation-blueprint|https://github.com/p4535992/bug-load-context-annotation-blueprint]
> My goal is to set the value of the field;
> {code:java}
> @javax.ws.rs.core.Context
> public javax.ws.rs.core.HttpHeaders httpHeaders;
> {code}
> Another strange bug is if i call the method:
> {code:java}
>   @GET
>   @Path("/ping")
>   @Produces(MediaType.APPLICATION_JSON)
>   @WebMethod(operationName = "ping")
>   @WebResult(name = "Response")
>   @ApiResponses(value = { 
>   @ApiResponse(code = 200, message = "Success") ,
>   @ApiResponse(code = 500, message = "Error") 
> }
>   )
>   @ApiOperation( "Get operation with Response and @Default value")
>   public Response ping() {
>   logger.info("PING SIGNATURE SERVICE");
>   return Response.ok().entity("PING SIGNATURE SERVICE").build();
>   }
> }
> {code}
> it's work just fine , but if i call this (i just add the @Context HttpHeaders 
> httpHeaders parameter on the method) :
> {code:java}
>  @GET
>  @Path("/ping")
>  @Produces(MediaType.APPLICATION_JSON)
>  @WebMethod(operationName = "ping")
>  @WebResult(name = "Response")
>  @ApiResponses(value =
> { @ApiResponse(code = 200, message = "Success") , @ApiResponse(code = 500, 
> message = "Error") }
> )
>  @ApiOperation( "Get operation with Response and @Default value")
>  public Response ping(@Context HttpHeaders httpHeaders)
> { logger.info("PING SIGNATURE SERVICE"); return Response.ok().entity("PING 
> SIGNATURE SERVICE").build(); }
> }
> {code}
> i get this error:
> {code}
> 415 Error: Unsupported Media Type
>  {code}
> Teh documentation say something about the attribute "propagateContexts" to 
> true, but seem do nothing:
> {code:}
>   uri="cxfrs:bean:myRestSereer?performInvocation=true&bindingStyle=SimpleConsumer&propagateContexts=true"/>
> {code}
> ANOTHER example i can't undestand, the first method is injected with succes, 
> the second give me the "415 Error: Un

[jira] [Created] (CXF-8127) LoggingFeature - Wrong address concatenation

2019-09-30 Thread Krisztian Kurucz (Jira)
Krisztian Kurucz created CXF-8127:
-

 Summary: LoggingFeature - Wrong address concatenation
 Key: CXF-8127
 URL: https://issues.apache.org/jira/browse/CXF-8127
 Project: CXF
  Issue Type: Bug
  Components: logging
Affects Versions: 3.3.3
Reporter: Krisztian Kurucz






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


[jira] [Work logged] (CXF-8127) LoggingFeature - Wrong address concatenation

2019-09-30 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8127?focusedWorklogId=320492&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-320492
 ]

ASF GitHub Bot logged work on CXF-8127:
---

Author: ASF GitHub Bot
Created on: 30/Sep/19 13:25
Start Date: 30/Sep/19 13:25
Worklog Time Spent: 10m 
  Work Description: kkrisz1 commented on pull request #583: CXF-8127: 
LoggingFeature - Wrong address concatenation
URL: https://github.com/apache/cxf/pull/583
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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


Issue Time Tracking
---

Worklog Id: (was: 320492)
Remaining Estimate: 0h
Time Spent: 10m

> LoggingFeature - Wrong address concatenation
> 
>
> Key: CXF-8127
> URL: https://issues.apache.org/jira/browse/CXF-8127
> Project: CXF
>  Issue Type: Bug
>  Components: logging
>Affects Versions: 3.3.3
>Reporter: Krisztian Kurucz
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>




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


[jira] [Assigned] (CXF-8127) LoggingFeature - Wrong address concatenation

2019-09-30 Thread Freeman Yue Fang (Jira)


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

Freeman Yue Fang reassigned CXF-8127:
-

Assignee: Freeman Yue Fang

> LoggingFeature - Wrong address concatenation
> 
>
> Key: CXF-8127
> URL: https://issues.apache.org/jira/browse/CXF-8127
> Project: CXF
>  Issue Type: Bug
>  Components: logging
>Affects Versions: 3.3.3
>Reporter: Krisztian Kurucz
>Assignee: Freeman Yue Fang
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>




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


[jira] [Work logged] (CXF-8127) LoggingFeature - Wrong address concatenation

2019-09-30 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8127?focusedWorklogId=320576&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-320576
 ]

ASF GitHub Bot logged work on CXF-8127:
---

Author: ASF GitHub Bot
Created on: 30/Sep/19 15:31
Start Date: 30/Sep/19 15:31
Worklog Time Spent: 10m 
  Work Description: ffang commented on pull request #583: CXF-8127: 
LoggingFeature - Wrong address concatenation
URL: https://github.com/apache/cxf/pull/583
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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


Issue Time Tracking
---

Worklog Id: (was: 320576)
Time Spent: 20m  (was: 10m)

> LoggingFeature - Wrong address concatenation
> 
>
> Key: CXF-8127
> URL: https://issues.apache.org/jira/browse/CXF-8127
> Project: CXF
>  Issue Type: Bug
>  Components: logging
>Affects Versions: 3.3.3
>Reporter: Krisztian Kurucz
>Assignee: Freeman Yue Fang
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>




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


[jira] [Resolved] (CXF-8125) Support for using thread-safe application-defined StAX-factories

2019-09-30 Thread Freeman Yue Fang (Jira)


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

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

> Support for using thread-safe application-defined StAX-factories
> 
>
> Key: CXF-8125
> URL: https://issues.apache.org/jira/browse/CXF-8125
> Project: CXF
>  Issue Type: Improvement
>  Components: Core
>Affects Versions: 3.3.3
>Reporter: Barnabas Bodnar
>Assignee: Freeman Yue Fang
>Priority: Minor
> Fix For: 3.4.0, 3.2.11, 3.3.4
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> CXF assumes, application-defined (contextual property of the message) 
> StAX-factories are _not_ thread-safe and synchronizes accesses to them (eg. 
> in _org.apache.cxf.interceptor.StaxInInterceptor_):
> {noformat}
> XMLInputFactory factory = getXMLInputFactory(message);
> if (factory == null) {
>  if (reader != null) {
>  xreader = StaxUtils.createXMLStreamReader(reader);
>  } else {
>  xreader = StaxUtils.createXMLStreamReader(is, encoding);
>  }
> } else {
>  synchronized (factory) {
>  if (reader != null) {
>  xreader = factory.createXMLStreamReader(reader);
>  } else {
>  xreader = factory.createXMLStreamReader(is, encoding);
>  }
>  }{noformat}
> This is basically correct, because the StAX-spec doesn't require a 
> _XMLInputFactory_ or a _XMLOutputFactory_ to be thread-safe.
> However, this becomes problematic right with CXF's preferred 
> StAX-implementation, WSTX, because it *performs I/O (reads a few bytes)* in 
> _createXMLStreamReader()_:
> {noformat}
> at java.io.FilterInputStream.read(FilterInputStream.java:133)
> at com.ctc.wstx.io.BaseReader.readBytes(BaseReader.java:155)
> at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:369)
> at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:112)
> at 
> com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:254)
> at 
> com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:134)
> at 
> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:573)
> at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:633)
> at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:657)
> at 
> com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:342)
> at 
> org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:134)
> - locked <0x0006f7ceef50> (a com.ctc.wstx.stax.WstxInputFactory)
> {noformat}
> If this synchronous read-operation blocks due to network issues, *all other 
> incoming SOAP-requests are blocked*:
> {noformat}
> java.lang.Thread.State: BLOCKED (on object monitor)
> at 
> org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:130)
> - waiting to lock <0x0006f7ceef50> (a 
> com.ctc.wstx.stax.WstxInputFactory)
> at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> - locked <0x000781907170> (a 
> org.apache.cxf.phase.PhaseInterceptorChain)
> at 
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> at 
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
> at 
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
> {noformat}
> Even if performing I/O here is a questionable behavior of WSTX, unneeded 
> synchronization should anyway be avoided for performance reasons. My proposal 
> is to introduce a boolean contextual property indicating whether the provided 
> factories are thread-safe and omit the synchronization, if set to _true_.



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


[jira] [Resolved] (CXF-8127) LoggingFeature - Wrong address concatenation

2019-09-30 Thread Freeman Yue Fang (Jira)


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

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

> LoggingFeature - Wrong address concatenation
> 
>
> Key: CXF-8127
> URL: https://issues.apache.org/jira/browse/CXF-8127
> Project: CXF
>  Issue Type: Bug
>  Components: logging
>Affects Versions: 3.3.3
>Reporter: Krisztian Kurucz
>Assignee: Freeman Yue Fang
>Priority: Major
> Fix For: 3.4.0, 3.2.11, 3.3.4
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>




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