Re: CXF JAXRS Client : HttpAsyncClient and KeepAlive

2016-04-14 Thread Sergey Beryozkin

I've updated the JAXRS test, JAXRSAsyncClientTest:

@Test
public void testPatchBook() throws Exception {
String address = "http://localhost:; + PORT + "/bookstore/patch";
WebClient wc = WebClient.create(address);
wc.type("application/xml");

WebClient.getConfig(wc).getRequestContext().put("use.async.http.conduit", true);

WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000L);
Book book = wc.invoke("PATCH", new Book("Patch", 123L), 
Book.class);

assertEquals("Patch", book.getName());
wc.close();
}

and after putting a breakpoint in BookStore patchBook method I see it 
staying on the breakpoint without timing out...


Cheers, Sergey
On 12/04/16 14:01, Sergey Beryozkin wrote:

Hi

I've only opened an issue to make sure this issue is being tracked

https://issues.apache.org/jira/browse/CXF-6846

Cheers, Sergey
On 12/04/16 13:50, chandra shekhar wrote:

Hi Sergey,

Sorry to bother you.
Did you find something ?

Regards,
Chandra Shekhar



--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-JAXRS-Client-HttpAsyncClient-and-KeepAlive-tp5747402p5767808.html

Sent from the cxf-user mailing list archive at Nabble.com.







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: CXF JAXRS Client : HttpAsyncClient and KeepAlive

2016-04-12 Thread Sergey Beryozkin

Hi

I've only opened an issue to make sure this issue is being tracked

https://issues.apache.org/jira/browse/CXF-6846

Cheers, Sergey
On 12/04/16 13:50, chandra shekhar wrote:

Hi Sergey,

Sorry to bother you.
Did you find something ?

Regards,
Chandra Shekhar



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-JAXRS-Client-HttpAsyncClient-and-KeepAlive-tp5747402p5767808.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: [ 2.7.15] Matrix parameter followed by query parameter are merged?

2016-04-07 Thread Sergey Beryozkin
Just double checked that using WebClient directly (in that test I 
pointed out to) works as well. So IMHO the problem is somewhere at the 
lower level.


Sergey
On 07/04/16 12:24, Sergey Beryozkin wrote:

Hi

One thing I'd like to point out - CXF checks the matrix parameters on
the request URI, obtained from:

(HttpServletRequest)req.getRequestURI();

which must not return the query part.

So the source of the problem is that either:
- the container mistakenly returns the query as part of the request URI
- the question mark is mistakenly encoded on the client side, which
would result the combined value after being decoded on the client side.

Can you please confirm with HTTP trace enabled (TCP trace utility) that
a question mark is either encoded or not ?

Thanks, Sergey


On 06/04/16 17:20, Sergey Beryozkin wrote:

Hi Christian

I simply updated this test:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java#L1954



I tried

"http://localhost:; + PORT +
"/bookstore/segment/matrix;first=12;second=3?loc=123"

and only with a single matrix param:

"http://localhost:; + PORT + "/bookstore/segment/matrix;first=12?loc=123"

and then I put a breakpoint in:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java#L764



and checked '?loc=123' was not there.

The test runs on top of Jetty

Cheers, Sergey
On 06/04/16 17:00, Christian Balzer wrote:

Hi Sergey,

Thank you for looking into this. We are using an internal framework at
work that makes use of CXF - which means that it's not that easy to
just swap CXF out, unfortunately.
Having said that, a colleague started work to replace CXF 2.x by CXF
3.x today. But it'll be a few days before everything will be ported
over; so we can't yet say whether CXF 3.x is affected or not.

In the meantime, we did create another project from scratch, and
implemented an endpoint for GET.
Here are the results:

1 - USING CXF CLIENT VIA LOCAL (INTEGRATION TEST)
* matrix before query: ;m=1?q=2
* no QUERY_STRING entry in XMLMessage map
* result (fails):
* matrix param populated with matrix param value concatenated with
all of query string: 1?q=2
* query param populated correctly: 2

2 - USING CFX CLIENT VIA HTTP TO SERVER
* matrix before query: ;m=1?q=2
* QUERY_STRING present in XMLMessage map
* all works

3 - USING CHROME POSTMAN EXTENSION TO SERVER
* matrix before query: ;m=1?q=2
* query param value: 2
* marix param vaule: 1
* all works

4 - USING CHROME POSTMAN EXTENSION TO SERVER
* query before matrix: ?q=2;m=1
* query string contains the matrix parma: 2;m=1
* query param value: 
* matrix param value: 2;m=1
* arguably, this one could be considered ok if you argued that the
matrix param relates to the query param

Running via Chrome Postman extension to the server, here is the TCP
dump (I removed proprietary headers):
GET /bar/test?q=2;m=1 HTTP/1.1
Host: 10.221.29.152:7001
Connection: keep-alive
Accept: application/json
Cache-Control: no-cache
Content-Type: application/json
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82
Safari/537.36
Postman-Token: 1bc0c914-80a3-1829-ec9d-8352118792ec
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,de;q=0.4

HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, no-transform
Date: Wed, 06 Apr 2016 13:59:38 GMT
Content-Length: 0
Operation: (GET)/bar/test
X-Powered-By: Servlet/3.0 JSP/2.2

Also, org.apache.cxf.message.Message holds (amongst others):
QUERY_STRING -> "q=2;m=1"
"HTTP.REQUEST" -> "[
GET /bar/test?q=2;m=1 HTTP/1.1
...
]"

Now, why it fails for LOCAL transport for matrix before query, and for
query before matrix via HTTP, we don't quite know.
But I think it's fair to say it's probably nothing to do with the
encoding of the question mark...
(The Message map for test case 1 holds "org.apache.cxf.request.uri" ->
"/dates/test;one=1?two=2".)

Could you maybe share your test project with us, so we can compare
what you are doing, please? :-)

Kind regards,

Christian

On Tue, Apr 5, 2016 at 1:37 PM, Sergey Beryozkin
<sberyoz...@gmail.com> wrote:

Hi

I've experimented with a local test, I can not reproduce it.

Can you please add some logging on the client/server, or preferably,
pass it
via some TCP tracer, I wonder if the question mark ends up being
encoded,
etc, may be the client (HttpUrlConnection) gets confused about PUT
and query
parameters.

What about GET ?

Can you also double check CXF 3.1.x (just to confirm this issue is
2.7.x
specific)

Cheers, Sergey

On 05/04/16 11:35, Christian Balzer wrote:


Hi all,

We are restricted to the 2.x branch of cxf.

When we call our REST endpoint and provide a matrix parameter
(;id=123), followed by a query parameter (?loc=abc), cxf populates the
String 

Re: [ 2.7.15] Matrix parameter followed by query parameter are merged?

2016-04-07 Thread Sergey Beryozkin

Hi

One thing I'd like to point out - CXF checks the matrix parameters on 
the request URI, obtained from:


(HttpServletRequest)req.getRequestURI();

which must not return the query part.

So the source of the problem is that either:
- the container mistakenly returns the query as part of the request URI
- the question mark is mistakenly encoded on the client side, which 
would result the combined value after being decoded on the client side.


Can you please confirm with HTTP trace enabled (TCP trace utility) that 
a question mark is either encoded or not ?


Thanks, Sergey


On 06/04/16 17:20, Sergey Beryozkin wrote:

Hi Christian

I simply updated this test:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java#L1954


I tried

"http://localhost:; + PORT +
"/bookstore/segment/matrix;first=12;second=3?loc=123"

and only with a single matrix param:

"http://localhost:; + PORT + "/bookstore/segment/matrix;first=12?loc=123"

and then I put a breakpoint in:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java#L764


and checked '?loc=123' was not there.

The test runs on top of Jetty

Cheers, Sergey
On 06/04/16 17:00, Christian Balzer wrote:

Hi Sergey,

Thank you for looking into this. We are using an internal framework at
work that makes use of CXF - which means that it's not that easy to
just swap CXF out, unfortunately.
Having said that, a colleague started work to replace CXF 2.x by CXF
3.x today. But it'll be a few days before everything will be ported
over; so we can't yet say whether CXF 3.x is affected or not.

In the meantime, we did create another project from scratch, and
implemented an endpoint for GET.
Here are the results:

1 - USING CXF CLIENT VIA LOCAL (INTEGRATION TEST)
* matrix before query: ;m=1?q=2
* no QUERY_STRING entry in XMLMessage map
* result (fails):
* matrix param populated with matrix param value concatenated with
all of query string: 1?q=2
* query param populated correctly: 2

2 - USING CFX CLIENT VIA HTTP TO SERVER
* matrix before query: ;m=1?q=2
* QUERY_STRING present in XMLMessage map
* all works

3 - USING CHROME POSTMAN EXTENSION TO SERVER
* matrix before query: ;m=1?q=2
* query param value: 2
* marix param vaule: 1
* all works

4 - USING CHROME POSTMAN EXTENSION TO SERVER
* query before matrix: ?q=2;m=1
* query string contains the matrix parma: 2;m=1
* query param value: 
* matrix param value: 2;m=1
* arguably, this one could be considered ok if you argued that the
matrix param relates to the query param

Running via Chrome Postman extension to the server, here is the TCP
dump (I removed proprietary headers):
GET /bar/test?q=2;m=1 HTTP/1.1
Host: 10.221.29.152:7001
Connection: keep-alive
Accept: application/json
Cache-Control: no-cache
Content-Type: application/json
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82
Safari/537.36
Postman-Token: 1bc0c914-80a3-1829-ec9d-8352118792ec
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,de;q=0.4

HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, no-transform
Date: Wed, 06 Apr 2016 13:59:38 GMT
Content-Length: 0
Operation: (GET)/bar/test
X-Powered-By: Servlet/3.0 JSP/2.2

Also, org.apache.cxf.message.Message holds (amongst others):
QUERY_STRING -> "q=2;m=1"
"HTTP.REQUEST" -> "[
GET /bar/test?q=2;m=1 HTTP/1.1
...
]"

Now, why it fails for LOCAL transport for matrix before query, and for
query before matrix via HTTP, we don't quite know.
But I think it's fair to say it's probably nothing to do with the
encoding of the question mark...
(The Message map for test case 1 holds "org.apache.cxf.request.uri" ->
"/dates/test;one=1?two=2".)

Could you maybe share your test project with us, so we can compare
what you are doing, please? :-)

Kind regards,

Christian

On Tue, Apr 5, 2016 at 1:37 PM, Sergey Beryozkin
<sberyoz...@gmail.com> wrote:

Hi

I've experimented with a local test, I can not reproduce it.

Can you please add some logging on the client/server, or preferably,
pass it
via some TCP tracer, I wonder if the question mark ends up being
encoded,
etc, may be the client (HttpUrlConnection) gets confused about PUT
and query
parameters.

What about GET ?

Can you also double check CXF 3.1.x (just to confirm this issue is 2.7.x
specific)

Cheers, Sergey

On 05/04/16 11:35, Christian Balzer wrote:


Hi all,

We are restricted to the 2.x branch of cxf.

When we call our REST endpoint and provide a matrix parameter
(;id=123), followed by a query parameter (?loc=abc), cxf populates the
String argument annotated with the @MatrixParam bind annotation with
the merged String of matrix value and query parameter, i.e.
123?loc=abc

Any idea why and what we can do to stop that from happening?

We are basi

Re: [ 2.7.15] Matrix parameter followed by query parameter are merged?

2016-04-06 Thread Sergey Beryozkin

Hi Christian

I simply updated this test:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java#L1954

I tried

"http://localhost:; + PORT + 
"/bookstore/segment/matrix;first=12;second=3?loc=123"


and only with a single matrix param:

"http://localhost:; + PORT + "/bookstore/segment/matrix;first=12?loc=123"

and then I put a breakpoint in:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java#L764

and checked '?loc=123' was not there.

The test runs on top of Jetty

Cheers, Sergey
On 06/04/16 17:00, Christian Balzer wrote:

Hi Sergey,

Thank you for looking into this. We are using an internal framework at
work that makes use of CXF - which means that it's not that easy to
just swap CXF out, unfortunately.
Having said that, a colleague started work to replace CXF 2.x by CXF
3.x today. But it'll be a few days before everything will be ported
over; so we can't yet say whether CXF 3.x is affected or not.

In the meantime, we did create another project from scratch, and
implemented an endpoint for GET.
Here are the results:

1 - USING CXF CLIENT VIA LOCAL (INTEGRATION TEST)
* matrix before query: ;m=1?q=2
* no QUERY_STRING entry in XMLMessage map
* result (fails):
* matrix param populated with matrix param value concatenated with
all of query string: 1?q=2
* query param populated correctly: 2

2 - USING CFX CLIENT VIA HTTP TO SERVER
* matrix before query: ;m=1?q=2
* QUERY_STRING present in XMLMessage map
* all works

3 - USING CHROME POSTMAN EXTENSION TO SERVER
* matrix before query: ;m=1?q=2
* query param value: 2
* marix param vaule: 1
* all works

4 - USING CHROME POSTMAN EXTENSION TO SERVER
* query before matrix: ?q=2;m=1
* query string contains the matrix parma: 2;m=1
* query param value: 
* matrix param value: 2;m=1
* arguably, this one could be considered ok if you argued that the
matrix param relates to the query param

Running via Chrome Postman extension to the server, here is the TCP
dump (I removed proprietary headers):
GET /bar/test?q=2;m=1 HTTP/1.1
Host: 10.221.29.152:7001
Connection: keep-alive
Accept: application/json
Cache-Control: no-cache
Content-Type: application/json
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82
Safari/537.36
Postman-Token: 1bc0c914-80a3-1829-ec9d-8352118792ec
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,de;q=0.4

HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, no-transform
Date: Wed, 06 Apr 2016 13:59:38 GMT
Content-Length: 0
Operation: (GET)/bar/test
X-Powered-By: Servlet/3.0 JSP/2.2

Also, org.apache.cxf.message.Message holds (amongst others):
QUERY_STRING -> "q=2;m=1"
"HTTP.REQUEST" -> "[
GET /bar/test?q=2;m=1 HTTP/1.1
...
]"

Now, why it fails for LOCAL transport for matrix before query, and for
query before matrix via HTTP, we don't quite know.
But I think it's fair to say it's probably nothing to do with the
encoding of the question mark...
(The Message map for test case 1 holds "org.apache.cxf.request.uri" ->
"/dates/test;one=1?two=2".)

Could you maybe share your test project with us, so we can compare
what you are doing, please? :-)

Kind regards,

Christian

On Tue, Apr 5, 2016 at 1:37 PM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:

Hi

I've experimented with a local test, I can not reproduce it.

Can you please add some logging on the client/server, or preferably, pass it
via some TCP tracer, I wonder if the question mark ends up being encoded,
etc, may be the client (HttpUrlConnection) gets confused about PUT and query
parameters.

What about GET ?

Can you also double check CXF 3.1.x (just to confirm this issue is 2.7.x
specific)

Cheers, Sergey

On 05/04/16 11:35, Christian Balzer wrote:


Hi all,

We are restricted to the 2.x branch of cxf.

When we call our REST endpoint and provide a matrix parameter
(;id=123), followed by a query parameter (?loc=abc), cxf populates the
String argument annotated with the @MatrixParam bind annotation with
the merged String of matrix value and query parameter, i.e.
123?loc=abc

Any idea why and what we can do to stop that from happening?

We are basically using the following to fire up the request (via local
protocol) from our integration test:

client.path("foo/987")
.type(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
// adding headers here...
.matrix("id", "123")
.query("loc", "abc")
 .put(TEST_PAYLOAD);

Here is the method signature we are using for the endpoint:

@PUT
@Consumes({APPLICATION_JSON})
@Produces({"application/json;charset=UTF-8"})
public Response doStuff(
  @BeanParam B b,  // pulls out 987
  @MatrixParam("id") String id,
  

Re: [ 2.7.15] Matrix parameter followed by query parameter are merged?

2016-04-05 Thread Sergey Beryozkin

Hi

I've experimented with a local test, I can not reproduce it.

Can you please add some logging on the client/server, or preferably, 
pass it via some TCP tracer, I wonder if the question mark ends up being 
encoded, etc, may be the client (HttpUrlConnection) gets confused about 
PUT and query parameters.


What about GET ?

Can you also double check CXF 3.1.x (just to confirm this issue is 2.7.x 
specific)


Cheers, Sergey
On 05/04/16 11:35, Christian Balzer wrote:

Hi all,

We are restricted to the 2.x branch of cxf.

When we call our REST endpoint and provide a matrix parameter
(;id=123), followed by a query parameter (?loc=abc), cxf populates the
String argument annotated with the @MatrixParam bind annotation with
the merged String of matrix value and query parameter, i.e.
123?loc=abc

Any idea why and what we can do to stop that from happening?

We are basically using the following to fire up the request (via local
protocol) from our integration test:

client.path("foo/987")
   .type(MediaType.APPLICATION_JSON)
   .accept(MediaType.APPLICATION_JSON)
// adding headers here...
   .matrix("id", "123")
   .query("loc", "abc")
.put(TEST_PAYLOAD);

Here is the method signature we are using for the endpoint:

@PUT
@Consumes({APPLICATION_JSON})
@Produces({"application/json;charset=UTF-8"})
public Response doStuff(
 @BeanParam B b,  // pulls out 987
 @MatrixParam("id") String id,
 @QueryParam("loc") String loc,
 MySchema mySchema,
 @HeaderParam("bar") String header,
 @Context UriInfo uriInfo)
 throws Exception {

This results in loc being set to "abc" and id to "123?loc=abc"... :-(

Any help is much appreciated!

Kind regards,

Christian




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Dealing with Jettison array serialization issues

2016-04-04 Thread Sergey Beryozkin

Hi

Jettison is XMLStreamWriter, no type information is available.
If it does accumulate more than one value for a given property it can 
guess it must be a list, otherwise it does not know if it is a simple or 
complex property.


Sergey

On 04/04/16 12:56, Vjacheslav V. Borisov wrote:

Hi!

Looking at

http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-Jettison

paragraph "Dealing with Jettison array serialization issues"

does this is only way to configure List<> properties serializtion?


May be there is some undocumented  property to do this transparently,
eg all List<> properties  serialize as array, no matter how many elements
it has (1 or more)





Re: URL that contains "service" returns CXF Service List in Karaf

2016-03-29 Thread Sergey Beryozkin

"org.apache.cxf.osgi"
On 29/03/16 13:41, josephkampf wrote:

I'm using Karaf.  What would the PID be?





--
View this message in context: 
http://cxf.547215.n5.nabble.com/URL-that-contains-service-returns-CXF-Service-List-in-Karaf-tp5767298p5767333.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: streaming in a large post body

2016-03-28 Thread Sergey Beryozkin

Hi Benson

I'd consider using InputStream (or JAXP Source if applicable) as a 
method parameter or use attachments given that CXF saves some of the 
data to the temp files...


Sergey

On 28/03/16 19:07, Benson Margulies wrote:

If I want to handle posts with more payload than I want to have in memory
all at once (with REST), what's recommended?




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: URL that contains "service" returns CXF Service List in Karaf

2016-03-28 Thread Sergey Beryozkin

Hi

org.apache.cxf.servlet.service-list-path is a property that you can set 
in Karaf, to something like "/services-list", etc


Thanks, Sergey
On 28/03/16 14:13, josephkampf wrote:

I have a service that has some extended path information that include the
work service

Example:

http://localhost:8181/cxf/abcd/services

The Rest service is abcd and extended path info is /services.

I see that this is being done in the web.xml that CXF is using for the
CXFServlet.  How can I override this in Karaf?  Can I configure CXF to point
to a different web.xml file?

My current version of CXF is 2.7.11, however I will be moving to 3.1.4 soon.
So a solution that works for both or a solution for each would be much
appreciated.

Thanks,

Joe Kampf






--
View this message in context: 
http://cxf.547215.n5.nabble.com/URL-that-contains-service-returns-CXF-Service-List-in-Karaf-tp5767298.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: oauth2 server side cxf configuration

2016-03-23 Thread Sergey Beryozkin
Can you clarify please what you'd like to do, as far as enabling OAuth2 is
concerned ?

Cheers, Sergey



--
View this message in context: 
http://cxf.547215.n5.nabble.com/oauth2-server-side-cxf-configuration-tp5767107p5767152.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF JAXRS Client : HttpAsyncClient and KeepAlive

2016-03-23 Thread Sergey Beryozkin
Well, I suppose you set as per the documentation.
I'm not sure why it has no effect with HttpAsyncClient, I'll experiment a
bit later

Sergey



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-JAXRS-Client-HttpAsyncClient-and-KeepAlive-tp5747402p5767151.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF JAXRS Client : HttpAsyncClient and KeepAlive

2016-03-23 Thread Sergey Beryozkin

Hi

How do you set it ?

Cheers, Sergey
On 23/03/16 08:51, chandra shekhar wrote:

Hi Sergey, I set CONNECTION_TTL but I do not see any affect. I see that
connection always close in a minute which I see is receiveTimeout default
value.

Any suggestions here.



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-JAXRS-Client-HttpAsyncClient-and-KeepAlive-tp5747402p5767130.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: catalogLocation in JAXB/JSON Provider and @SchemaValidation

2016-03-23 Thread Sergey Beryozkin
Thanks for the analysis and the patch, I'm traveling so will look into 
it in detail next week (though might apply the patch earlier), does your 
patch addresses all of your concerns you raised in this thread ?


Cheers, Sergey

On 23/03/16 08:21, Vjacheslav V. Borisov wrote:

Don't know, how should this fixed (or should not)
E.g. , code like this could fix that, but seems ugly:
resolvedLocation =
catalogResolver.resolvePublic(publicId!=null?publicId:namespaceURI,
systemId);



Found where it takes place in case of cxf-wadl2java-plugin,
please see SchemaCompilerImpl.bind(), it passes namespaceURI as publicId
parameter, while SchemaHandler passes publicId as publicId, which is null,
and resolve does not takes place.
http://grepcode.com/file/repo1.maven.org/maven2/com.sun.xml.bind/jaxb-xjc/2.2.11/com/sun/tools/xjc/api/impl/s2j/SchemaCompilerImpl.java

I submitted my patch  https://issues.apache.org/jira/browse/CXF-6840




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Signing and encrypting JSON payload for REST requests over a browser

2016-03-19 Thread Sergey Beryozkin

Hi,
On 18/03/16 00:21, Giriraj Bhojak wrote:

Thank you Sergey.
I went through the spec. It mentions that the spec is not stable yet and is
subject to change. Would you know if it is widely used?
There are two specs involved here, JOSE and WebCrypto, the former is 
stable and is already quite widely used, though mostly in OAuth2 flows, 
but JOSE is independent of OAuth2.


WebCrypto is a browser specific mechanism on how to get the keys/etc, 
the demo worked for me in Firefox/Chrome, not sure about the other 
browsers, though I might've tried IE too when trying on Windows, do not 
remember now. I think it is unlikely anything but some minor details 
will get changed there.


If you'd like to start doing signing/encrypting within a script running 
inside a browser then I guess you have to be prepared at this stage to 
go some not-very standard-safe path.




I was hoping to use one of the JavaScript tools such as jsrrsasign, but
looks like it is our of picture.

Would you be able to share the source code/API details of the demo that you
gave in Apache Con?

On the demo page, click at the WebCrypto++ icon and it will bring you to 
a page with a link to the source code. In my demo I only replaced the 
server code which validates JWS signatures, the code that signs the data 
from within a script was the same as in the original demo.


I have not experimented with that script, I only wanted to demo the JOSE 
JWS interoperability between a non-CXF client (the script) and CXF server



Could you please expand on the trusted server approach you mentioned in the
follow-up?
If you can not sign directly within the script then post the data to be 
signed to the trusted server that will do it for you and return the 
signed data.


HTH, Sergey


Thank you for responding to my queries.

Thanks,
Giriraj
Thanks,
Giriraj
On Mar 17, 2016 6:10 PM, "Sergey Beryozkin" <sberyoz...@gmail.com> wrote:


Or a browser may ask a trusted server to help with it, and get this server
returning a String representing a JOSE payload, then script then forward it
somewhere else...

Sergey
On 17/03/16 21:35, Sergey Beryozkin wrote:


Hi

You may be talking about WebCrypto.

If you have a CXF client sending JSON, then JWE/JWS protecting it is
easy enough, but you have a script running in a browser then this script
have no access to the key stores, unless it is a WebCrypto aware browser
and most of them are by now AFAIK,

See this demo:


https://test.webpki.org/WCPPSignatureDemo/signcmd

(it says a password is 1234). It shows an interaction between a
WebCrypto (https://www.w3.org/TR/WebCryptoAPI/) browser based client
and a regular Java HTTP server, the data are signed, using JOSE (JWS
Compact) as one option.

I actually presented this demo at Apache Con NA 2015, except I replaced
the demo server with a CXF JWS-enabled server.

Sergey
On 17/03/16 15:45, Giriraj Bhojak wrote:


Hi,

I have been struggling with a basic question related to using signing and
encryption for REST services.

If the REST call (using JSON) happens over http or https via a
browser, how
can I ensure that JSON payload is signed and encrypted, just like a SOAP
request that is signed and encrypted?

Is there a JavaScript component that I can use to implement JOSE for
browser based REST requests?

Or am I interpreting this in a wrong way?

Thanks,
Giriraj.







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Signing and encrypting JSON payload for REST requests over a browser

2016-03-19 Thread Sergey Beryozkin

Hi

You may be talking about WebCrypto.

If you have a CXF client sending JSON, then JWE/JWS protecting it is 
easy enough, but you have a script running in a browser then this script 
have no access to the key stores, unless it is a WebCrypto aware browser 
and most of them are by now AFAIK,


See this demo:


https://test.webpki.org/WCPPSignatureDemo/signcmd

(it says a password is 1234). It shows an interaction between a 
WebCrypto (https://www.w3.org/TR/WebCryptoAPI/) browser based client
and a regular Java HTTP server, the data are signed, using JOSE (JWS 
Compact) as one option.


I actually presented this demo at Apache Con NA 2015, except I replaced 
the demo server with a CXF JWS-enabled server.


Sergey
On 17/03/16 15:45, Giriraj Bhojak wrote:

Hi,

I have been struggling with a basic question related to using signing and
encryption for REST services.

If the REST call (using JSON) happens over http or https via a browser, how
can I ensure that JSON payload is signed and encrypted, just like a SOAP
request that is signed and encrypted?

Is there a JavaScript component that I can use to implement JOSE for
browser based REST requests?

Or am I interpreting this in a wrong way?

Thanks,
Giriraj.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Apache CXF 3.0.7 Webclient is taking too long to process the response

2016-03-19 Thread Sergey Beryozkin

Hi

Looks like something is seriously wrong with the client configuration, 
or, perhaps WebClient is targeting a different service endpoint that 
indeed takes 10 min to return


Sergey
On 18/03/16 14:44, Khare, Aparna wrote:

Dear Colleagues,

I'm using Apache cxf 3.0.7 and I use weblient to create the HTTP client 
webclient.get()to get the response.

The response is returned in more than 10 mins whereas in the browser it takes 
seconds.


Thanks,
Aparna




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Signing and encrypting JSON payload for REST requests over a browser

2016-03-19 Thread Sergey Beryozkin
Or a browser may ask a trusted server to help with it, and get this 
server returning a String representing a JOSE payload, then script then 
forward it somewhere else...


Sergey
On 17/03/16 21:35, Sergey Beryozkin wrote:

Hi

You may be talking about WebCrypto.

If you have a CXF client sending JSON, then JWE/JWS protecting it is
easy enough, but you have a script running in a browser then this script
have no access to the key stores, unless it is a WebCrypto aware browser
and most of them are by now AFAIK,

See this demo:


https://test.webpki.org/WCPPSignatureDemo/signcmd

(it says a password is 1234). It shows an interaction between a
WebCrypto (https://www.w3.org/TR/WebCryptoAPI/) browser based client
and a regular Java HTTP server, the data are signed, using JOSE (JWS
Compact) as one option.

I actually presented this demo at Apache Con NA 2015, except I replaced
the demo server with a CXF JWS-enabled server.

Sergey
On 17/03/16 15:45, Giriraj Bhojak wrote:

Hi,

I have been struggling with a basic question related to using signing and
encryption for REST services.

If the REST call (using JSON) happens over http or https via a
browser, how
can I ensure that JSON payload is signed and encrypted, just like a SOAP
request that is signed and encrypted?

Is there a JavaScript component that I can use to implement JOSE for
browser based REST requests?

Or am I interpreting this in a wrong way?

Thanks,
Giriraj.







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: How to manage resource owner login in CXF

2016-03-12 Thread Sergey Beryozkin

Hi
On 11/03/16 14:52, matteo wrote:

Thank you for your reply!

In the end I simply registered a ExceptionMapper and
now I redirect the resource owner to our login page (implemented as a wab).

The problem I'm still facing is that when the login wab performs the
/authorize/ invocation again (this time with the expected basic
authentication header in place), the authorization invocation fails because
the securityContext.getUserPrincipal() returns null.

What is the right way in CXF to correctly populate the SecurityContext with
a sound user principal?

If you use the servlet security then the container will set up the 
principal itself, otherwise you need to set a CXF filter, ex, JAX-RS 2.0 
filter, which will parse the header and set up SecurityContext


Sergey

Many thanks again,
matte



-
matteo
--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-manage-resource-owner-login-in-CXF-tp5766808p5766837.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: WebClient getting connection already closed

2016-03-12 Thread Sergey Beryozkin
)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
Caused by: java.lang.IllegalStateException: Buffer already closed for writing
at 
org.apache.cxf.transport.http.asyncclient.SharedOutputBuffer.write(SharedOutputBuffer.java:231)
at 
org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream$1.write(AsyncHTTPConduit.java:431)
at 
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:51)
at 
org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1332)
... 59 more




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: How to manage resource owner login in CXF

2016-03-12 Thread Sergey Beryozkin
As far as this interceptor is concerned, it can be configured with 
custom callback handlers, I don't remember the name of the property 
right now, but you can set whatever custom handlers are required.


Cheers, Sergey
On 11/03/16 17:26, matteo wrote:

Ok, I narrowed down a little bit my question.

I see that it is possible to leverage Jaas to populate the SecurityContext
principal via the JAASAuthenticationFilter. Now the point is I would like to
manage my users and passwords via datasources as explained in  karaf
documentation
<https://karaf.apache.org/manual/latest/developers-guide/security-framework.html>
. The point is that my users' passwords are stored in the database as
encrypted tokens.

So my previous question becomes: how to specify a
javax.security.auth.callback.CallbackHandler to compute received password
hash before jaas login?

All other steps should be performed transparently by CXF
JAASAuthenticationFilter, right?

Thank you very much.

matteo



-
matteo
--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-manage-resource-owner-login-in-CXF-tp5766808p5766839.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: How to manage resource owner login in CXF

2016-03-11 Thread Sergey Beryozkin

Hi Matteo

I've copied those log statements while working with a demo shipped with 
my company's distribution (you can see a link to that demo if you check 
'CXF OAuth2' in Google).


In that demo, a custom security filter is protecting the demo OAuth2 web 
client, it checks if "Authorization: Basic" is there, if not then it 
will challenge a user and it is managed by the browser, so the first 
time the user accesses a web client it is asked by the browser to 
authenticate, and then after the user is redirected to OAuth2 and then 
back to the client, the browser is remembering the user authenticating 
and sets this header itself.


In many cases one would really need to have some SSO in place, so that a 
user does not have to sign in into the web client(s) and OAuth2 server
separately. The demo also shows one option, SAML Web SSO with 
Shibboleth. We also have 2 demos shipped with CXF, basic_oidc and 
big_query, which show OpenIdConnect RP in action.


HTH, Sergey

On 10/03/16 14:05, matteo wrote:

I'm trying to figure out how to deal with resource owner login procedure in
CXF OAuth2 implementation. In the docs
(http://cxf.apache.org/docs/jax-rs-oauth2.html) it is stated that

/The client application asks the current user (the browser) to go to a new
address provided by the Location header and the follow-up request to
AuthorizationCodeGrantService will look like this:
/


/Note that the end user needs to authenticate./

Could you please explain how to deal with resource ownser login in order to
provide the required

header? What kind of cxf handler (if any) should be registered? Is it
possible to serve a custom login form in case the
AuthorizationCodeGrantService detects that the Authorization header is
missing?

Many thanks.

matteo



-
matteo
--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-manage-resource-owner-login-in-CXF-tp5766808.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-10 Thread Sergey Beryozkin
Briefly returning to this thread and clarify why I'm asking to check 
Jersey UriBuilder or perhaps, even better JAX-RS 2.0 Client API with 
Jersey and the way the certain combinations are treated:

- double encoding of URI (Path, Query) parameters.
- double encoding of Form parameters.
- treatment of '+' in Path and Query

You can also experiment with RestEasy.

That will help see how different implementations deal with it on the 
client side.


Sergey

On 08/03/16 17:58, Sergey Beryozkin wrote:

I started another thread on why '+' is encoded because this thread has
been all about encoding a '%' symbol.
On 08/03/16 16:50, Sergey Beryozkin wrote:

I'm not going to repeat most of what I've already said few times in this
thread but only state again that CXF proxies depend on JAX-RS UriBuilder
and therefore UriBuilder dictates how %-encoded query (and other)
parameters get processed.

This is a won't fix 'issue'. However I also mentioned that if you
validate that Jersey's (i.e RI's) UriBuilder behaves differently then I
will act accordingly.

Sergey

On 08/03/16 16:44, Volkov Sergey wrote:

I agree that UriBuilder implements what is states.

Such values are allowed in the query representations. The UriBuilder

does not know what the intention of the CXF proxy user is, it may have
an encoded representation of a given character stored in the DB and
wants to pass it as is via the proxy.



"+" value also allowed in query representation, but is encoded for some
reason by UriBuilder. So there would be problems with stored in db
values
if they contains "+"

I'm not using jerecy, only
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean to create proxies.

I found https://issues.apache.org/jira/browse/CXF-6015 and
"url.encode.client.parameters" property, but because
org.apache.cxf.jaxrs.client.UrlEncodingParamConverter encodes space as
"+",
and "+" is encoded as "%2B" by UriBuilder it's also not very useful
(Sequence like "+ +" would be converted to "%2B%2B%2B" and decoded as
"+++") Also it double encodes @FormParam values.




Please forget about CXF proxies. It is down to UriBuilder.
http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/UriBuilder.html
states:


'Percent encoded values are also recognized where allowed and will not
be double encoded.'

Such values are allowed in the query representations. The UriBuilder
does not know what the intention of the CXF proxy user is, it may have
an encoded representation of a given character stored in the DB and
wants to pass it as is via the proxy.

Experiment with Jersey and if they do double encode (I doubt but...)
then we will continue, I think I've given you my best explanations so
far, lets continue later on when you have the Jersey test results
ready.

Sergey

On 04/03/16 11:16, Volkov Sergey wrote:


i.e CXF proxy do not urlencode parameters? (Instead of it use
org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded encoding

which

is not reversible)

And the only reason of this encoding is to avoid reports about
correctly
encoded parameters?

As I said, CXF proxy runtime uses JAX-RS UriBuilder.


And UriBuilder does not touch valid percent-encoded representations.

And this is how the RS client runtime will continue operating.

Sergey



On 04/03/16 10:45, Volkov Sergey wrote:



"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"



"100%25BETTER VALID STRING" is correct way to urlencode "100%BETTER

VALID

STRING" - so actually CXF is over-smart now, when it skips all %xx

sequence

instead of encode % as %25

"100%VALID STRING" at the moment encodes by cxf as "100%25VALID

STRING"




In the former case it it has no characters that can be used to form

the

hex %-encoded representations.

The bottom line is, you should not expect the runtime auto-encode
'%'
given that this symbol plays a special role in having correct URIs

being

created.

If CXF will try to me over-smart then the next day someone will

report

that it started producing

"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"

Sergey
On 04/03/16 07:43, Volkov Sergey wrote:


Looks like POST request and @FormParam could be used, but I think

this

behavior of @QueryParam may lead to tricky bugs in many places
where

it

used


2016-03-04 10:37 GMT+03:00 Volkov Sergey <[hidden email]

<



http://cxf.547215.n5.nabble.com/user/SendEmail.jtp?type=node=5766616=0>>:










Yes, I don't understand why it does not touch this sequences.

It's a bit strange because I can successfully transfer "100%VALID

STRING"

but not "100%BETTER VALID STRING"

Both this string not percent encoded, but second contains %BE
which

just

looks like percent encoded.

If instead of

org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded

cxf just urlencode parameter value when building

Re: Why proxies encode '+' query parameters

2016-03-08 Thread Sergey Beryozkin

On 08/03/16 17:16, Sergey Beryozkin wrote:

On 08/03/16 16:56, Sergey Beryozkin wrote:


"+" value also allowed in query representation, but is encoded for some
reason by UriBuilder.


Well, this is not CXF specific.


So there would be problems with stored in db

values
if they contains "+"

I'm not using jerecy, only
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean to create proxies.

I found https://issues.apache.org/jira/browse/CXF-6015 and
"url.encode.client.parameters" property, but because
org.apache.cxf.jaxrs.client.UrlEncodingParamConverter encodes space as
"+",
and "+" is encoded as "%2B" by UriBuilder it's also not very useful
(Sequence like "+ +" would be converted to "%2B%2B%2B" and decoded as
"+++")


Look, I accept there could be some strange combination that are expected
to go one way to the wire while the users expects something different.
We do out best to accommodate various user requirements, and
"url.encode.client.parameters" was one of such steps. If using it
creates something unexpected in your case then don't use it.
If you have a server that wants to really wants to see "+ " after the
request has been decoded then encode "+ " as "%2B%29" and be done with it

"%2B%20"










--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Why proxies encode '+' query parameters

2016-03-08 Thread Sergey Beryozkin


"+" value also allowed in query representation, but is encoded for some
reason by UriBuilder. So there would be problems with stored in db values
if they contains "+"

I'm not using jerecy, only
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean to create proxies.

I found https://issues.apache.org/jira/browse/CXF-6015 and
"url.encode.client.parameters" property, but because
org.apache.cxf.jaxrs.client.UrlEncodingParamConverter encodes space as
"+",
and "+" is encoded as "%2B" by UriBuilder it's also not very useful
(Sequence like "+ +" would be converted to "%2B%2B%2B" and decoded as
"+++") Also it double encodes @FormParam values.




Re: Percent encoded string in @QueryParam

2016-03-08 Thread Sergey Beryozkin
I'm not going to repeat most of what I've already said few times in this 
thread but only state again that CXF proxies depend on JAX-RS UriBuilder 
and therefore UriBuilder dictates how %-encoded query (and other) 
parameters get processed.


This is a won't fix 'issue'. However I also mentioned that if you 
validate that Jersey's (i.e RI's) UriBuilder behaves differently then I 
will act accordingly.


Sergey

On 08/03/16 16:44, Volkov Sergey wrote:

I agree that UriBuilder implements what is states.

Such values are allowed in the query representations. The UriBuilder

does not know what the intention of the CXF proxy user is, it may have
an encoded representation of a given character stored in the DB and
wants to pass it as is via the proxy.



"+" value also allowed in query representation, but is encoded for some
reason by UriBuilder. So there would be problems with stored in db values
if they contains "+"

I'm not using jerecy, only
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean to create proxies.

I found https://issues.apache.org/jira/browse/CXF-6015 and
"url.encode.client.parameters" property, but because
org.apache.cxf.jaxrs.client.UrlEncodingParamConverter encodes space as "+",
and "+" is encoded as "%2B" by UriBuilder it's also not very useful
(Sequence like "+ +" would be converted to "%2B%2B%2B" and decoded as
"+++") Also it double encodes @FormParam values.




Please forget about CXF proxies. It is down to UriBuilder.
http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/UriBuilder.html states:


'Percent encoded values are also recognized where allowed and will not
be double encoded.'

Such values are allowed in the query representations. The UriBuilder
does not know what the intention of the CXF proxy user is, it may have
an encoded representation of a given character stored in the DB and
wants to pass it as is via the proxy.

Experiment with Jersey and if they do double encode (I doubt but...)
then we will continue, I think I've given you my best explanations so
far, lets continue later on when you have the Jersey test results ready.

Sergey

On 04/03/16 11:16, Volkov Sergey wrote:


i.e CXF proxy do not urlencode parameters? (Instead of it use
org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded encoding

which

is not reversible)

And the only reason of this encoding is to avoid reports about correctly
encoded parameters?

As I said, CXF proxy runtime uses JAX-RS UriBuilder.


And UriBuilder does not touch valid percent-encoded representations.

And this is how the RS client runtime will continue operating.

Sergey



On 04/03/16 10:45, Volkov Sergey wrote:



"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"



"100%25BETTER VALID STRING" is correct way to urlencode "100%BETTER

VALID

STRING" - so actually CXF is over-smart now, when it skips all %xx

sequence

instead of encode % as %25

"100%VALID STRING" at the moment encodes by cxf as "100%25VALID

STRING"




In the former case it it has no characters that can be used to form

the

hex %-encoded representations.

The bottom line is, you should not expect the runtime auto-encode '%'
given that this symbol plays a special role in having correct URIs

being

created.

If CXF will try to me over-smart then the next day someone will

report

that it started producing

"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"

Sergey
On 04/03/16 07:43, Volkov Sergey wrote:


Looks like POST request and @FormParam could be used, but I think

this

behavior of @QueryParam may lead to tricky bugs in many places where

it

used


2016-03-04 10:37 GMT+03:00 Volkov Sergey <[hidden email]

<



http://cxf.547215.n5.nabble.com/user/SendEmail.jtp?type=node=5766616=0>>:








Yes, I don't understand why it does not touch this sequences.

It's a bit strange because I can successfully transfer "100%VALID

STRING"

but not "100%BETTER VALID STRING"

Both this string not percent encoded, but second contains %BE which

just

looks like percent encoded.

If instead of

org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded

cxf just urlencode parameter value when building query string both

examples

would be transferred correctly.




If you are saying that

when you pass something like "%D1%82", or to make it clearer,
"%D1" and expect CXF do "%25D1", then no, it won't work.
UriBuilder does not touch percent-encoded sequences %XX.

May be try building the query with UriBuilder before passing it to

the

proxy, something like

UriBuilder.fromUri("{a}%D21").build("%").toString()

Though not sure it will be cheaper.

Sergey

On 03/03/16 21:27, Sergey Beryozkin wrote:


 From the original post in this thread:



When I pass string "т" (Cyrillic s

Re: Is there anything asynchronous about starting a server?

2016-03-06 Thread Sergey Beryozkin

Interesting, I guess more analysis may be needed.
Perhaps Jetty does take few seconds to get 'really' ready after 
sf.create() returns, may be it is Jetty version specific ?


Sergey
On 06/03/16 12:51, Benson Margulies wrote:

On Sun, Mar 6, 2016 at 7:08 AM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:

May be the service has not been started (exception is lost, not sure) or
address is wrong ?


A moment later all is well.



Sergey

On 05/03/16 00:20, Benson Margulies wrote:


The code below runs in Karaf. Is there any chance of a caller getting:

No service was found.

after this has executed?


  bus = BusFactory.newInstance().createBus();
  // set the class loader so that the TCCL is reliably 'us' when
we get called.

bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
ClassLoader.class);
  JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
  sf.setBus(bus);
  sf.setServiceBean(this);
  sf.setAddress("/worker");
  server = sf.create();








Re: How CXF helps to redirect to non-matching http request to a static HTML page

2016-03-06 Thread Sergey Beryozkin

Hi

If CXFServlet has a wildcard pattern then another idea might be to catch 
404 with ExceptionMapper and then redirect with the help of 
RequestDispatcherProvider (ex, the mapper returns Error bean in Response 
and the provider is configured to map Error to error.html) - in this 
case CXFServlet will need to be additionally configured to redirect 
requests to say error.html to a 'default' servlet.


Sergey
On 05/03/16 17:15, Jose María Zaragoza wrote:

Hi

You could use a custom error page for 404 error code
Look at error-page and error code in web.xml


2016-03-05 6:23 GMT+01:00 Sumit Arora <sumit1...@gmail.com>:

As CXF provides configuration to set default page from :


 static-welcome-file
 /main.html
 

This is working fine.

My question : *How to redirect to non-matching http request to a static
HTML page  ?*

'Sumit



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-04 Thread Sergey Beryozkin

Please forget about CXF proxies. It is down to UriBuilder.
http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/UriBuilder.html states:

'Percent encoded values are also recognized where allowed and will not 
be double encoded.'


Such values are allowed in the query representations. The UriBuilder 
does not know what the intention of the CXF proxy user is, it may have 
an encoded representation of a given character stored in the DB and 
wants to pass it as is via the proxy.


Experiment with Jersey and if they do double encode (I doubt but...) 
then we will continue, I think I've given you my best explanations so 
far, lets continue later on when you have the Jersey test results ready.


Sergey

On 04/03/16 11:16, Volkov Sergey wrote:

i.e CXF proxy do not urlencode parameters? (Instead of it use
org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded encoding which
is not reversible)

And the only reason of this encoding is to avoid reports about correctly
encoded parameters?

As I said, CXF proxy runtime uses JAX-RS UriBuilder.


And UriBuilder does not touch valid percent-encoded representations.

And this is how the RS client runtime will continue operating.

Sergey



On 04/03/16 10:45, Volkov Sergey wrote:



"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"



"100%25BETTER VALID STRING" is correct way to urlencode "100%BETTER

VALID

STRING" - so actually CXF is over-smart now, when it skips all %xx

sequence

instead of encode % as %25

"100%VALID STRING" at the moment encodes by cxf as "100%25VALID STRING"



In the former case it it has no characters that can be used to form the
hex %-encoded representations.

The bottom line is, you should not expect the runtime auto-encode '%'
given that this symbol plays a special role in having correct URIs

being

created.

If CXF will try to me over-smart then the next day someone will report
that it started producing

"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"

Sergey
On 04/03/16 07:43, Volkov Sergey wrote:


Looks like POST request and @FormParam could be used, but I think this
behavior of @QueryParam may lead to tricky bugs in many places where

it

used


2016-03-04 10:37 GMT+03:00 Volkov Sergey <[hidden email]

<

http://cxf.547215.n5.nabble.com/user/SendEmail.jtp?type=node=5766616=0>>:






Yes, I don't understand why it does not touch this sequences.

It's a bit strange because I can successfully transfer "100%VALID

STRING"

but not "100%BETTER VALID STRING"

Both this string not percent encoded, but second contains %BE which

just

looks like percent encoded.

If instead of

org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded

cxf just urlencode parameter value when building query string both

examples

would be transferred correctly.




If you are saying that

when you pass something like "%D1%82", or to make it clearer,
"%D1" and expect CXF do "%25D1", then no, it won't work.
UriBuilder does not touch percent-encoded sequences %XX.

May be try building the query with UriBuilder before passing it to

the

proxy, something like

UriBuilder.fromUri("{a}%D21").build("%").toString()

Though not sure it will be cheaper.

Sergey

On 03/03/16 21:27, Sergey Beryozkin wrote:


From the original post in this thread:



When I pass string "т" (Cyrillic symbol) to generated client in

encodes

to

"%D1%82" in url and decodes as "т" on server what is fine, but

when

i

pass

"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82"

and

decodes

also to "т".


I honestly don't get what the problem is. You pass a Cyrillic

symbol

either as is or already percent encoded and in both case, as you

say

above, you get this Cyrillic symbol.



















--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-04 Thread Sergey Beryozkin

I see a test like this:

@Test
public void testClonePctEncoded() throws Exception {
URI uri = new URI("http://bar;);
URI newUri = new UriBuilderImpl(uri)
.path("{a}").path("{b}")
.matrixParam("m", "m1 ", "m2+%20")
.queryParam("q", "q1 ", 
"q2+q3%20").clone().buildFromEncoded("a+ ", "b%2B%20 ");

assertEquals("URI is not built correctly",

"http://bar/a+%20/b%2B%20%20;m=m1%20;m=m2+%20?q=q1+=q2%2Bq3%20;,
 newUri.toString());
}

Note a 'q' query parameter has 2 values, one of them is

"q2+q3%20" so here we have a valid %-encoded representation.

The test asserts it is encoded as:

"q2%2Bq3%20"

i.e it stays untouched.

I nearly 100% sure this test was added as part of the TCK work, but do 
not hesitate to test Jersey further if you'd like


Sergey


On 04/03/16 11:11, Sergey Beryozkin wrote:

Can you experiment with JAX-RS RI UriBuilder and double check that
passing to it a query parameter like "%DE" will not encode it ?

I'm pretty sure they won't. I have done a lot of work with UriBuilder to
make sure it passed JAX-RS 1.1 and the early 2.0 TCK that was available
to Apache. So I'd be surprised if I had to fix UriBuilder further given
that a lot of TCK tests are targeted at UriBuilder.

If Jersey does encode it then I'll review it and see what may need to be
done

Sergey
On 04/03/16 10:56, Sergey Beryozkin wrote:

As I said, CXF proxy runtime uses JAX-RS UriBuilder.

And UriBuilder does not touch valid percent-encoded representations.

And this is how the RS client runtime will continue operating.

Sergey



On 04/03/16 10:45, Volkov Sergey wrote:


"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"



"100%25BETTER VALID STRING" is correct way to urlencode "100%BETTER
VALID
STRING" - so actually CXF is over-smart now, when it skips all %xx
sequence
instead of encode % as %25

"100%VALID STRING" at the moment encodes by cxf as "100%25VALID STRING"



In the former case it it has no characters that can be used to form the
hex %-encoded representations.

The bottom line is, you should not expect the runtime auto-encode '%'
given that this symbol plays a special role in having correct URIs
being
created.

If CXF will try to me over-smart then the next day someone will report
that it started producing

"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"

Sergey
On 04/03/16 07:43, Volkov Sergey wrote:


Looks like POST request and @FormParam could be used, but I think this
behavior of @QueryParam may lead to tricky bugs in many places
where it

used


2016-03-04 10:37 GMT+03:00 Volkov Sergey <[hidden email]

<http://cxf.547215.n5.nabble.com/user/SendEmail.jtp?type=node=5766616=0>>:






Yes, I don't understand why it does not touch this sequences.

It's a bit strange because I can successfully transfer "100%VALID

STRING"

but not "100%BETTER VALID STRING"

Both this string not percent encoded, but second contains %BE which

just

looks like percent encoded.

If instead of

org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded

cxf just urlencode parameter value when building query string both

examples

would be transferred correctly.




If you are saying that

when you pass something like "%D1%82", or to make it clearer,
"%D1" and expect CXF do "%25D1", then no, it won't work.
UriBuilder does not touch percent-encoded sequences %XX.

May be try building the query with UriBuilder before passing it to
the
proxy, something like

UriBuilder.fromUri("{a}%D21").build("%").toString()

Though not sure it will be cheaper.

Sergey

On 03/03/16 21:27, Sergey Beryozkin wrote:


   From the original post in this thread:



When I pass string "т" (Cyrillic symbol) to generated client in

encodes

to

"%D1%82" in url and decodes as "т" on server what is fine, but

when

i

pass

"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82"
and

decodes

also to "т".


I honestly don't get what the problem is. You pass a Cyrillic
symbol
either as is or already percent encoded and in both case, as you
say
above, you get this Cyrillic symbol.





















--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-04 Thread Sergey Beryozkin
Can you experiment with JAX-RS RI UriBuilder and double check that 
passing to it a query parameter like "%DE" will not encode it ?


I'm pretty sure they won't. I have done a lot of work with UriBuilder to 
make sure it passed JAX-RS 1.1 and the early 2.0 TCK that was available 
to Apache. So I'd be surprised if I had to fix UriBuilder further given 
that a lot of TCK tests are targeted at UriBuilder.


If Jersey does encode it then I'll review it and see what may need to be 
done


Sergey
On 04/03/16 10:56, Sergey Beryozkin wrote:

As I said, CXF proxy runtime uses JAX-RS UriBuilder.

And UriBuilder does not touch valid percent-encoded representations.

And this is how the RS client runtime will continue operating.

Sergey



On 04/03/16 10:45, Volkov Sergey wrote:


"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"



"100%25BETTER VALID STRING" is correct way to urlencode "100%BETTER VALID
STRING" - so actually CXF is over-smart now, when it skips all %xx
sequence
instead of encode % as %25

"100%VALID STRING" at the moment encodes by cxf as "100%25VALID STRING"



In the former case it it has no characters that can be used to form the
hex %-encoded representations.

The bottom line is, you should not expect the runtime auto-encode '%'
given that this symbol plays a special role in having correct URIs being
created.

If CXF will try to me over-smart then the next day someone will report
that it started producing

"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"

Sergey
On 04/03/16 07:43, Volkov Sergey wrote:


Looks like POST request and @FormParam could be used, but I think this
behavior of @QueryParam may lead to tricky bugs in many places where it

used


2016-03-04 10:37 GMT+03:00 Volkov Sergey <[hidden email]

<http://cxf.547215.n5.nabble.com/user/SendEmail.jtp?type=node=5766616=0>>:





Yes, I don't understand why it does not touch this sequences.

It's a bit strange because I can successfully transfer "100%VALID

STRING"

but not "100%BETTER VALID STRING"

Both this string not percent encoded, but second contains %BE which

just

looks like percent encoded.

If instead of

org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded

cxf just urlencode parameter value when building query string both

examples

would be transferred correctly.




If you are saying that

when you pass something like "%D1%82", or to make it clearer,
"%D1" and expect CXF do "%25D1", then no, it won't work.
UriBuilder does not touch percent-encoded sequences %XX.

May be try building the query with UriBuilder before passing it to
the
proxy, something like

UriBuilder.fromUri("{a}%D21").build("%").toString()

Though not sure it will be cheaper.

Sergey

On 03/03/16 21:27, Sergey Beryozkin wrote:


   From the original post in this thread:



When I pass string "т" (Cyrillic symbol) to generated client in

encodes

to

"%D1%82" in url and decodes as "т" on server what is fine, but

when

i

pass

"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82"
and

decodes

also to "т".


I honestly don't get what the problem is. You pass a Cyrillic symbol
either as is or already percent encoded and in both case, as you say
above, you get this Cyrillic symbol.


















--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-04 Thread Sergey Beryozkin

As I said, CXF proxy runtime uses JAX-RS UriBuilder.

And UriBuilder does not touch valid percent-encoded representations.

And this is how the RS client runtime will continue operating.

Sergey



On 04/03/16 10:45, Volkov Sergey wrote:


"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"



"100%25BETTER VALID STRING" is correct way to urlencode "100%BETTER VALID
STRING" - so actually CXF is over-smart now, when it skips all %xx sequence
instead of encode % as %25

"100%VALID STRING" at the moment encodes by cxf as "100%25VALID STRING"



In the former case it it has no characters that can be used to form the
hex %-encoded representations.

The bottom line is, you should not expect the runtime auto-encode '%'
given that this symbol plays a special role in having correct URIs being
created.

If CXF will try to me over-smart then the next day someone will report
that it started producing

"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"

Sergey
On 04/03/16 07:43, Volkov Sergey wrote:


Looks like POST request and @FormParam could be used, but I think this
behavior of @QueryParam may lead to tricky bugs in many places where it

used


2016-03-04 10:37 GMT+03:00 Volkov Sergey <[hidden email]

<http://cxf.547215.n5.nabble.com/user/SendEmail.jtp?type=node=5766616=0>>:




Yes, I don't understand why it does not touch this sequences.

It's a bit strange because I can successfully transfer "100%VALID

STRING"

but not "100%BETTER VALID STRING"

Both this string not percent encoded, but second contains %BE which

just

looks like percent encoded.

If instead of

org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded

cxf just urlencode parameter value when building query string both

examples

would be transferred correctly.




If you are saying that

when you pass something like "%D1%82", or to make it clearer,
"%D1" and expect CXF do "%25D1", then no, it won't work.
UriBuilder does not touch percent-encoded sequences %XX.

May be try building the query with UriBuilder before passing it to the
proxy, something like

UriBuilder.fromUri("{a}%D21").build("%").toString()

Though not sure it will be cheaper.

Sergey

On 03/03/16 21:27, Sergey Beryozkin wrote:


   From the original post in this thread:



When I pass string "т" (Cyrillic symbol) to generated client in

encodes

to

"%D1%82" in url and decodes as "т" on server what is fine, but

when

i

pass

"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82" and

decodes

also to "т".


I honestly don't get what the problem is. You pass a Cyrillic symbol
either as is or already percent encoded and in both case, as you say
above, you get this Cyrillic symbol.















--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-04 Thread Sergey Beryozkin
In the former case it it has no characters that can be used to form the 
hex %-encoded representations.


The bottom line is, you should not expect the runtime auto-encode '%' 
given that this symbol plays a special role in having correct URIs being 
created.


If CXF will try to me over-smart then the next day someone will report 
that it started producing


"100%25BETTER VALID STRING"

instead of

"100%BETTER VALID STRING"

Sergey
On 04/03/16 07:43, Volkov Sergey wrote:

Looks like POST request and @FormParam could be used, but I think this
behavior of @QueryParam may lead to tricky bugs in many places where it used

2016-03-04 10:37 GMT+03:00 Volkov Sergey <sergey.volko...@gmail.com>:


Yes, I don't understand why it does not touch this sequences.

It's a bit strange because I can successfully transfer "100%VALID STRING"
but not "100%BETTER VALID STRING"

Both this string not percent encoded, but second contains %BE which just
looks like percent encoded.

If instead of org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded
cxf just urlencode parameter value when building query string both examples
would be transferred correctly.




If you are saying that

when you pass something like "%D1%82", or to make it clearer,
"%D1" and expect CXF do "%25D1", then no, it won't work.
UriBuilder does not touch percent-encoded sequences %XX.

May be try building the query with UriBuilder before passing it to the
proxy, something like

UriBuilder.fromUri("{a}%D21").build("%").toString()

Though not sure it will be cheaper.

Sergey

On 03/03/16 21:27, Sergey Beryozkin wrote:


  From the original post in this thread:



When I pass string "т" (Cyrillic symbol) to generated client in

encodes

to

"%D1%82" in url and decodes as "т" on server what is fine, but when

i

pass

"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82" and

decodes

also to "т".


I honestly don't get what the problem is. You pass a Cyrillic symbol
either as is or already percent encoded and in both case, as you say
above, you get this Cyrillic symbol.











--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-03 Thread Sergey Beryozkin

If you are saying that

when you pass something like "%D1%82", or to make it clearer,
"%D1" and expect CXF do "%25D1", then no, it won't work.
UriBuilder does not touch percent-encoded sequences %XX.

May be try building the query with UriBuilder before passing it to the 
proxy, something like


UriBuilder.fromUri("{a}%D21").build("%").toString()

Though not sure it will be cheaper.

Sergey

On 03/03/16 21:27, Sergey Beryozkin wrote:

 From the original post in this thread:



When I pass string "т" (Cyrillic symbol) to generated client in

encodes

to

"%D1%82" in url and decodes as "т" on server what is fine, but when i

pass

"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82" and

decodes

also to "т".


I honestly don't get what the problem is. You pass a Cyrillic symbol
either as is or already percent encoded and in both case, as you say
above, you get this Cyrillic symbol.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-03 Thread Sergey Beryozkin

I am a bit confused.

If you pass

"%25D1%2582" and have @Encoded then you will have
"%25D1%2582" made available to the service.

Sergey
On 03/03/16 18:09, Volkov Sergey wrote:

So currently there no way to pass both Cyrillic "т" as "т" (coded as
"%D1%82" in url ) and "%D1%82" as "%D1%82" (coded as "%25D1%2582") from
client to server using proxy?
Should I create issue about that?

2016-03-03 20:52 GMT+03:00 Sergey Volkov <ser...@yandex-team.ru>:


if you use Http centric API then indeed you can have @Encode
on service interfaces but pass %D1%82 directly to 2.0 Client API or
WebClient.

If you have a proxy: it actually does not do @Encode processing either -
the reason is that it is irrelevant for the proxy, it uses
UriBuilder.buildFromEncoded() and must make sure the URI is correctly
built. If it sees %-encoded values it does not touch them, otherwise it
will encode them if needed. @Encoded is really for the server - as the
processing requirements may require the value being either decoded or
encoded.

So adding @Encoded to the interface should do it...

Sergey
On 03/03/16 15:43, Volkov Sergey wrote:


Hi!

There was issue https://issues.apache.org/jira/browse/CXF-6122 that +

was

not working in QueryParam

I have quite similar issue - but I can't pass percent encoded string in
query params:

When I pass string "т" (Cyrillic symbol) to generated client in encodes

to

"%D1%82" in url and decodes as "т" on server what is fine, but when i

pass

"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82" and

decodes

also to "т".
As far as I see this happens because
org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded don't encode
characters that looks like percent encoded.

Is it bug?

Is there any way to transfer %D1%82 trough @QueryParam?
There is annotation javax.ws.rs.Encoded which as said in javadoc prevent
@QueryParams from encoding, but with in that case I have to encode it
manually in all places where generated method is used.





--
Сергей Волков
serg-v@







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Percent encoded string in @QueryParam

2016-03-03 Thread Sergey Beryozkin

if you use Http centric API then indeed you can have @Encode
on service interfaces but pass %D1%82 directly to 2.0 Client API or 
WebClient.


If you have a proxy: it actually does not do @Encode processing either - 
the reason is that it is irrelevant for the proxy, it uses 
UriBuilder.buildFromEncoded() and must make sure the URI is correctly 
built. If it sees %-encoded values it does not touch them, otherwise it 
will encode them if needed. @Encoded is really for the server - as the 
processing requirements may require the value being either decoded or 
encoded.


So adding @Encoded to the interface should do it...

Sergey
On 03/03/16 15:43, Volkov Sergey wrote:

Hi!

There was issue https://issues.apache.org/jira/browse/CXF-6122 that + was
not working in QueryParam

I have quite similar issue - but I can't pass percent encoded string in
query params:

When I pass string "т" (Cyrillic symbol) to generated client in encodes to
"%D1%82" in url and decodes as "т" on server what is fine, but when i pass
"%D1%82" rather then "%25D1%2582" in encodes also to "%D1%82" and decodes
also to "т".
As far as I see this happens because
org.apache.cxf.jaxrs.utils.HttpUtils#encodePartiallyEncoded don't encode
characters that looks like percent encoded.

Is it bug?

Is there any way to transfer %D1%82 trough @QueryParam?
There is annotation javax.ws.rs.Encoded which as said in javadoc prevent
@QueryParams from encoding, but with in that case I have to encode it
manually in all places where generated method is used.






Re: Asking for comments about cxf-rs with oneway jms transport

2016-03-01 Thread Sergey Beryozkin

Hi Tobi

Using CXFRS client with JMS is indeed uncommon with the main reason 
being is that of course CXFRS is primarily meant to work with the HTTP 
targets.


But with CXF being so flexible it ended up supporting non-HTTP targets 
too with some minor updates.


So, ultimately, as far as the task of delivering a message over JMS is 
concerned, one has a choice to use JMS directly. Or, with CXF, use 
either SOAP (not unusual) or as in this case RS clients - where the 
client works with an Http centric API but ends up sending a message over 
JMS.


If you use the RS proxies (as opposed to WebClient) then it will be less 
obvious what transport is being used, and can be a reasonable compromise 
as far as the 'mis-use' of the API is concerned


Thanks, Sergey

On 01/03/16 13:47, Tobias Schöneberg wrote:

Hi,
this morning I created this issue (which is already solved, thx again): 
https://issues.apache.org/jira/browse/CXF-6810.

Note that in a comment, Sergey Beryozkin writes
"So now we have WebClient and proxies being able to use HTTP Api to send the 
messages over JMS which is unusual ;-)"

Because I'm new to cxf, I would like to ask the community whether they think 
I'm on the right track with my approach.

My usage scenario is that I have a "frontend" web-UI server running in the 
cloud, that needs to exchange data with the backend ERP system.
The internet link between those two is known to be a bit shaky.

Now, what i had in mind for the solution is to run one jms-broker on the web-UI 
server and one near the ERP system.
Those two brokers shall forward messages between each other and communicate via 
ssl.

Both the web-UI and the ERP-system shall provide some services via cxf-rs.
Also, they both share the same service-interfaces and serializable POJOs.
The respective clients shall be able to make the invocation one-way, i.e. 
without having to wait for a result.
They just shall obtain a client-proxy and make their call. The call shall 
directly return with a (http-)result of 202, as described here in the docs: 
http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-Onewayinvocations.

If the internet link is currently down, that's not the client's problem, but 
the two brokers need to retry and reestablish their connection.
I think that if i used the http-transport, the client would have to check the 
if the request worked and explcityl retry if not.

Note that if the server-endpoint of the other party can't process the message 
for whatever reason, it's also not the client's problem,
but the server-endpoint needs to store the unprocessable message and notify 
someone about the problem.

I think that my scenario is not that uncommon, but aparently using 
cxf-oneway-jms is uncommon.
So I wonder, is this a reasonable approach? Does cxf provide better tools for 
this? Or maybe cxf is generally used for scenarios different than this one.?

Best regards
Tobi





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Registering a message body reader

2016-02-26 Thread Sergey Beryozkin

Hi Benson

WebClient.create(address, Collections.singletonList(new MyProvider()))

you can also inject WebClient as jaxrs:client (set 
serviceClass="org.apache.cxf.jaxrs.client.WebClient") - in this case you 
can have jaxrs:client/@basePackages set to some package starting from 
which Spring will attempt to auto-discover it - though no way to do it 
with Blueprint just yet


Cheers, Sergey

On 26/02/16 20:03, Benson Margulies wrote:

We have our very own, registered, content type:

model/vnd.rosette.annotated-data-model

How do I teach the CXF WebClient to call some class of ours when
confronted with it?

(It's really just json in disguise.)




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: JAX-RS CookieHeaderProvider with httpOnly cookie doesn't work

2016-02-24 Thread Sergey Beryozkin

Hi

Yes, you send a NewCookie but attempt to read it later on as Cookie.
You should use NewCookie.valueOf(newCookieValue) to recreate it.

Can you please use one of Cookie constructors to convert NewCookie to 
Cookie ?


Or simply take the relevant value from this new cookie and send the name 
and value only which is what is expected really by the Cookie receiver.


Sergey
On 24/02/16 17:58, cc75005++ wrote:

Sorry, now I understand your question.. please find,I think, the bad code
that I use to create a new webclient to make the request :




Thanks for your time





--
View this message in context: 
http://cxf.547215.n5.nabble.com/JAX-RS-CookieHeaderProvider-with-httpOnly-cookie-doesn-t-work-tp5766083p5766290.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: No support for FailoverFeature in CXF Rest Client implementation (version 3.1.0)

2016-02-24 Thread Sergey Beryozkin

Hi

Please create a CXF JIRA issue, not sure how to qualify it, 'Task' I 
guess. As I said though it is unlikely to be addressed in the short term 
unless one of colleagues or yourself will look at it.


Cheers, Sergey

On 24/02/16 16:36, ranadeep.sha...@gmail.com wrote:

Hi Sergey,

Thanks for the reply.

Is there any place where I can raise a request for this feature
implementation ?
That way, I believe all CXF consumers including myself can keep a track of
it.

Regards,
Ranadeep.



--
View this message in context: 
http://cxf.547215.n5.nabble.com/No-support-for-FailoverFeature-in-CXF-Rest-Client-implementation-version-3-1-0-tp5765813p5766277.html
Sent from the cxf-user mailing list archive at Nabble.com.





Re: Proxy-based API genaration (two or more interaces)

2016-02-24 Thread Sergey Beryozkin

Hi
On 24/02/16 13:42, Vjacheslav V. Borisov wrote:

Hi!

Currently it is possible to write server side resource implementing two
interfaces at the same time

Eg,.

public class SomeResource implements OneResourceInterface,
TwoResourceInterface

does it possible to generate Proxy-based client based on more that one
interface?

http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Proxy-basedAPI

Currently I am see only possibility to generate two ProxyBased client
interfaces an combine them in client side?

  in class like
public class SomeResourceClient implements OneResourceInterface,
TwoResourceInterface

Yes, this is how it can be done, please make sure cglib-nodep dependency 
is on the classpath


Cheers, Sergey

--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: No support for FailoverFeature in CXF Rest Client implementation (version 3.1.0)

2016-02-24 Thread Sergey Beryozkin

Hi Ranadeep,

On 24/02/16 01:35, ranadeep.sha...@gmail.com wrote:

Hi Sergey,

Thanks for the response. We have a requirement where we are planning to
preserve the usage of standard API going forward so that the functionality
is not impacted, no matter what the underlying implementation is.
I have some follow-up questions, below.

1) Is there any roadmap of releasing a future version of CXF Clustering
with full support for JAX-RS 2.0 API including the Failover retry features.
If so, when can we expect that to happen?


No specific work is being planned, but I suppose that can be done 
eventually.



2) Is the CXF implementation of Failover Retry (for both SOAP client and
REST client) thread-safe?


I haven't seen any thread-safety related issues reported so far

Cheers, Sergey


Regards,
Ranadeep.

Regards,
Ranadeep.

On Wed, Feb 10, 2016 at 5:42 PM, Sergey Beryozkin [via CXF] <
ml-node+s547215n5765816...@n5.nabble.com> wrote:


JAX-RS 2.0 API does not work with a CXF specific failover feature,
definitely not something I've had a chance to look into.
We'd need to create a JAX-RS 2.0 Feature wrapper but what is the point
of such a JAX-RS Feature can not be portable.

Consider using WebClient with FailoverFeature.

Sergey


On 10/02/16 21:57, [hidden email]
<http:///user/SendEmail.jtp?type=node=5765816=0> wrote:


I had tried some heavy exploration on enabling Failover feature, as per
documentation provided by Apache CXF. While the one for SOAP client

works

like a charm, the other one for REST client is not so with the way I am
trying to instantiate the client. My requirement of instantiating the

REST

client is via JAXRS 2.0.1 API, as shown in following sample code.NOTE :

The

following endpoint URL is a valid one, except that the port number has

been

switched from 8080 (working one) to 8081 (non-working one), since I need

to

simulate the invocation failure retry behavior.Client client =
ClientBuilder.newClient(); WebTarget target =
client.target("http://localhost:8081/my-app/ws/ers/customers;);
Invocation.Builder builder =
target.request(MediaType.APPLICATION_JSON_TYPE); Response response =
builder.get();I have found that the Failover feature is not working when

the

above last line of code is invoked.Now, here comes the interesting part.

I

have found only 2 classes in cxf-rt-rs-client-3.1.0-sources.jar where

the

initialization of Failover feature in a
org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean instance happens. And

my

requirement is to have one of these methods (or, a similar one where
bean.setFeatures(features) is invoked ) being called.Method in
org.apache.cxf.jaxrs.client.JAXRSClientFactory class.public static  T
create(String baseAddress,Class cls, List
providers,   List features,
String configLocation) {JAXRSClientFactoryBean bean =
getBean(baseAddress, cls, configLocation);

  bean.setProviders(providers);

bean.setFeatures(features);return bean.create(cls);}Method in
org.apache.cxf.jaxrs.client.WebClient class.public static WebClient
create(String baseAddress,List providers,
List features,   String
configLocation) {JAXRSClientFactoryBean bean = getBean(baseAddress,
configLocation);bean.setProviders(providers);
bean.setFeatures(features);return bean.createWebClient();}However,

when

my custom client code above is executed, neither of the above 2 methods

have

been invoked. Instead, the following method in
org.apache.cxf.jaxrs.client.spec.ClientImpl is invoked.private void
initTargetClientIfNeeded() {URI uri = this.uriBuilder.build(new
Object[0]);if(this.targetClient == null) {

  JAXRSClientFactoryBean

bean = new JAXRSClientFactoryBean();

  bean.setAddress(uri.toString());

this.targetClient = bean.createWebClient();
ClientImpl.this.baseClients.add(this.targetClient);} else
if(!this.targetClient.getCurrentURI().equals(uri)) {
this.targetClient.to(uri.toString(), false);} }Does this imply that
Failover Feature is NOT supported for CXF version 3.1.0 ?If so, which
upcoming version of CXF will support my above requirement ?



--
View this message in context:

http://cxf.547215.n5.nabble.com/No-support-for-FailoverFeature-in-CXF-Rest-Client-implementation-version-3-1-0-tp5765813.html

Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


--
If you reply to this email, your message will be added to the discussion
below:

http://cxf.547215.n5.nabble.com/No-support-for-FailoverFeature-in-CXF-Rest-Client-implementation-version-3-1-0-tp5765813p5765816.html
To unsubscribe from No support for FailoverFeature in CXF Rest Client
implementation (version 3.1.0), click here
<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=5765813=cmFuYWRlZXAuc2hhcm1hQGdtYWlsLmNvbXw1NzY1ODEzfC0xOTAyNzcwMDYz

Re: NullPointerException in OAuthRequestFilter

2016-02-24 Thread Sergey Beryozkin

Hi

Thanks for being so appreciative, but I'm only trying to provide 
whatever info I can, we work with all the users this way :-)


I honestly do not know where are you getting these dependencies from. 
And if you wish to run your application in Glassfish you do not have to 
start going the embedded Jetty route, simply create a war, and in 
web.xml - declare CXFNonSpringJaxrsServlet and register your custom 
JAX-RS Application with it, something like this:


https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml#L122

HTH, Sergey
On 24/02/16 01:04, LaVloZ . wrote:

Hii,
Thank you again for your time, i tried to use JAXRSServerFactoryBean to
create a new JAX-RS server so i added it Jetty transport jar to my maven,
but CXF seems to need Google Guava and Glassfish HK2, so i got some
exceptions in the first time until i added manualy Guava and HK2 in maven,
why CXF doesn't declare these two dependencies althought it need them?

Thank you again and again, very nice from you for the support :)

2016-02-23 19:13 GMT+01:00 Sergey Beryozkin <sberyoz...@gmail.com>:


Hi, in most cases you'd like to configure it somehow, so may be try to
create JAX-RS Applications where it is all configured in the code and
register these applications with CXFNonSpringJaxrsServlet

Sergey

On 23/02/16 18:08, LaVloZ . wrote:


Hi,
Thank you for your time :), i have a little question, i see that the doc
uses Spring, can we use CXF and OAuth implementation totaly without
Spring?? :)

Thanks

2016-02-23 10:33 GMT+01:00 Sergey Beryozkin <sberyoz...@gmail.com>:

Hi,

well, Jersey is of course a quality JAX-RS RI, but indeed, given its
close
integration with Glassfish, those users who may want to run CXF JAX-RS
with
Glassfish will need to experiment and try to disable Jersey somehow :-)

Sergey

On 22/02/16 22:04, LaVloZ . wrote:

I didn't recieve an anwser mail for my original question so i resent the

same question, then i saw your answer in my SO :)
And as you said, Jersey is the problem, you have saved us alots of time.

Thank you so much :)

2016-02-22 18:35 GMT+01:00 Sergey Beryozkin <sberyoz...@gmail.com>:

Hi


I replied to your original question a week or so ago, can you please
check
it ?

Jersey is loaded is there so I think you may need to disable it somehow

Thanks, Sergey

On 22/02/16 17:24, LaVloZ . wrote:

Hello all



i have more than one week tryign to figure out the problem, but i
didn't
find it, googling, stackoverflow ..., but nothing.

The problem is that the web services work fine but when i add the jar
for
OAuth support using Maven i get NullPointerException raised inside
OAuthRequestFilter :

this is the link of the line on GitHub :




https://github.com/apache/cxf/blob/7d1890510a85d4fd7e70faebc56d6685f103621d/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java#L82

That JAXRSUtils.getCurrentMessage() returns null reference so that
null
cuz
a NullPointerException latter in code.

i'm using CXF 3.1.5 and tried it on Glassfish 4.1.1 and TomEE 7.0.63
on
Oracle JDK 1.8.0_66

Thank you all.



--

Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/











--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/







Re: JAX-RS CookieHeaderProvider with httpOnly cookie doesn't work

2016-02-23 Thread Sergey Beryozkin

Hi

I'm sorry I still do not understand.
Cookie header (as opposed to Set-Cookie) is not supposed to include 
HttpOnly, this is why I'm curious, how does this Cookie header ends up 
with HttpOnly ?


Thanks, Sergey
On 23/02/16 20:46, cc75005++ wrote:

Hi Sergey,

Thank you for your response.

In fact the httpOnly flag is done by my authentification rest service that
use NewCookie object.

So the question should be "how can I have access to a NewCookie object in my
ContainerRequestFilter ?
or maybe I've to use another class to filter my request ?

regards



--
View this message in context: 
http://cxf.547215.n5.nabble.com/JAX-RS-CookieHeaderProvider-with-httpOnly-cookie-doesn-t-work-tp5766083p5766231.html
Sent from the cxf-user mailing list archive at Nabble.com.





Re: NullPointerException in OAuthRequestFilter

2016-02-23 Thread Sergey Beryozkin
Hi, in most cases you'd like to configure it somehow, so may be try to 
create JAX-RS Applications where it is all configured in the code and 
register these applications with CXFNonSpringJaxrsServlet


Sergey
On 23/02/16 18:08, LaVloZ . wrote:

Hi,
Thank you for your time :), i have a little question, i see that the doc
uses Spring, can we use CXF and OAuth implementation totaly without
Spring?? :)

Thanks

2016-02-23 10:33 GMT+01:00 Sergey Beryozkin <sberyoz...@gmail.com>:


Hi,
well, Jersey is of course a quality JAX-RS RI, but indeed, given its close
integration with Glassfish, those users who may want to run CXF JAX-RS with
Glassfish will need to experiment and try to disable Jersey somehow :-)

Sergey

On 22/02/16 22:04, LaVloZ . wrote:


I didn't recieve an anwser mail for my original question so i resent the
same question, then i saw your answer in my SO :)
And as you said, Jersey is the problem, you have saved us alots of time.

Thank you so much :)

2016-02-22 18:35 GMT+01:00 Sergey Beryozkin <sberyoz...@gmail.com>:

Hi

I replied to your original question a week or so ago, can you please
check
it ?

Jersey is loaded is there so I think you may need to disable it somehow

Thanks, Sergey

On 22/02/16 17:24, LaVloZ . wrote:

Hello all


i have more than one week tryign to figure out the problem, but i didn't
find it, googling, stackoverflow ..., but nothing.

The problem is that the web services work fine but when i add the jar
for
OAuth support using Maven i get NullPointerException raised inside
OAuthRequestFilter :

this is the link of the line on GitHub :



https://github.com/apache/cxf/blob/7d1890510a85d4fd7e70faebc56d6685f103621d/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java#L82

That JAXRSUtils.getCurrentMessage() returns null reference so that null
cuz
a NullPointerException latter in code.

i'm using CXF 3.1.5 and tried it on Glassfish 4.1.1 and TomEE 7.0.63 on
Oracle JDK 1.8.0_66

Thank you all.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/











--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Adding NCSARequestLog via JAXRSServerFactoryBean

2016-02-23 Thread Sergey Beryozkin

Hi

This is a fragment from a test:

ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(new String[] 
{"/org/apache/cxf/jaxrs/spring/servers2.xml"});


Object serverBean = ctx.getBean("server1");
assertNotNull(serverBean);
JAXRSServerFactoryBean factoryBean = 
(JAXRSServerFactoryBean)serverBean;


where 'server1' is a jaxrs:server id

and then it is only

factoryBean.create().

HTH, Sergey

On 23/02/16 13:00, matthew.pres...@thomsonreuters.com wrote:

Sorry if this question is trivial, but if I use that configuration, where do I 
put the xml and how do I need to change my code to launch the server?

Thanks,
Matt

-Original Message-
From: Freeman Fang [mailto:freeman.f...@gmail.com]
Sent: 23 February 2016 12:34
To: users@cxf.apache.org
Subject: Re: Adding NCSARequestLog via JAXRSServerFactoryBean

Yeah, the configuration way works, something like

  
   

  


 
 
 
On Feb 23, 2016, at 8:13 PM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:

Hi

I guess you may want to write a Jetty specific code directly, may be as in this 
demo server:

https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache
_cxf_blob_master_distribution_src_main_release_samples_jax-5Frs_search
_src_main_java_demo_jaxrs_search_server_Server.java=CwIFaQ=4ZIZThy
kDLcoWk-GVjSLm9hvvvzvGv0FLoWSRuCSs5Q=ykXcTN60h3-cXsX5t7kv8zVQwTSxpeA
xKWimPUn10ALTg1Uk6Ao2R1mxc0lzB5Ia=tCDKXnNyVwy8AwK0XtEPUZjGzz6XSLoDWQ
YbA4oG-NM=_0kGFcXUU-GIcEYu72VvjMaJimjoof7nCUjyHemzUUA=

Not sure how to do it with the code below, may be

Server server = sf.create()

and then get a Bus from it, and then

DestinationRegistry reg = bus.getExtension(DestinationRegistry.class)

and then get JettyHttpDestination and then somehow add a new handler to it...

Finally, may be you can create an httpj element and jaxrs:endpoint in 
Spring/Blueprint and activate the context:
https://urldefense.proofpoint.com/v2/url?u=http-3A__cxf.apache.org_doc
s_jetty-2Dconfiguration.html=CwIFaQ=4ZIZThykDLcoWk-GVjSLm9hvvvzvGv
0FLoWSRuCSs5Q=ykXcTN60h3-cXsX5t7kv8zVQwTSxpeAxKWimPUn10ALTg1Uk6Ao2R1
mxc0lzB5Ia=tCDKXnNyVwy8AwK0XtEPUZjGzz6XSLoDWQYbA4oG-NM=9K8w1aY1JRY
xpRo7sg1V3BcTWkVKZyB7dLLFMi1MZCw=

HTH, Sergey

On 23/02/16 11:56, matthew.pres...@thomsonreuters.com wrote:

Hi,



I'm using cxf to start a simple JAX-RS server using the following code (from 
the documentation):



JAXRSServerFactoryBean  sf = new JAXRSServerFactoryBean();

sf.setResourceClasses(clazz);

sf.setResourceProvider(clazz, new SingletonResourceProvider(this));

sf.setAddress("https://urldefense.proofpoint.com/v2/url?u=http-3A__lo
calhost-3A5000=CwIFaQ=4ZIZThykDLcoWk-GVjSLm9hvvvzvGv0FLoWSRuCSs5Q
=ykXcTN60h3-cXsX5t7kv8zVQwTSxpeAxKWimPUn10ALTg1Uk6Ao2R1mxc0lzB5Ia
=tCDKXnNyVwy8AwK0XtEPUZjGzz6XSLoDWQYbA4oG-NM=MN2PXIbv9RImP4of7wb92Q
3p7Mr6N-Zmk7nDaMryD8k= ");

sf.create();



How can I modify this code to add an NCSARequestLog to the embedded jetty 
instance?  Is this possible?



Thanks,

Matt




This e-mail is for the sole use of the intended recipient and
contains information that may be privileged and/or confidential. If
you are not an intended recipient, please notify the sender by return e-mail and 
delete this e-mail and any attachments. Certain required legal entity disclosures can 
be accessed on our website.<http://site.thomsonreuters.com/site/disclosures/>






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Adding NCSARequestLog via JAXRSServerFactoryBean

2016-02-23 Thread Sergey Beryozkin

Hi

I guess you may want to write a Jetty specific code directly, may be as 
in this demo server:


https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Server.java

Not sure how to do it with the code below,
may be

Server server = sf.create()

and then get a Bus from it, and then

DestinationRegistry reg = bus.getExtension(DestinationRegistry.class)

and then get JettyHttpDestination and then somehow add a new handler to 
it...


Finally, may be you can create an httpj element and jaxrs:endpoint in 
Spring/Blueprint and activate the context:

http://cxf.apache.org/docs/jetty-configuration.html

HTH, Sergey

On 23/02/16 11:56, matthew.pres...@thomsonreuters.com wrote:

Hi,



I'm using cxf to start a simple JAX-RS server using the following code (from 
the documentation):



JAXRSServerFactoryBean  sf = new JAXRSServerFactoryBean();

sf.setResourceClasses(clazz);

sf.setResourceProvider(clazz, new SingletonResourceProvider(this));

sf.setAddress("http://localhost:5000;);

sf.create();



How can I modify this code to add an NCSARequestLog to the embedded jetty 
instance?  Is this possible?



Thanks,

Matt




This e-mail is for the sole use of the intended recipient and contains information 
that may be privileged and/or confidential. If you are not an intended recipient, 
please notify the sender by return e-mail and delete this e-mail and any attachments. 
Certain required legal entity disclosures can be accessed on our 
website.





Re: Support both Bearer and JWT tokens

2016-02-23 Thread Sergey Beryozkin

On 23/02/16 10:27, Sergey Beryozkin wrote:

Hi
On 23/02/16 07:24, Rajan1311 wrote:

Hi Sergey,

I think I have understood what you mean, so the JWT has nothing to do
with
the OAuth flows.


I did not quite imply that JWT was not related to OAuth flows, rather I
said the JWTAuthenticationFilter you were thinking of using was not
related.


Or to be more precise, it can be used as a filter for authenticating the 
OAuth2 clients but only when these clients use JWT for a pure 
authentication when accessing OAuth2 AccessTokenService, example, when 
using a client credentials or authorization code grant...


Sergey



In my case though, when a client server needs access to my API, he
does so
with the access token obtained via the client credentials grant. Each
token
(default bearer type) has registered scopes which govern the parts of the
API the client can access. According to the documentation, its the
OAuthRequestFilter and OAuthScopesFilter that make this restriction
happen.
I am using the @Scopes annotation my controllers.


Sure, you might also want to consider using OAuthRequestFilter only with
the requiredScopes property set, unless you'd like to enforce the scopes
declaratively on per-method level

Now, the Client can also make requests with a JWT(issued by the client's
server). The client signs the JWT with their client secret and sends
me (API
server) the JWT along with the client id (so that I can verify it with
the
corresponding secret). The JWT claims has a list of scopes along with
some
other identification info.

This is where I need some sort of convergence between the 2 flows. Once I
have the scopes, I want to process them in such a way that I use the
scopes
in the access token (via client credentials).

So, for this to happen, I think I would need some sort of modification
in my
OAuthRequestFilter, which would also accept JWT tokens, validate them and
extract the scopes. Then, it should work seamlessly work with the
OAuthScopesFilter.

I hope you understood what I mean. I am very new to this, so would be
great
if you could just point me in the right direction. I am thinking of
implementing a custom Filter to replace the OAuthRequestFilter, but I
am not
too sure on how to proceed.


Hmm, well, the client gets the access token from OAuth2 Access Token
Service, and then the client uses this token to access some users' API
server.
But what you are describing is that the client creates a JWT token
itself (may be it gets this token from  STS such as CXF STS that can
issue JWT assertions), sets a client id on it and then wants to use it
as an access token ?

if so then I don't think it is possible, all the client has is a set of
JWT claims representing the fact of the successful client authentication
with STS/etc, and by adding a client id to such claims does not turn
them into an access token, but the client can use them to claim a new
access token and then use it.

Cheers, Sergey







Thanks and Regards,

Rajan





--
View this message in context:
http://cxf.547215.n5.nabble.com/Support-both-Bearer-and-JWT-tokens-tp5766050p5766172.html

Sent from the cxf-user mailing list archive at Nabble.com.







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Support both Bearer and JWT tokens

2016-02-23 Thread Sergey Beryozkin

Hi
On 23/02/16 07:24, Rajan1311 wrote:

Hi Sergey,

I think I have understood what you mean, so the JWT has nothing to do with
the OAuth flows.

I did not quite imply that JWT was not related to OAuth flows, rather I 
said the JWTAuthenticationFilter you were thinking of using was not related.



In my case though, when a client server needs access to my API, he does so
with the access token obtained via the client credentials grant. Each token
(default bearer type) has registered scopes which govern the parts of the
API the client can access. According to the documentation, its the
OAuthRequestFilter and OAuthScopesFilter that make this restriction happen.
I am using the @Scopes annotation my controllers.

Sure, you might also want to consider using OAuthRequestFilter only with 
the requiredScopes property set, unless you'd like to enforce the scopes 
declaratively on per-method level

Now, the Client can also make requests with a JWT(issued by the client's
server). The client signs the JWT with their client secret and sends me (API
server) the JWT along with the client id (so that I can verify it with the
corresponding secret). The JWT claims has a list of scopes along with some
other identification info.

This is where I need some sort of convergence between the 2 flows. Once I
have the scopes, I want to process them in such a way that I use the scopes
in the access token (via client credentials).

So, for this to happen, I think I would need some sort of modification in my
OAuthRequestFilter, which would also accept JWT tokens, validate them and
extract the scopes. Then, it should work seamlessly work with the
OAuthScopesFilter.

I hope you understood what I mean. I am very new to this, so would be great
if you could just point me in the right direction. I am thinking of
implementing a custom Filter to replace the OAuthRequestFilter, but I am not
too sure on how to proceed.


Hmm, well, the client gets the access token from OAuth2 Access Token 
Service, and then the client uses this token to access some users' API 
server.
But what you are describing is that the client creates a JWT token 
itself (may be it gets this token from  STS such as CXF STS that can 
issue JWT assertions), sets a client id on it and then wants to use it 
as an access token ?


if so then I don't think it is possible, all the client has is a set of 
JWT claims representing the fact of the successful client authentication 
with STS/etc, and by adding a client id to such claims does not turn 
them into an access token, but the client can use them to claim a new 
access token and then use it.


Cheers, Sergey







Thanks and Regards,

Rajan





--
View this message in context: 
http://cxf.547215.n5.nabble.com/Support-both-Bearer-and-JWT-tokens-tp5766050p5766172.html
Sent from the cxf-user mailing list archive at Nabble.com.






Re: NullPointerException in OAuthRequestFilter

2016-02-23 Thread Sergey Beryozkin

Hi,
well, Jersey is of course a quality JAX-RS RI, but indeed, given its 
close integration with Glassfish, those users who may want to run CXF 
JAX-RS with Glassfish will need to experiment and try to disable Jersey 
somehow :-)


Sergey
On 22/02/16 22:04, LaVloZ . wrote:

I didn't recieve an anwser mail for my original question so i resent the
same question, then i saw your answer in my SO :)
And as you said, Jersey is the problem, you have saved us alots of time.

Thank you so much :)

2016-02-22 18:35 GMT+01:00 Sergey Beryozkin <sberyoz...@gmail.com>:


Hi
I replied to your original question a week or so ago, can you please check
it ?

Jersey is loaded is there so I think you may need to disable it somehow

Thanks, Sergey

On 22/02/16 17:24, LaVloZ . wrote:


Hello all

i have more than one week tryign to figure out the problem, but i didn't
find it, googling, stackoverflow ..., but nothing.

The problem is that the web services work fine but when i add the jar for
OAuth support using Maven i get NullPointerException raised inside
OAuthRequestFilter :

this is the link of the line on GitHub :


https://github.com/apache/cxf/blob/7d1890510a85d4fd7e70faebc56d6685f103621d/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java#L82

That JAXRSUtils.getCurrentMessage() returns null reference so that null
cuz
a NullPointerException latter in code.

i'm using CXF 3.1.5 and tried it on Glassfish 4.1.1 and TomEE 7.0.63 on
Oracle JDK 1.8.0_66

Thank you all.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/







Re: conflicts with the registered path

2016-02-22 Thread Sergey Beryozkin
Not really - can you debug JettyHTTPServerEngine and check if this 
property is actually recognized at runtime.
FYI, I'm only assuming that update I was referring to is relevant, might 
not be.

So start with confirming this property is indeed seen as being set, in
JettyHTTPServerEngine.shouldCheckUrl().

Cheers, Sergey

On 22/02/16 18:09, ravi473 wrote:

Thanks for reply . I have added the system property as you suggest but there
is no difference  .Can you please suggest me if have any other way to get
out of the problem.

Cheers,
ravi



--
View this message in context: 
http://cxf.547215.n5.nabble.com/conflicts-with-the-registered-path-tp5766073p5766158.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: NullPointerException in OAuthRequestFilter

2016-02-22 Thread Sergey Beryozkin

Hi
I replied to your original question a week or so ago, can you please 
check it ?


Jersey is loaded is there so I think you may need to disable it somehow

Thanks, Sergey
On 22/02/16 17:24, LaVloZ . wrote:

Hello all

i have more than one week tryign to figure out the problem, but i didn't
find it, googling, stackoverflow ..., but nothing.

The problem is that the web services work fine but when i add the jar for
OAuth support using Maven i get NullPointerException raised inside
OAuthRequestFilter :

this is the link of the line on GitHub :

https://github.com/apache/cxf/blob/7d1890510a85d4fd7e70faebc56d6685f103621d/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java#L82

That JAXRSUtils.getCurrentMessage() returns null reference so that null cuz
a NullPointerException latter in code.

i'm using CXF 3.1.5 and tried it on Glassfish 4.1.1 and TomEE 7.0.63 on
Oracle JDK 1.8.0_66

Thank you all.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: conflicts with the registered path

2016-02-22 Thread Sergey Beryozkin

Hi

I recall there was some work added to avoid some side-effects related to 
running multiple CXF Jetty endpoint on the overlapping paths, but then 
it caused issues for some existing deployments (like yours) so a  property


"org.apache.cxf.transports.http_jetty.DontCheckUrl" was added.
It can be set to 'true' as a system or bus property. Try it please

Sergey
On 19/02/16 21:46, ravi473 wrote:

We are starting multiple web service endpoints with same base name using code
below. For instance, http://localhost:9001/org/dep and
http://localhost:9001/org/dep/manage . It used to work till 2.1.7. After we
upgraded CXF to 3.1.4 and it is failing with below exception .

Caused by: org.apache.cxf.interceptor.Fault: Could not add cxf jetty handler
for url http://localhost:8585/rs/jde/jxml to Jetty server, as the path
/rs/jde/jxml is still in use.
at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.checkRegistedContext(JettyHTTPServerEngine.java:317)
at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:386)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:175)
at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:53)
at
org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:95)
at
org.apache.cxf.jaxrs.JAXRSBindingFactory.addListener(JAXRSBindingFactory.java:88)
at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:123)
at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:206)




--
View this message in context: 
http://cxf.547215.n5.nabble.com/conflicts-with-the-registered-path-tp5766073.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: JAX-RS CookieHeaderProvider with httpOnly cookie doesn't work

2016-02-22 Thread Sergey Beryozkin

Hi

Can Cookie contain an attribute such as HttpOnly ? I'm not sure. 
NewCookie has an isHttpOnly method - but not Cookie.


How is Set-Cookie processed on the client side ? By a browser or somehow 
else ? I'm curious how HttpOnly is added to Cookie.



I guess if you have a Cookie with unsupported properties then the clean 
workaround is to access Cookie header directly,

with
requestContext.getHeaders().getFirst("Cookie");

and then do a manual parsing

Thanks, Sergey

On 20/02/16 22:24, cc75005++ wrote:

Hello,

With Tomee 7.00-M1 (cxf 3.1.3) , If I send a request with an httponly cookie
on my rest service, I receive an IllegalArgumentException("Cookie is
malformed : " + c) when I call requestContext.getCookies().

Please find my container request filter implementation :



The  CXF-6451 <https://issues.apache.org/jira/browse/CXF-6451>   fix the bug
on the NewCookieHeaderProvider.java on 3.1.2 version but not for
CookieHeaderProvider class.

Any help would be much appreciated to find a clean workaround.

Regards



--
View this message in context: 
http://cxf.547215.n5.nabble.com/JAX-RS-CookieHeaderProvider-with-httpOnly-cookie-doesn-t-work-tp5766083.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Support both Bearer and JWT tokens

2016-02-22 Thread Sergey Beryozkin

Hi

Thanks for experimenting with the JWT authentication filter, but it is 
not exactly tailored for the use in OAuth2 flows, let me clarify.


JWT (claims) is one way to have a given access token represented 
*internally*. An access token can be a DB pointer to some custom table, 
or may be an encrypted set of JWT claims. It is still a Bearer token 
though.
Of course, other types of tokens are possible, such as PoP tokens which 
have been standardized recently, in CXF we currently support Hawk 
schemes, but even in those schemes it can be JWT claims that are used 
internally.


So, speaking of the access tokens, they are typically Bearer (or 
PoP/etc) access tokens, whether JWT claims are used to represent them or 
not is somewhat orthogonal.


We have some code in place though to support JWT assertions which 
represent a given client's authentication credentials and can be used, 
but these JWT assertions are not the tokens, the end result there is 
that the OAuth2 server will still return a Bearer/PoP/etc token


http://cxf.apache.org/docs/jaxrs-oauth2-assertions.html


JwtAuthenticationFilter is meant to be used in regular client server 
communications, the JWT scheme there is not related to OAuth2 flows, for 
example, the client obtains a JWT assertion, and uses it to 
authenticate, and may be also link it to the JWS/JWE secured payload...


Does it help ?

Sergey


On 19/02/16 04:24, Rajan1311 wrote:

Hi,

I am still pretty new at this, so might have not understood this correctly.
I am trying to protect my API via ouath. I basically need 2 types of flow,
one is a client credentials, where a client can dynamically register and
then access their resources. For this, I have followed the documentation and
have successfully implemented the same. I am using a bearer token for this.

Next I would need a JWT which my clients would generate and then use them. I
have created an SDK which is used by my clients to create JWTs. Based on the
information within the JWT, the bearer of this token can get access to the
clients resource.

So, I need to support 2 types of tokens - Bearer and JWT tokens. I did a
little bit of searching but was left confused. I tried using the
org.apache.cxf.rs.security.jose.jaxrs.JwtAuthenticationFilter (registered it
as a filter in the service I want to protect), which checks for the validity
of the JWT token, but it would block requests made with the bearer token. I
am not sure how to proceed from here. Should I create a custom token
validator for my OAuth filter ?

Thanks

Rajan



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Support-both-Bearer-and-JWT-tokens-tp5766050.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: WebClient - Content-Type Override?

2016-02-16 Thread Sergey Beryozkin

Hi

I guess the workaround is required given that 2.7.x is not being 
released any longer


Cheers, Sergey
On 16/02/16 18:08, Andrew Clark wrote:

Hi Sergey

Unfortunately we are currently restricted to using 2.x, we are currently on 
version 2.7.15.


Sent from my iPhone


On 16 Feb 2016, at 17:49, "Sergey Beryozkin" <sberyoz...@gmail.com> wrote:

Hi Christian

Starting with CXF 3.1.5 (or may be even 3.1.4) you should be able to set a 
custom Content-Type and it will go on the wire

Cheers, Sergey

On 16/02/16 17:43, Christian wrote:
Hi Sergey,

We are facing a similar issue; we are trying to send a GET with a
Content-Type header, as the service called requires it.

Just wondering if the workaround with the interceptor is still required?

We are trying to set a particular Content-Type (application/json), but it
gets stripped out at some point before the request gets sent, and the call
fails. Is that cxf's doing?

Regards,
Christian



Sergey Beryozkin wrote

Ok, thanks for this info.
You've found the workaround which is good, another option is to
register a custom CXF out interceptor which would reset Content-Type
to the required value, it can be registered with
JAXRSClientFactoryBean:

JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
bean.getOutInterceptors().add(new CustomOutInterceptor());
bean.createWebClient();

I'll try fix it as well
Sergey


On Sun, Jul 31, 2011 at 10:17 PM, Jeff Wang 



jeff.wang@



 wrote:

We're trying to use Amazon's query string authentication.  We can set
Content-Type to "", or heck, to any other string.  It's just that the
server uses the content type as part of its signature calculation.  So
when we generate the signature, we expected to set it with some content
type (tried it with either "" or an actual type, it doesn't matter.) If
it gets overridden, like what happens with webClient.get(), then the
signatures will be wrong and auth will get rejected.  The actual header
has no meaning in a GET, but we do need to control what it is so that the
signatures match.

Jeff


-----Original Message-
From: Sergey Beryozkin [mailto:



sberyozkin@



]

Sent: Sun 7/31/2011 11:00 AM
To:



users@.apache



Subject: Re: WebClient - Content-Type Override?

Hi,

Does the server expect Content-Type being set even in case of GET
requests ?

Cheers, Sergey

On 28/07/11 22:45, Jeff Wang wrote:
Looking through the code, it seems that if the body is null (which has
to be the case considering it's a get, then the content type is
overwritten with wildcards.
Using client.invoke("GET",""); solved the problem for me.

Jeff

-Original Message-
From: Jeff Wang [mailto:



jeff.wang@



]

Sent: Wednesday, July 27, 2011 5:29 PM
To:



users@.apache



Subject: WebClient - Content-Type Override?

I'm trying to act as a proxy to a third party webservice, and need to
transform a REST request.  One issue that I have is that the
Content-Type header seems to get overridden no matter what I do.  The
code is actually very simple (context is an @Context MessageContext
variable):

   WebClient client = WebClient.create(url)
   .header("real-header-removed",
"auth-string-removed")
//.header("Content-Type",
context.getHttpHeaders().getMediaType().toString());
   .type(context.getHttpHeaders().getMediaType());

   Response resp = client.get();
   return (InputStream)resp.getEntity();

Neither the .header nor the .type worked.  The tcpmon output of the
request is:
Content-Type: */*
real-header-removed: auth-string-removed
Accept: application/xml
User-Agent: Apache CXF 2.3.5
Cache-Control: no-cache
Pragma: no-cache

How do I avoid the content Type override (or rather, why is it
happening?)
Btw, while looking for answers, I found my CXF server side answers
relatively easily either via google or the archive.  But client
questions seems to be rather rare, and mostly on the SOAP calls.  Are
most people using other packages?

thanks
Jeff




--
Sergey Beryozkin

http://sberyozkin.blogspot.com
Talend - http://www.talend.com






--
View this message in context: 
http://cxf.547215.n5.nabble.com/WebClient-Content-Type-Override-tp4640790p5765944.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/




Re: WebClient - Content-Type Override?

2016-02-16 Thread Sergey Beryozkin

Hi Christian

Starting with CXF 3.1.5 (or may be even 3.1.4) you should be able to set 
a custom Content-Type and it will go on the wire


Cheers, Sergey
On 16/02/16 17:43, Christian wrote:

Hi Sergey,

We are facing a similar issue; we are trying to send a GET with a
Content-Type header, as the service called requires it.

Just wondering if the workaround with the interceptor is still required?

We are trying to set a particular Content-Type (application/json), but it
gets stripped out at some point before the request gets sent, and the call
fails. Is that cxf's doing?

Regards,
Christian



Sergey Beryozkin wrote

Ok, thanks for this info.
You've found the workaround which is good, another option is to
register a custom CXF out interceptor which would reset Content-Type
to the required value, it can be registered with
JAXRSClientFactoryBean:

JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
bean.getOutInterceptors().add(new CustomOutInterceptor());
bean.createWebClient();

I'll try fix it as well
Sergey


On Sun, Jul 31, 2011 at 10:17 PM, Jeff Wang 



jeff.wang@



 wrote:

We're trying to use Amazon's query string authentication.  We can set
Content-Type to "", or heck, to any other string.  It's just that the
server uses the content type as part of its signature calculation.  So
when we generate the signature, we expected to set it with some content
type (tried it with either "" or an actual type, it doesn't matter.) If
it gets overridden, like what happens with webClient.get(), then the
signatures will be wrong and auth will get rejected.  The actual header
has no meaning in a GET, but we do need to control what it is so that the
signatures match.

Jeff


-Original Message-
From: Sergey Beryozkin [mailto:



sberyozkin@



]

Sent: Sun 7/31/2011 11:00 AM
To:



users@.apache



Subject: Re: WebClient - Content-Type Override?

Hi,

Does the server expect Content-Type being set even in case of GET
requests ?

Cheers, Sergey
On 28/07/11 22:45, Jeff Wang wrote:

Looking through the code, it seems that if the body is null (which has
to be the case considering it's a get, then the content type is
overwritten with wildcards.
Using client.invoke("GET",""); solved the problem for me.

Jeff

-Original Message-
From: Jeff Wang [mailto:



jeff.wang@



]

Sent: Wednesday, July 27, 2011 5:29 PM
To:



users@.apache



Subject: WebClient - Content-Type Override?

I'm trying to act as a proxy to a third party webservice, and need to
transform a REST request.  One issue that I have is that the
Content-Type header seems to get overridden no matter what I do.  The
code is actually very simple (context is an @Context MessageContext
variable):

   WebClient client = WebClient.create(url)
   .header("real-header-removed",
"auth-string-removed")
//.header("Content-Type",
context.getHttpHeaders().getMediaType().toString());
   .type(context.getHttpHeaders().getMediaType());

   Response resp = client.get();
   return (InputStream)resp.getEntity();

Neither the .header nor the .type worked.  The tcpmon output of the
request is:
Content-Type: */*
real-header-removed: auth-string-removed
Accept: application/xml
User-Agent: Apache CXF 2.3.5
Cache-Control: no-cache
Pragma: no-cache

How do I avoid the content Type override (or rather, why is it
happening?)
Btw, while looking for answers, I found my CXF server side answers
relatively easily either via google or the archive.  But client
questions seems to be rather rare, and mostly on the SOAP calls.  Are
most people using other packages?

thanks
Jeff








--
Sergey Beryozkin

http://sberyozkin.blogspot.com
Talend - http://www.talend.com






--
View this message in context: 
http://cxf.547215.n5.nabble.com/WebClient-Content-Type-Override-tp4640790p5765944.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: NullPointerException in OAuthRequestFilter

2016-02-16 Thread Sergey Beryozkin

Hi

Jersey is loaded and it is auto-scanning the providers.
Are you using Jersey but only would like to use CXF OAuth2 ?

if only CXF is meant to be used then you need to disable Jersey somehow,
some info is here:

http://cxf.apache.org/docs/jax-rs-deployment.html#JAX-RSDeployment-Glassfish

but it may be incomplete

I will reply to your question on Stackoverflow too once we understand 
where the problem is



Cheers, Sergey
On 16/02/16 11:48, LaVloZ . wrote:

Hello all, how are you??

i've already posted this question on StackOverflow but it seems no one has
respond me, so please visit this link to see my question :)


http://stackoverflow.com/questions/35420727/cxf-nullpointerexception-in-oauthrequestfilter

Thank you :)





Re: CXF ignoring custom headers

2016-02-09 Thread Sergey Beryozkin

Hi, see

https://issues.apache.org/jira/browse/CXF-6611

Sergey
On 09/02/16 09:03, Zizou84 wrote:

Hello

I am using CXF 3.1.3 (jaxrs).

My custom header is ignored

org.apache.cxf.jaxrs.client.WebClient webClient =
factoryBean.createWebClient();
// set connection properties
org.apache.cxf.jaxrs.client.ClientConfiguration clientConfig =
WebClient.getConfig(webClient);
webClient.header(HttpHeaders.HOST, "mycustomHeader");

in the server side, the HttpHeaders.HOST header is the default one!!
How to set this custom header



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-ignoring-custom-headers-tp5765711.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Sub-Agent in logs telling the version of apache cxf

2016-02-09 Thread Sergey Beryozkin

Hi

I just tried, the header goes out when it is set on HttpConduit
but it is named as 'BrowserType' which looks like a typo because it is 
documented to be User-Agent, and I can find no links to BrowserType HTTP 
header (does not exist),

I'll fix it shortly

Thanks, Sergey

On 09/02/16 15:20, Khare, Aparna wrote:

Thanks a lot Sergey.

I tried both the options
Setting browser type did not work but setting the Sub-Agent in header worked

Thanks for the help,
Aparna

-Original Message-
From: Sergey Beryozkin [mailto:sberyoz...@gmail.com]
Sent: Sunday, February 7, 2016 9:46 PM
To: users@cxf.apache.org
Subject: Re: Sub-Agent in logs telling the version of apache cxf

Hi

You can customize it, set a User-Agent header when the clients are
created, ex, in jaxrs-client:client/jaxrs-client:headers, or in
JAXRSClientFactoryBean, or directly on WebClient

Another option is to set it up on HttpConduit, the property is called
'BrowserType' there.

HTH, Sergey


On 06/02/16 09:32, Khare, Aparna wrote:

Dear Colleagues,





 We are using apache CXF 3.0.7 and use Webclient to make an outbound HTTP 
call.



We connect to the external endpoint from our systems .The external system would 
log from which agent the call is being intercepted.



When a cxf client makes a call the logs are writtern with CXF agent and the 
version which is a security concern.Can you tell me how to override the agent 
information.



Best Regards,

Aparna












--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Sub-Agent in logs telling the version of apache cxf

2016-02-07 Thread Sergey Beryozkin

Hi

You can customize it, set a User-Agent header when the clients are 
created, ex, in jaxrs-client:client/jaxrs-client:headers, or in 
JAXRSClientFactoryBean, or directly on WebClient


Another option is to set it up on HttpConduit, the property is called 
'BrowserType' there.


HTH, Sergey


On 06/02/16 09:32, Khare, Aparna wrote:

Dear Colleagues,





We are using apache CXF 3.0.7 and use Webclient to make an outbound HTTP 
call.



We connect to the external endpoint from our systems .The external system would 
log from which agent the call is being intercepted.



When a cxf client makes a call the logs are writtern with CXF agent and the 
version which is a security concern.Can you tell me how to override the agent 
information.



Best Regards,

Aparna









--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Limit connection/threads for CXF endpoint?

2016-02-01 Thread Sergey Beryozkin

Hi.

Dan did a nice demo, see a 'throttling' demo in the distribution, it 
uses a Codahale library to do the advanced rate invocation checks,
right now it can delay the overflowing responses using the suspended 
invocations mechanism, from 3.1.6 one would be able to abort such 
requests with whatever HTTP error is preferred, 429/503, etc


(Dan, please review the minor changes I just did...)

Please experiment with the demo,

Sergey


On 01/02/16 11:12, Sergey Maslov wrote:

Hi!
I have web application that provides several soap service endpoints and
consumes several services as clients.
One of endpoints receives too many requests so it consumes much cpu
resources and the rest of application services freeze.
We also get "Executor queue is full, run the oneway invocation task in
caller thread" message, but increasing executor queue doesn't help as the
reason is heavy load.
Now we think of application redesign and moving to microservices, but it is
not easy deal. But we want to have some fast solution for right now.
For example, is it possible to limit threads or connections for
CXF endpoint calls? The desired behavior that if some external service
calls our endpoint and the connection size extends the limit, the caller
receives connection timeout or some other connection status. And our
application remains stable.
Thank you in advance.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Accessing init-param in spring with servlet transport

2016-01-26 Thread Sergey Beryozkin

Hi Paul

Thanks for the explanation, I guess it does not work because CXFServlet 
parameters are not visible to a web.xml-'global' application context 
which can be shared between multiple servlets, so injecting a servlet 
specific parameters into this context would be wrong.
Try using a CXFServlet config-location init param instead of a context 
contextConfigLocation to refer to the application context, perhaps it 
will make the init parameters visible


Cheers, Sergey


Try setting the application context
On 26/01/16 10:34, Paul Millar wrote:

Hi Sergey,

On 19/01/16 12:58, Sergey Beryozkin wrote:
 > Sorry for a delay.

Sorry for my delay!


I'm not sure I understand, so you'd like to have some context-params and
CXFServlet specific init-params set in a given web.xml and make them
available to the application context ?

Can you please show some configuration fragments which will help to
understand what exactly are you trying to achieve ?


A little bit of background.

I've "inherited" a rather basic servlet that I'm trying to bring into a
reasonable shape.  It provides support for a network protocol, using a
directory to store some state.

Currently, the directory it uses is hardcoded as '/data'.  I would like
to expose this as a configuration option for two reasons:

  a. Using '/data' might not be convenient for all users.

  b. I'm adding integration testing as part of the maven build process
 and I want to run the servlet (from within maven) but configuring
 it to use a path within the maven-project's 'target' directory.

I believe init-param is the implementation-agnostic way of configuring a
servlet.  Given I want to expose a single string argument, this seemed
appropriate.

I would also like to avoid introducing CXF-specific code in the
application: the servlet should work with any JAX-RS implementation.

Therefore, it looked like injecting the init-param as a spring argument
is the way forward and an initial scan of CXF code-base suggests that
CXF servlet transport does inject the key-value pairs from init-param
arguments into a named Spring bean; however, when I try this it doesn't
work.

Here are some details.  The web.xml:


http://java.sun.com/xml/ns/javaee;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd;>
 
 contextConfigLocation
 classpath:applicationContext.xml
 

 

org.springframework.web.context.ContextLoaderListener

 

 
 CXFServlet

org.apache.cxf.transport.servlet.CXFServlet
 
   filesystemBaseDirectory
   /home/paul/test-dir
 
 1
 

 
 CXFServlet
 /*
 




Some fragments from applicationContext.xml, omitting some unrelated parts.




 
 
 
 

 

 
 
 



With the above configuration, the SpEL reference
#{contextParameters['filesystemBaseDirectory']} expands to null.

If I add context-param declaration to web.xml then the SpEL expression
expands to the correct value.

Any ideas how to get init-param to work?

Cheers,

Paul.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: AW: CXF 3.0.7 JAXRS POST application/x-www-form-urlencoded

2016-01-26 Thread Sergey Beryozkin

Hi

I guess you can not make it work reliably with @BeanParam bean.
First of all if a given method has a JAX-RS annotation then the 
superclasses are not checked, this is per the annotation inheritance 
spec restriction. And perhaps you can get the ordering of methods being 
different with various JDKs.

Perhaps you can make it work with something like:

@Consumes("application/x-www-form-urlencoded")
post(@Context UriInfo ui, MultivaluedMap<String, String> formPayload) {
String a = getParam(ui, formPayload, "a");
}
String get(UriInfo ui, MultivaluedMap<String, String> formPayload, 
String paramName) {

String value = ui.getQueryParameters().getFirst(paramName);
return value != null ? value : formPayload.getFirst(paramName);
}

Sergey

On 26/01/16 08:36, Julien Charon wrote:

   Hi,


Recently, I had time to have a closer look at this. I first analysed the 
behaviour of the old implementation using 
(Http)ServletRequest.getParameter(String).
I observed that it is possible to mix both parameters provided in the URL and 
in the body of the request, whereas the parameters in the URL are preferred to 
the ones in the body.

For example, assuming a service method with 3 parameters param1, param2 and 
param3:
URL: http://server1/service/method?param1=urlValue1=urlValue2
Body: param2=bodyValue2=bodyValue3
Then (Http)ServletRequest.getParameter(String) will return: param1=urlValue1, 
param2=urlValue2 and param3=bodyValue3

So I tried to create a bean param class for a GET method containing @QueryParam 
annotations on the setters. In a second step, I created a subclass of the bean 
param class to use it for a POST method with application/x-www-form-urlencoded 
by overriding the setters and annotating them with @FormParam using the same 
parameter names. Now this is working fine as long as parameters are not mixed 
like I described it above. I think this is logical because I overwrote the 
setters and replaced the annotation. So I tried to create new setter methods 
with a suffix, annotated those with @FormParam and make them call the setter of 
the superclass. Unfortunately, this doesn't work.

Does someone have an idea how I can achieve the behaviour of the old 
implementation?


Viele Grüße,

Julien

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.cha...@avitech.aero

Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero

This message may contain confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.

-Ursprüngliche Nachricht-
Von: Julien Charon [mailto:julien.cha...@avitech.aero]
Gesendet: Donnerstag, 10. Dezember 2015 15:51
An: users@cxf.apache.org
Betreff: AW: CXF 3.0.7 JAXRS POST application/x-www-form-urlencoded

Thank you. So I will wait for 3.0.8.

However, I noticed another behaviour related to using HttpServletRequest but 
with content type text/xml. If javax.servlet.ServletRequest.getInputStream() is 
called, an InputStream is returned that contains no data, i.e. I can't access 
the body of the POST request. Anything else I can do to avoid that than getting 
the body as method parameter?


Best regards,

Julien

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.cha...@avitech.aero

Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany Court 
Registration: Amtsgericht Ulm | HRB 728293 Geschäftsführer/Managing Director: 
Antonio Maria Gonzalez Gorostiza http://avitech.aero

This message may contain confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.

-Ursprüngliche Nachricht-
Von: Sergey Beryozkin [mailto:sberyoz...@gmail.com]
Gesendet: Sonntag, 6. Dezember 2015 18:47
An: users@cxf.apache.org
Betreff: Re: CXF 3.0.7 JAXRS POST application/x-www-form-urlencoded

FYI:

https://issues.apache.org/jira/browse/CXF-6679

Sergey
On 04/12/15 11:59, Sergey Beryozkin wrote:

Hi

Thanks for experimenting with CXF,

https://issues.apache.org/jira/browse/CXF-6679

is open and I'm honestly not sure why it is not working because CXF
itself does not consume that data, so if it works directly with the
servlet then it should work inside the JAX-RS code.
Unless CXF does some internal caching

Re: How to limit concurrent requests served by resource?

2016-01-22 Thread Sergey Beryozkin

I might have some time to look at
https://issues.apache.org/jira/browse/CXF-6610

before 3.1.5 gets released if not then we will do for 3.1.6

It should be a very basic update, say if an optional property 
"abortWhenThresholdIsReached" is set then a specific exception is 
thrown, and either JAXWS or JAXRS mappers can then map it to 503


Sergey
On 18/01/16 11:08, Sergey Beryozkin wrote:

Hi,
jaxrs:server can have features or native CXF interceptors registered
within jaxrs:features and jaxrs:inInterceptors (or
jaxrs:outInterceptors), so that demo should work the same way with JAXRS
servers it works with JAXWS.
Unfortunately I haven't experimented much myself yet, though as I said
one thing we noticed that supporting optionally returning 503 instead of
suspending the overflowing client requests will be needed - that should
be not be difficult to do.

Cheers, Sergey

On 18/01/16 10:54, Vjacheslav V. Borisov wrote:

Sergey, how should we adopt this approach to jax-rs services?

Which is there jax-rs analogs to  AbstractPhaseInterceptor ?


2016-01-15 16:19 GMT+04:00 Sergey Beryozkin <sberyoz...@gmail.com>:


Hi

CXF ships its own throttling feature, Dan did it, see


https://fisheye6.atlassian.com/browse/cxf/distribution/src/main/release/samples/throttling


The threads will be temporarily suspended If the threshold is reached.
One thing that still needs to be done is to support actually
returning 503
(if preferred) as opposed to suspending the clients.

Sergey


On 15/01/16 11:12, Vjacheslav V. Borisov wrote:


Hi,

How to  limit concurrent requests served by specific resource, or by
application iteself?

Found this thread

http://stackoverflow.com/questions/5563442/how-to-set-limit-to-the-number-of-concurrent-request-in-servlet


Should i do something like showed in accepted answer,
or cxf has his  limit configuration ?




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/









--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: WADL and Swagger

2016-01-21 Thread Sergey Beryozkin

Hi

wadl-to-java generates a Java code and optionally converts WADL docs 
into JavaDocs too - and with the latest improvements to the feature done 
by Francesco the source (+ docs) will be converted into Swagger JSON, 
without necessarily adding Swagger annotations...


As a side note, if the only reason you'd like to do Swagger is to get 
some UI then note WADLGenerator can be configured with and XSLT source 
reference, an XSLT conversion (like the one done in Syncope :-)) can 
make a great difference :-)


Sergey

On 21/01/16 12:05, Francesco Chicchiriccò wrote:

On 21/01/2016 11:34, Gary Gregory wrote:

Hi All:

I see that CXF includes supports for both WADL [1] and Swagger [2]. Is to
possible to programatically use CXF to convert a WADL file to a Swagger
file? Perhaps by first parsing WADL to some CXF internal format and then
back out to Swagger?


Hi Gary,
don't know about WADL -> internal (maybe Sergey), but the internal ->
Swagger part is what actually performed by [3] as triggered by [4]
(references shown for 3.1.X).

Regards.


[1]
https://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-WADLfirstDevelopment

[2] https://cxf.apache.org/docs/swagger2feature.html

[3]
https://github.com/apache/cxf/blob/3.1.x-fixes/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Serializers.java

[4]
https://github.com/apache/cxf/blob/3.1.x-fixes/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java#L92






Re: How to generate episode file using wadl2java ?

2016-01-21 Thread Sergey Beryozkin

Hi

Sure, have a look please at
org.apache.cxf.catalog.OASISCatalogManager, this is in the cxf-core module.

I see there it checks "OASISCatalogManager.catalog.debug.level" system 
property - which is set, if not null, on 
org.apache.xml.resolver.CatalogManager, apparently CatalogManager can 
also check Catalog.properties file


Perhaps OASISCatalogManager can also be enhanced...

Re the episodes files - have a look at CustomizationParser in 
wadlto/jaxrs, I copied some code there from the wsdl processor, you can 
see jaxb bindings are modified with the target namespaces. Perhaps the 
similar approach can help with episodes ?


Cheers, Sergey


On 21/01/16 05:00, Vjacheslav V. Borisov wrote:

I am talking about my progress is slow :)
Where can I find xml catalog  resolution code in cxf wadl2java ? May be i
can patch it to enable debugging info

2016-01-20 18:24 GMT+04:00 Sergey Beryozkin <sberyoz...@gmail.com>:


Well, this is one of those issues which I can not prioritize upon - I've
never worked with episodes before, and given that workarounds exists it is
hard to prioritize on this arguably minor issue.

In many case we can temp stop working on our current commitments (which
all of us have) and react fast enough when the issues are easy to tackle or
when the issues are indeed critical or patches exist.

I'd like to encourage you to look at providing a patch whenever you feel
like the progress is slow, you obviously understand what is needed as far
as episodes are concerned, so how about looking at JAXRSContainerTest in
wadlto/jaxrs, look for the tests which end with "Binding" and see how CXF
manages the custom jaxb binding perhaps that can give you an idea how
episodes can also be handled nicely

Cheers, Sergey







Re: How to generate episode file using wadl2java ?

2016-01-20 Thread Sergey Beryozkin
Well, this is one of those issues which I can not prioritize upon - I've 
never worked with episodes before, and given that workarounds exists it 
is hard to prioritize on this arguably minor issue.


In many case we can temp stop working on our current commitments (which 
all of us have) and react fast enough when the issues are easy to tackle 
or when the issues are indeed critical or patches exist.


I'd like to encourage you to look at providing a patch whenever you feel 
like the progress is slow, you obviously understand what is needed as 
far as episodes are concerned, so how about looking at 
JAXRSContainerTest in wadlto/jaxrs, look for the tests which end with 
"Binding" and see how CXF manages the custom jaxb binding perhaps that 
can give you an idea how episodes can also be handled nicely


Cheers, Sergey

On 20/01/16 13:20, Vjacheslav V. Borisov wrote:

2015-11-24 19:48 GMT+04:00 Sergey Beryozkin <sberyoz...@gmail.com>:


I'll look in detail at one of the existing tests where an external binding
is applied (I recall copying some JAXWS tooling code which modifies the
binding files), and will let you know, a bit later though



Found temporal  workaround to recoginze geenerated episode files (binding
files for multiple schemas), i need to supply them to xjc directly, like

 -xjc-b

-xjc${basedir}/src/main/resources/schemas/dictionary/dictionary.episode

Altough i cannot refer to classpath for episode file here, still waitng for
CXF realization with these bindings.
P.S.
And playing with oasis  catalog file (eg to resolve schemas located in
jars),  I  cannot enable any debug info about applying catalog.xml
transformations, this really slows work









Still not sure what to do about WADLToJava actually recognizing those
episodes



I know that maven-jaxb2-plugin works with this generated binding (with
many
schemas attached to generation)
How can I help to investigate the problem?




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Accessing init-param in spring with servlet transport

2016-01-19 Thread Sergey Beryozkin

Hi Paul

Sorry for a delay.

I'm not sure I understand, so you'd like to have some context-params and 
CXFServlet specific init-params set in a given web.xml and make them 
available to the application context ?


Can you please show some configuration fragments which will help to 
understand what exactly are you trying to achieve ?


Cheers, Sergey


I have a small JAX-RS application that I'm running through the servlet
transport.

I'd like to make the application configurable via init-param settings in
the corresponding web.xml file.  I would like to keep the code
transport-neutral, so wanted to inject properties using the
applicationContext.xml spring file.

Prima facie, this should be possible.  The CXF servlet transport
populates the "contextParameters" bean (using context-param, and
init-params setting) and this bean is accessible in spring via SpEL;
e.g., #{contextParameters['key']}.

However, this is not working: while context-param values are available,
the init-params are not.

A potential complication is that this is currently done with
jetty-maven-plugin, which I'm binding to the integration testing phase
to allow integration/functional testing as part of the build process.

Ultimately, my goal is to expose configuration options.  If init-param
is not supported, what is the best way of achieving this?

I think the most important dependencies are:
spring-context 4.2.4.RELEASE
spring-web 4.2.4.RELEASE
cxf-rt-frontend-jaxrs 3.1.4

Cheers,

Paul.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: How to limit concurrent requests served by resource?

2016-01-18 Thread Sergey Beryozkin

Hi,
jaxrs:server can have features or native CXF interceptors registered 
within jaxrs:features and jaxrs:inInterceptors (or 
jaxrs:outInterceptors), so that demo should work the same way with JAXRS 
servers it works with JAXWS.
Unfortunately I haven't experimented much myself yet, though as I said 
one thing we noticed that supporting optionally returning 503 instead of 
suspending the overflowing client requests will be needed - that should 
be not be difficult to do.


Cheers, Sergey

On 18/01/16 10:54, Vjacheslav V. Borisov wrote:

Sergey, how should we adopt this approach to jax-rs services?

Which is there jax-rs analogs to  AbstractPhaseInterceptor ?


2016-01-15 16:19 GMT+04:00 Sergey Beryozkin <sberyoz...@gmail.com>:


Hi

CXF ships its own throttling feature, Dan did it, see


https://fisheye6.atlassian.com/browse/cxf/distribution/src/main/release/samples/throttling

The threads will be temporarily suspended If the threshold is reached.
One thing that still needs to be done is to support actually returning 503
(if preferred) as opposed to suspending the clients.

Sergey


On 15/01/16 11:12, Vjacheslav V. Borisov wrote:


Hi,

How to  limit concurrent requests served by specific resource, or by
application iteself?

Found this thread

http://stackoverflow.com/questions/5563442/how-to-set-limit-to-the-number-of-concurrent-request-in-servlet

Should i do something like showed in accepted answer,
or cxf has his  limit configuration ?




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: How to limit concurrent requests served by resource?

2016-01-15 Thread Sergey Beryozkin

Hi

CXF ships its own throttling feature, Dan did it, see

https://fisheye6.atlassian.com/browse/cxf/distribution/src/main/release/samples/throttling 



The threads will be temporarily suspended If the threshold is reached.
One thing that still needs to be done is to support actually returning 
503 (if preferred) as opposed to suspending the clients.


Sergey

On 15/01/16 11:12, Vjacheslav V. Borisov wrote:

Hi,

How to  limit concurrent requests served by specific resource, or by
application iteself?

Found this thread
http://stackoverflow.com/questions/5563442/how-to-set-limit-to-the-number-of-concurrent-request-in-servlet

Should i do something like showed in accepted answer,
or cxf has his  limit configuration ?




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Where is my JAX-RS Invoke going?

2016-01-13 Thread Sergey Beryozkin

Hi

The log shows that a method accepting a single parameter is invoked, 
while the one you typed accepts 3 parameters.
Looks like you may have 2 methods which prove to be equal JAX-RS method 
candidates.


Cheers, Sergey

On 12/01/16 20:09, Jim Talbut wrote:

Hi,

In a JAX-RS application running in tomcat 8 using CXF 3.1.4 with the
logs turned up to DEBUG I'm seeing this:

15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor org.apache.cxf.interceptor.OneWayProcessorInterceptor@3b258a06
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor org.apache.cxf.interceptor.ServiceInvokerInterceptor@22d2b4b
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.s.invoker.AbstractInvoker - Invoking method public
javax.ws.rs.core.Response
com.groupgti.scheduler.api.resource.TaskRunsResource.get(int) throws
java.io.IOException,org.apache.cxf.jaxrs.ext.search.SearchParseException
on object com.groupgti.scheduler.api.resource.TaskRunsResource@61f150ac
with params [426347].
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor org.apache.cxf.interceptor.OutgoingChainInterceptor@6bdd002e
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by bus:
[com.groupgti.esb.cxf.interceptors.MessageLoggerOutbound@716e7107,
org.apache.cxf.ws.policy.PolicyOutInterceptor@71c4ebf3]
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by service: []
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by endpoint:
[org.apache.cxf.interceptor.MessageSenderInterceptor@2061f639]

Note that it invokes my method and then the next log record is for an
interceptor on the outgoing chain.

An excerpt of my resource class looks like this:
@Path("/taskruns")
@LinkRelation( name = "taskruns", relation = "taskruns", title = "Task
Runs" )
public class TaskRunsResource extends AbstractResource {

 private static final Logger LOG =
LoggerFactory.getLogger(TaskRunsResource.class);

 @GET
 @Path("{id: \\d+}")
 @Produces({RepresentationFactory.HAL_JSON,
RepresentationFactory.HAL_XML, MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML, MediaType.TEXT_XML})
 public Response get( @PathParam("id") int taskRunId
, @QueryParam("field") final String[] fields
, @QueryParam("embed") final String[] embeds
) throws IOException, SearchParseException {

 LOG.warn("Get taskrun {}", taskRunId);

So somehow CXF thinks it is invoking that method, but it never gets as
far as that LOG expression.

Other calls are working, this is the only one I've found that isn't, but
it fails consistently.
It does work when run in a junit that isn't using tomcat.

Can anyone suggest where I should start to look for the cause of this
problem?

Thanks.

Jim



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Where is my JAX-RS Invoke going?

2016-01-13 Thread Sergey Beryozkin

Hi
On 13/01/16 13:05, Jim Talbut wrote:

Gaah
You're right.
Thank you.

I haven't touched this code for a long while and didn't realise I had
overloaded that method (I've now renamed the methods to help me out next
time).

I'm surprised that a request with an Accept of this:
 application/json, text/plain, */*

Do you have any 'q' parameters in this Accept ?

Thanks, Sergey


Preferred this method:
 @Produces({MediaType.TEXT_HTML})
over this:
 @Produces({RepresentationFactory.HAL_JSON,
RepresentationFactory.HAL_XML,
MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML,
MediaType.TEXT_XML
  })
I guess you just iterate through the methods (with unpredictable
ordering) and take the first that matches, rather than trying to
establish the best?
Or do you order based on the Produces order, where the two matching
types are both third in the list?

I've changed the request to have:
Accept: application/hal+json, application/json
(which is what it should have been all along, the client couldn't cope
with anything else) and now it hits the right method.

Thank you again.

Jim

On 13/01/2016 12:32, Sergey Beryozkin wrote:

Hi

The log shows that a method accepting a single parameter is invoked,
while the one you typed accepts 3 parameters.
Looks like you may have 2 methods which prove to be equal JAX-RS method
candidates.

Cheers, Sergey

On 12/01/16 20:09, Jim Talbut wrote:

Hi,

In a JAX-RS application running in tomcat 8 using CXF 3.1.4 with the
logs turned up to DEBUG I'm seeing this:

15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor
org.apache.cxf.interceptor.OneWayProcessorInterceptor@3b258a06
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor org.apache.cxf.interceptor.ServiceInvokerInterceptor@22d2b4b
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.s.invoker.AbstractInvoker - Invoking method public
javax.ws.rs.core.Response
com.groupgti.scheduler.api.resource.TaskRunsResource.get(int) throws
java.io.IOException,org.apache.cxf.jaxrs.ext.search.SearchParseException
on object com.groupgti.scheduler.api.resource.TaskRunsResource@61f150ac
with params [426347].
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor org.apache.cxf.interceptor.OutgoingChainInterceptor@6bdd002e
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by bus:
[com.groupgti.esb.cxf.interceptors.MessageLoggerOutbound@716e7107,
org.apache.cxf.ws.policy.PolicyOutInterceptor@71c4ebf3]
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by
service: []
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by endpoint:
[org.apache.cxf.interceptor.MessageSenderInterceptor@2061f639]

Note that it invokes my method and then the next log record is for an
interceptor on the outgoing chain.

An excerpt of my resource class looks like this:
@Path("/taskruns")
@LinkRelation( name = "taskruns", relation = "taskruns", title = "Task
Runs" )
public class TaskRunsResource extends AbstractResource {

 private static final Logger LOG =
LoggerFactory.getLogger(TaskRunsResource.class);

 @GET
 @Path("{id: \\d+}")
 @Produces({RepresentationFactory.HAL_JSON,
RepresentationFactory.HAL_XML, MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML, MediaType.TEXT_XML})
 public Response get( @PathParam("id") int taskRunId
, @QueryParam("field") final String[] fields
, @QueryParam("embed") final String[] embeds
) throws IOException, SearchParseException {

 LOG.warn("Get taskrun {}", taskRunId);

So somehow CXF thinks it is invoking that method, but it never gets as
far as that LOG expression.

Other calls are working, this is the only one I've found that isn't, but
it fails consistently.
It does work when run in a junit that isn't using tomcat.

Can anyone suggest where I should start to look for the cause of this
problem?

Thanks.

Jim






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Where is my JAX-RS Invoke going?

2016-01-13 Thread Sergey Beryozkin

On 13/01/16 13:53, Sergey Beryozkin wrote:

Hi
On 13/01/16 13:05, Jim Talbut wrote:

Gaah
You're right.
Thank you.

I haven't touched this code for a long while and didn't realise I had
overloaded that method (I've now renamed the methods to help me out next
time).

I'm surprised that a request with an Accept of this:
 application/json, text/plain, */*

Do you have any 'q' parameters in this Accept ?


And no text/html ? Usually a browser inserts it

Cheers, Sergey


Thanks, Sergey


Preferred this method:
 @Produces({MediaType.TEXT_HTML})
over this:
 @Produces({RepresentationFactory.HAL_JSON,
RepresentationFactory.HAL_XML,
MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML,
MediaType.TEXT_XML
  })
I guess you just iterate through the methods (with unpredictable
ordering) and take the first that matches, rather than trying to
establish the best?
Or do you order based on the Produces order, where the two matching
types are both third in the list?

I've changed the request to have:
Accept: application/hal+json, application/json
(which is what it should have been all along, the client couldn't cope
with anything else) and now it hits the right method.

Thank you again.

Jim

On 13/01/2016 12:32, Sergey Beryozkin wrote:

Hi

The log shows that a method accepting a single parameter is invoked,
while the one you typed accepts 3 parameters.
Looks like you may have 2 methods which prove to be equal JAX-RS method
candidates.

Cheers, Sergey

On 12/01/16 20:09, Jim Talbut wrote:

Hi,

In a JAX-RS application running in tomcat 8 using CXF 3.1.4 with the
logs turned up to DEBUG I'm seeing this:

15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor
org.apache.cxf.interceptor.OneWayProcessorInterceptor@3b258a06
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor
org.apache.cxf.interceptor.ServiceInvokerInterceptor@22d2b4b
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.s.invoker.AbstractInvoker - Invoking method public
javax.ws.rs.core.Response
com.groupgti.scheduler.api.resource.TaskRunsResource.get(int) throws
java.io.IOException,org.apache.cxf.jaxrs.ext.search.SearchParseException

on object com.groupgti.scheduler.api.resource.TaskRunsResource@61f150ac
with params [426347].
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor
org.apache.cxf.interceptor.OutgoingChainInterceptor@6bdd002e
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by bus:
[com.groupgti.esb.cxf.interceptors.MessageLoggerOutbound@716e7107,
org.apache.cxf.ws.policy.PolicyOutInterceptor@71c4ebf3]
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by
service: []
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by
endpoint:
[org.apache.cxf.interceptor.MessageSenderInterceptor@2061f639]

Note that it invokes my method and then the next log record is for an
interceptor on the outgoing chain.

An excerpt of my resource class looks like this:
@Path("/taskruns")
@LinkRelation( name = "taskruns", relation = "taskruns", title = "Task
Runs" )
public class TaskRunsResource extends AbstractResource {

 private static final Logger LOG =
LoggerFactory.getLogger(TaskRunsResource.class);

 @GET
 @Path("{id: \\d+}")
 @Produces({RepresentationFactory.HAL_JSON,
RepresentationFactory.HAL_XML, MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML, MediaType.TEXT_XML})
 public Response get( @PathParam("id") int taskRunId
, @QueryParam("field") final String[] fields
, @QueryParam("embed") final String[] embeds
) throws IOException, SearchParseException {

 LOG.warn("Get taskrun {}", taskRunId);

So somehow CXF thinks it is invoking that method, but it never gets as
far as that LOG expression.

Other calls are working, this is the only one I've found that isn't,
but
it fails consistently.
It does work when run in a junit that isn't using tomcat.

Can anyone suggest where I should start to look for the cause of this
problem?

Thanks.

Jim









--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: CXF remove some namespaces

2016-01-13 Thread Sergey Beryozkin

Hi

It looks like you'd like to optimize (remove possibly redundant 
prefixes) as opposed to change the namespaces, the transformation 
feature does not do it, perhaps you can use XSLT feature to drop 
namespaces prefixes


Cheers, Sergey
On 12/01/16 16:34, r.bott...@afterbit.com wrote:

Hi,
i use CXF 3.14
i would like to remove some namespaces for some elements and preserve
other..

the original XML is like that :

http://schemas.xmlsoap.org/soap/envelope/;>
 
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd;
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd;
soap:mustUnderstand="1">
 
 MYUSER
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest;>QTh0CuaMLVIUpyLCM8vvobZZg28=

 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary;>B2BolkOOPUgz4uXRDQJlJA==

 2016-01-12T15:58:31.142Z
 
 
 http://www.w3.org/2005/08/addressing;>http://webservices.afterbit.com/HSFREQ_07_3_1A

 http://www.w3.org/2005/08/addressing;>urn:uuid:59eeb370-c04c-4457-bd77-b67784c37eab

 http://www.w3.org/2005/08/addressing;>https://test.webservices.afterbit.com/MYUSER

 http://www.w3.org/2005/08/addressing;>
http://www.w3.org/2005/08/addressing/anonymous
 
 http://xml.afterbit.com/2010/06/Security_v1;
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A;
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A; >
 
 
 
 
 http://xml.afterbit.com/2010/06/Security_v1;
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A;
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A; >
 
 Hi
 
 
 




and this is what i would want :


http://schemas.xmlsoap.org/soap/envelope/;>
 
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd;
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd;
soap:mustUnderstand="1">
 
 MYUSER
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest;>QTh0CuaMLVIUpyLCM8vvobZZg28=

 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary;>B2BolkOOPUgz4uXRDQJlJA==

 2016-01-12T15:58:31.142Z
 
 
 http://www.w3.org/2005/08/addressing;>http://webservices.afterbit.com/HSFREQ_07_3_1A

 http://www.w3.org/2005/08/addressing;>urn:uuid:59eeb370-c04c-4457-bd77-b67784c37eab

 http://www.w3.org/2005/08/addressing;>https://test.webservices.afterbit.com/MYUSER

 http://www.w3.org/2005/08/addressing;>
http://www.w3.org/2005/08/addressing/anonymous
 
 http://xml.afterbit.com/2010/06/Security_v1;>
 
 
 
 
 
 
 Hi
 
 
 



that is :

1) http://xml.afterbit.com/2010/06/Security_v1;
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A;
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A; >
becomes :
http://xml.afterbit.com/2010/06/Security_v1; >
2) http://xml.afterbit.com/2010/06/Security_v1;
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A;
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A; >
becomes :



this is my java unsuccessful code :


Map<String, String> outTransformMap = new HashMap<String, String>();
outTransformMap.put("{http://xml.afterbit.com/HSFREQ_07_3_1A}*;, "*");
outTransformMap.put("{http://xml.afterbit.com/HSFRES_07_3_1A}*;, "*");
outTransformMap.put("{http://xml.afterbit.com/2010/06/Security_v1}*;, "*");
outTransformMap.put("AMA_SecurityHostedUser",
"{http://xml.afterbit.com/2010/06/Security_v1}AMA_SecurityHostedUser;);
org.apache.cxf.interceptor.transform.TransformOutInterceptor
transformOutInterceptor  = new
org.apache.cxf.interceptor.transform.TransformOutInterceptor();
transformOutInterceptor.setOutTransformElements(outTransformMap);
client.getOutInterceptors().add(transformOutInterceptor);

Thanks!








--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Where is my JAX-RS Invoke going?

2016-01-13 Thread Sergey Beryozkin

Indeed, I reproduced it, but it looks like to be correct


S(*/*, text/html) = text/html;q=1;qs=1;d=0
S(application/json, application/json) = application/json;q=1;qs=1;d=0

(Section 3.7.2, 3.b)

both methods are equal candidates so the 1st method (or whichever method 
from these two gets on top) is selected




add 'qs=0.9' to text/html in Produces and you will get a method with 
application/json selected


Cheers, Sergey
On 13/01/16 14:22, Jim Talbut wrote:

No q, no text/html, this is coming from AngularJS using its default
Accept header.

Jim

On 13/01/2016 13:57, Sergey Beryozkin wrote:

On 13/01/16 13:53, Sergey Beryozkin wrote:

Hi
On 13/01/16 13:05, Jim Talbut wrote:

Gaah
You're right.
Thank you.

I haven't touched this code for a long while and didn't realise I had
overloaded that method (I've now renamed the methods to help me out
next
time).

I'm surprised that a request with an Accept of this:
 application/json, text/plain, */*

Do you have any 'q' parameters in this Accept ?


And no text/html ? Usually a browser inserts it

Cheers, Sergey


Thanks, Sergey


Preferred this method:
 @Produces({MediaType.TEXT_HTML})
over this:
 @Produces({RepresentationFactory.HAL_JSON,
RepresentationFactory.HAL_XML,
MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML,
MediaType.TEXT_XML
  })
I guess you just iterate through the methods (with unpredictable
ordering) and take the first that matches, rather than trying to
establish the best?
Or do you order based on the Produces order, where the two matching
types are both third in the list?

I've changed the request to have:
Accept: application/hal+json, application/json
(which is what it should have been all along, the client couldn't cope
with anything else) and now it hits the right method.

Thank you again.

Jim

On 13/01/2016 12:32, Sergey Beryozkin wrote:

Hi

The log shows that a method accepting a single parameter is invoked,
while the one you typed accepts 3 parameters.
Looks like you may have 2 methods which prove to be equal JAX-RS
method
candidates.

Cheers, Sergey

On 12/01/16 20:09, Jim Talbut wrote:

Hi,

In a JAX-RS application running in tomcat 8 using CXF 3.1.4 with the
logs turned up to DEBUG I'm seeing this:

15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor
org.apache.cxf.interceptor.OneWayProcessorInterceptor@3b258a06
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor
org.apache.cxf.interceptor.ServiceInvokerInterceptor@22d2b4b
15:59:52.116 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.s.invoker.AbstractInvoker - Invoking method public
javax.ws.rs.core.Response
com.groupgti.scheduler.api.resource.TaskRunsResource.get(int) throws
java.io.IOException,org.apache.cxf.jaxrs.ext.search.SearchParseException



on object
com.groupgti.scheduler.api.resource.TaskRunsResource@61f150ac
with params [426347].
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on
interceptor
org.apache.cxf.interceptor.OutgoingChainInterceptor@6bdd002e
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by bus:
[com.groupgti.esb.cxf.interceptors.MessageLoggerOutbound@716e7107,
org.apache.cxf.ws.policy.PolicyOutInterceptor@71c4ebf3]
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by
service: []
15:59:52.117 [http-apr-172.28.9.212-8080-exec-31] DEBUG
o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by
endpoint:
[org.apache.cxf.interceptor.MessageSenderInterceptor@2061f639]

Note that it invokes my method and then the next log record is for an
interceptor on the outgoing chain.

An excerpt of my resource class looks like this:
@Path("/taskruns")
@LinkRelation( name = "taskruns", relation = "taskruns", title =
"Task
Runs" )
public class TaskRunsResource extends AbstractResource {

 private static final Logger LOG =
LoggerFactory.getLogger(TaskRunsResource.class);

 @GET
 @Path("{id: \\d+}")
 @Produces({RepresentationFactory.HAL_JSON,
RepresentationFactory.HAL_XML, MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML, MediaType.TEXT_XML})
 public Response get( @PathParam("id") int taskRunId
, @QueryParam("field") final String[] fields
, @QueryParam("embed") final String[] embeds
) throws IOException, SearchParseException {

 LOG.warn("Get taskrun {}", taskRunId);

So somehow CXF thinks it is invoking that method, but it never
gets as
far as that LOG expression.

Other calls are working, this is the only one I've found that isn't,
but
it

Re: Attaching context to an AsyncResponse

2016-01-11 Thread Sergey Beryozkin

Hi Benson

The idea of having a utility 'put' method was not accepted awhile back, 
I agree it would be useful, but you can have a map of AsyncResponse to 
some context bean values, you might need to keep a reference to a given 
AsyncResponse so that you can accumulate the response context from 
various code parts


Cheers, Sergey
On 01/01/16 16:19, Benson Margulies wrote:

I have some code that calls MessageContext#put to avoid passing a
handful of parameters through many functions. It occurs to me that
this won't work with async; if some mechanism of mine calls back into
the resource class to complete processing, the injected message
context could be long gone.

I'm wishing that AsyncResponse had a 'put', but no such luck. Am I
missing anything?




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Exceptions and Async

2016-01-11 Thread Sergey Beryozkin

Hi Benson

The very first call into this method does not suspend the continuation, 
so there's no need to resume it if the exception is returned.

Do you see a mapped exception response not being returned ? Please clarify

Cheers, Sergey

On 02/01/16 02:01, Benson Margulies wrote:

If I am in a method with an @Suspended AsyncResponse, and I neglect to
catch an exception, CXF runs mappers but they don't do any good, of
course, because nothing resumes the response.

How about if CXF instead logged at ERROR about any exception thrown
through a suspended resource method? I'm assuming that there's no way
to arrange for any uncaught exception to end up as
asyncResponse.resume(e).





Re: Exceptions and Async

2016-01-11 Thread Sergey Beryozkin
Sounds good, the unmapped/escaped exception must not cause blocking the 
response, so yeah, please create a test


I see a test testUnmappedAfterTimeout which asserts 500 is returned. 
This is a case  where the current async response is suspended for some 
time and when it returns the unmapped exception is thrown. Perhaps when 
the exception escapes immediately then something needs to be tweaked


Cheers, Sergey
On 11/01/16 11:56, Benson Margulies wrote:

On Mon, Jan 11, 2016 at 6:49 AM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:


Hi Benson
On 11/01/16 11:42, Benson Margulies wrote:


Sergey,

I annotate @Suspended. So it is suspended on the first call.

It is not, believe me :-) because this is how I implemented it.

The runtime does not have to physically suspend a call, given that the
method can immediately call AsyncResponse.resume(). JAXRSInvoker will only
suspend the thread if no resume/cancel was called by the time the method
returns. The runtimes are allowed to optimize like this.



I think that perhaps we're using the word 'suspended' in two different
ways? I'm only meaning that the response object itself thinks it's
suspended. However, it's not important. If it's supposed to handle _thrown_
exceptions in the first call, I'll make a branch with a test case, because
what I saw what is that it hung.





The quote I read from the spec says that returned values from @Suspended

calls are ignored. It did not say what the spec says about exceptions from
those calls. If they are also supposed to be ignored, then a big fat WARN
log message would be what I have in mind.


The exceptions escaped from a method are supposed to be caught, 'the
returned values are ignored' is probably a reference to a 'void' return
type, but of course a method can immediately do
asyncResponse.resume(myResponse).



Yes, it says that you must use 'void' and if you return something else it
will be ignored.




Cheers, Sergey




On Mon, Jan 11, 2016 at 5:17 AM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:

Hi Benson


The very first call into this method does not suspend the continuation,
so
there's no need to resume it if the exception is returned.
Do you see a mapped exception response not being returned ? Please
clarify

Cheers, Sergey


On 02/01/16 02:01, Benson Margulies wrote:

If I am in a method with an @Suspended AsyncResponse, and I neglect to

catch an exception, CXF runs mappers but they don't do any good, of
course, because nothing resumes the response.

How about if CXF instead logged at ERROR about any exception thrown
through a suspended resource method? I'm assuming that there's no way
to arrange for any uncaught exception to end up as
asyncResponse.resume(e).









--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: CXF Web Client Proxy Exception

2016-01-11 Thread Sergey Beryozkin

Hi

Can you clarify please, how does it work for you if say a plain 
HttpUrlConnection is used directly ? Sounds like CXF HttpConduit proxy 
configuration might be applied, but I'd like to get more information first


Thanks, Sergey

On 04/01/16 20:14, williamo...@ups.com.INVALID wrote:

Hi all,

I am currently using CXF 3.1.2 with JAX-RS 2.0 and I have developed a web 
client to send RESTful messages to an internal url within my company.  The 
issue I am having is with our proxy.  When the message is generated and sent, 
it attempts to communicate with the proxy and fails.  Since I am just trying to 
connect to a url on our intranet I do not want to communicate with the proxy.  
So my question is, is there a way I can add an exception to my client to force 
it to not attempt to connect to the internet and just search for the url on our 
local intranet?

Just to note, I have attempted to add the proxy information to my client with 
proper credentials but that will not work since the url I want to connect to 
because that dns/ip does not exist on the internet.  I have also tried using 
both the dns ip and hostname for the url and sill have the same issue for both. 
 I have looked through all documentation pertaining to the client and cannot 
find anything addressing this issue.

Thanks in advance,
Chris







Re: MultipartBody Content-Type attributes dropped on upgrade from CXF 2.4.0 to 3.4.1

2016-01-11 Thread Sergey Beryozkin

Hi

This is related to
https://issues.apache.org/jira/browse/CXF-4348?focusedCommentId=13488120=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13488120

The only multipart/* media type that may contain 'start' and 
'start-info' attributes is, AFAIK, multipart/related.


Are you aware of any texts that support these attributes for 
multipart/mixed ?
Even if it not but you do need these attributes when processing 
multipart/mixed payloads then may be we can update the code to set them 
but only if a property requesting it is set, let me know please


Sergey

On 04/01/16 18:40, Jacob Zwiers wrote:


After upgrading Apache CXF from 2.4.0 to 3.4.1, the `Content-Type` header on 
responses from JAX-RS methods have dropped several attributes.

Under CXF 2.4.0, the header is:

 Content-Type: multipart/mixed; type="application/octet-stream"; 
boundary="uuid:61b631f1-0aa9-4cc8-ad85-3c09129ec442"; start=""; 
start-info="application/octet-stream"

Under CXF 3.4.1, it is:

 Content-Type: multipart/mixed; 
boundary="uuid:804168d7-70ed-44e7-a471-9647372b9224"

Note: attributes `type`, `start`, `start-info` missing.

Here's the code we're using:

 @GET
 @Path( "{order_id}/document/{document_id}/file" )
 @Produces("multipart/mixed")
 public MultipartBody getDocument( @PathParam( "order_id") int _orderId,  @PathParam( 
"document_id") int _documentId) throws Exception {

FileInfo fileInfo = findFileInfo( _orderId, _documentId );

List atts = new ArrayList();

File internalFile = fileInfo.getActualFile();

String fileName = fileInfo.getOriginalDocumentName();

String fileSize = String.valueOf( internalFile.length() );

ContentDisposition cd = new ContentDisposition("attachment; filename=\"" + fileName + 
"\"; size=" + fileSize );

InputStream inputStreamToUse = new FileInputStream( internalFile );

Attachment att = new Attachment(fileName, inputStreamToUse, cd);

atts.add( att );

return new MultipartBody(atts, true);   
 }

I can't find any references in the [Migration Guides][1] to changes in this 
area and the style of the above method seems to match the one from the 
[getBooks2() method in the JAX-RS Multipart documentation][2].

Any guidance on what might be causing the different behaviour?

   [1]: http://cxf.apache.org/docs/migration-guides.html
   [2]: http://cxf.apache.org/docs/jax-rs-multiparts.html#highlighter_731760




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: org.apache.cxf.interceptor.Fault: DISPATCHED,initial

2016-01-11 Thread Sergey Beryozkin
]

 at
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractH
TTPDestination.java:604)[158:org.apache.cxf.cxf-rt-transports-http:3.0.7]

 at
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractH
TTPDestination.java:597)[158:org.apache.cxf.cxf-rt-transports-http:3.0.7]

 at
org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream.on
FirstWrite(AbstractHTTPDestination.java:775)[158:org.apache.cxf.cxf-rt-trans
ports-http:3.0.7]

 at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStr
eam.java:47)[148:org.apache.cxf.cxf-core:3.0.7]

 at
org.codehaus.jackson.impl.Utf8Generator._flushBuffer(Utf8Generator.java:1754
)[209:jackson-core-asl:1.9.5]

 at
org.codehaus.jackson.impl.Utf8Generator.flush(Utf8Generator.java:1088)[209:j
ackson-core-asl:1.9.5]

 at
org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1615)[210
:jackson-mapper-asl:1.9.5]

 at
org.codehaus.jackson.jaxrs.JacksonJsonProvider.writeTo(JacksonJsonProvider.j
ava:558)[211:jackson-jaxrs:1.9.5]

 at
org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1381)
[165:org.apache.cxf.cxf-rt-frontend-jaxrs:3.0.7]

 at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSO
utInterceptor.java:235)[165:org.apache.cxf.cxf-rt-frontend-jaxrs:3.0.7]

 ... 41 more



The next REST invocation after this exception gets a random response, from
an unrelated REST method. Also there are timeouts when invoking REST
methods.
I would really appreciate some help with this issue, as aim out of ideas on
this one.


Greetings

Lukasz Bialy





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Exceptions and Async

2016-01-11 Thread Sergey Beryozkin

Hi Benson
On 11/01/16 11:42, Benson Margulies wrote:

Sergey,

I annotate @Suspended. So it is suspended on the first call.


It is not, believe me :-) because this is how I implemented it.
The runtime does not have to physically suspend a call, given that the 
method can immediately call AsyncResponse.resume(). JAXRSInvoker will 
only suspend the thread if no resume/cancel was called by the time the 
method returns. The runtimes are allowed to optimize like this.



The quote I read from the spec says that returned values from @Suspended
calls are ignored. It did not say what the spec says about exceptions from
those calls. If they are also supposed to be ignored, then a big fat WARN
log message would be what I have in mind.
The exceptions escaped from a method are supposed to be caught, 'the 
returned values are ignored' is probably a reference to a 'void' return 
type, but of course a method can immediately do 
asyncResponse.resume(myResponse).


Cheers, Sergey



On Mon, Jan 11, 2016 at 5:17 AM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:


Hi Benson

The very first call into this method does not suspend the continuation, so
there's no need to resume it if the exception is returned.
Do you see a mapped exception response not being returned ? Please clarify

Cheers, Sergey


On 02/01/16 02:01, Benson Margulies wrote:


If I am in a method with an @Suspended AsyncResponse, and I neglect to
catch an exception, CXF runs mappers but they don't do any good, of
course, because nothing resumes the response.

How about if CXF instead logged at ERROR about any exception thrown
through a suspended resource method? I'm assuming that there's no way
to arrange for any uncaught exception to end up as
asyncResponse.resume(e).









--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: async problem ; Illegal State Exception

2015-12-30 Thread Sergey Beryozkin

Hi Benson

Does it happen only when

org.jolokia.osgi.security.BasicAuthenticationHttpContext.handleSecurity

deals with the wrong user credentials, i.e, does it call
HttpServletResponseWrapper.sendError ?

May be that can explain it because that would probably bypass the async 
response channel (Jetty Continuation instance) allocated to a current 
request/response, but I'm only guessing at the moment


Sergey


On 29/12/15 23:11, Benson Margulies wrote:

Removing jolokia made this disappear, so I don't think it belongs
here, however odd it is that it only appeared with the use of CXF
async.

On Tue, Dec 29, 2015 at 2:38 PM, Benson Margulies <ben...@basistech.com> wrote:

I switched some code of mine to use AsyncRequest, and I get some scary
backtraces even though everything seems to be working just fine.

Note the presence of
org.jolokia.osgi.security.BasicAuthenticationHttpContext.handleSecurity
in the backtrace. Now, I am running in Karaf with the jolokia feature
enabled, but until now I had no idea that jolokia was inserting itself
into the process. Can anyone suggest a way to learn anything about
what's happening here?



2015-12-29 14:32:14,328 | WARN  | tp1821513140-131 | HttpChannel
| 150 - org.eclipse.jetty.util - 9.2.10.v20150310 |
/rest/worker/process
java.lang.IllegalStateException: Committed
at 
org.eclipse.jetty.server.Response.resetBuffer(Response.java:1253)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.Response.sendError(Response.java:567)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.Response.sendError(Response.java:544)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)[51:javax.servlet-api:3.1.0]
at 
org.jolokia.osgi.security.BasicAuthenticationHttpContext.handleSecurity(BasicAuthenticationHttpContext.java:49)[164:org.jolokia.osgi:1.3.0]
at 
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:68)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2]
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[146:org.eclipse.jetty.security:9.2.10.v20150310]
at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2]
at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[148:org.eclipse.jetty.servlet:9.2.10.v20150310]
at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:99)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2]
at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.Server.handleAsync(Server.java:553)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:261)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[150:org.eclipse.jetty.util:9.2.10.v20150310]
at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[150:org.eclipse.jetty.util:9.2.10.v20150310]



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: async problem ; Illegal State Exception

2015-12-30 Thread Sergey Beryozkin

Hi
On 30/12/15 13:13, Benson Margulies wrote:

On Wed, Dec 30, 2015 at 6:28 AM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:

Hi Benson

Does it happen only when

org.jolokia.osgi.security.BasicAuthenticationHttpContext.handleSecurity


Sergey, there are no credentials anywhere that I know of. I'm invoking
my endpoint, not jolokia, and my endpoint has no credentials
configured of any kind.


Jolokita context is still invoked though and it affects it somehow, so I 
guess going via its code may shed some light.


Cheers, Sergey





deals with the wrong user credentials, i.e, does it call
HttpServletResponseWrapper.sendError ?

May be that can explain it because that would probably bypass the async
response channel (Jetty Continuation instance) allocated to a current
request/response, but I'm only guessing at the moment

Sergey



On 29/12/15 23:11, Benson Margulies wrote:


Removing jolokia made this disappear, so I don't think it belongs
here, however odd it is that it only appeared with the use of CXF
async.

On Tue, Dec 29, 2015 at 2:38 PM, Benson Margulies <ben...@basistech.com>
wrote:


I switched some code of mine to use AsyncRequest, and I get some scary
backtraces even though everything seems to be working just fine.

Note the presence of
org.jolokia.osgi.security.BasicAuthenticationHttpContext.handleSecurity
in the backtrace. Now, I am running in Karaf with the jolokia feature
enabled, but until now I had no idea that jolokia was inserting itself
into the process. Can anyone suggest a way to learn anything about
what's happening here?



2015-12-29 14:32:14,328 | WARN  | tp1821513140-131 | HttpChannel
 | 150 - org.eclipse.jetty.util - 9.2.10.v20150310 |
/rest/worker/process
java.lang.IllegalStateException: Committed
at
org.eclipse.jetty.server.Response.resetBuffer(Response.java:1253)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.Response.sendError(Response.java:567)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.Response.sendError(Response.java:544)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)[51:javax.servlet-api:3.1.0]
at
org.jolokia.osgi.security.BasicAuthenticationHttpContext.handleSecurity(BasicAuthenticationHttpContext.java:49)[164:org.jolokia.osgi:1.3.0]
at
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:68)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[146:org.eclipse.jetty.security:9.2.10.v20150310]
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2]
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[148:org.eclipse.jetty.servlet:9.2.10.v20150310]
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:99)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2]
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.Server.handleAsync(Server.java:553)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:261)[147:org.eclipse.jetty.server:9.2.10.v20150310]
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[150:org.eclipse.jetty.util:9.2.10.v20150310]
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[150:org.eclipse.jetty.util:9.2.10.v20150310]




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/




Re: Playing with readEntity(String.class)

2015-12-29 Thread Sergey Beryozkin

Hi

This is to do with a default CXF JSONProvider which is Jettison based.

Jettison, historically, escapes forward slashes, I don't know why, it 
was there when I started maintaining it.

What you can do is to configure CXF JSONProvider not to do it, set its
'escapeForwardSlashesAlways' to false.

Or use a Jackson provider instead (if you do - Make sure Jettison is on 
on the classpath)


HTH, Sergey



On 29/12/15 14:40, Vincenzo D'Amore wrote:

Hi All,

I don't understand why when I receive a json encoded string this is not
decoded automatically.
I wrote this code:

 Client client = ClientBuilder.newClient().register(JSONProvider.class);

 WebTarget target = client.target("http://example.org/rest/service1;);
 target = target.queryParam("method", "method1");

 Entity entity = Entity.entity(new
EndpointRequest(""),
MediaType.APPLICATION_JSON);
 Response response = builder.post(entity);

System.out.println( response.getStatus() );

if (response.getStatus() == 200) {

// The problem comes here

String basePath = response.readEntity(String.class);
System.out.println( basePath );
}

The request is successfully executed but basePath contains
"\/opt\/local\/application\/rest\/"  (backslash and double quotes included)

basePath should instead contain this:  /opt/local/application/rest/

It seems to me, the json deserialization hasn't be triggered when it should.

Thanks in advance for your help,
Vincenzo




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Log empty message (with HTTP status code only)

2015-12-29 Thread Sergey Beryozkin
I think it might be because 202 is handled by a oneway processor and the 
outbound chain is not invoked though I might be wrong...


Sergey
On 29/12/15 11:17, Sergey Maslov wrote:

The issue is reproduced for with 202 - Accepted http status.

On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov <therealma...@gmail.com>
wrote:


Hi!
I need to log imcoming requests with corresponsing responses.
According
I add custom LoggingFeature and implement LogEventSender interface.
The messages log fine except messages with emtpty body and
containing http status code only (these are the responses to the service).
According the contract, these messages are needed to be sent.
How could I log them?

--
*Sergey Maslov*








--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Log empty message (with HTTP status code only)

2015-12-29 Thread Sergey Beryozkin

I'm not sure right now, perhaps Aki or Dan may have an idea.
May be you can register a custom Log interceptor, after 
LoggingInInterceptor, that will check CXF message if it is one way 
(there has to be some property set in the message) and log only if it is 
oneway...


Cheers, Sergey
On 29/12/15 18:00, Sergey Maslov wrote:

Sergey, thank you.
But how could I log the fact of 202 response?

Segery Maslov

On Tue, Dec 29, 2015 at 11:55 PM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:


I think it might be because 202 is handled by a oneway processor and the
outbound chain is not invoked though I might be wrong...

Sergey
On 29/12/15 11:17, Sergey Maslov wrote:


The issue is reproduced for with 202 - Accepted http status.

On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov <therealma...@gmail.com>
wrote:

Hi!

I need to log imcoming requests with corresponsing responses.
According
I add custom LoggingFeature and implement LogEventSender interface.
The messages log fine except messages with emtpty body and
containing http status code only (these are the responses to the
service).
According the contract, these messages are needed to be sent.
How could I log them?

--
*Sergey Maslov*








--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/








--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Unit-testing jaxrs:server created by spring

2015-12-28 Thread Sergey Beryozkin

Hi

This is a log info from a CXF Server that is not controlled directly by 
the JAX-RS runtime.
If you have say jaxrs:server/@address="/" then the value of @address is 
what you'll see in the logs,


So you can assume the JAX-RS server address is something like
"http://localhost:8080; + jaxrs:server/@address

Sergey

On 28/12/15 11:51, Maxim Solodovnik wrote:

Hello,

I'm trying to add automatic tests to our build.
our applicationContext.xml
contains 
our tests are subclasses of AbstractJUnit4SpringContextTests
according to the logs server is starting:

17:16:26.901 [main] INFO  org.apache.cxf.endpoint.ServerImpl - Setting the
server's publish address to be /

how can I connect to it using WebClient? what URL should I use?




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


New OAuthDataProvider methods on the trunkk/3.1.x

2015-12-28 Thread Sergey Beryozkin

Hi

I had to update OAuthDataProvider interface and add two methods for 
listing the access and refresh tokens associated with a given OAuth2 
client. Also, AuthorizationCodeDataProvider which extends 
OAuthDataProvider has a new method for listing the pending code grants 
associated with a given Client, so we have


List getAccessTokens(Client)
List getRefreshTokens(Client)
and
List getCodeGrants(Client)

The reason I've done it is that it has become obvious OAuthDataProvider 
interface supports managing the existing tokens/grants in a very limited 
way. It is really important from a management point of view to show all 
the access and/or tokens associated with a given client or user.


I could've introduced new interfaces and made only the utility 
(AbstractOAuthDataProvider) provider shipped with CXF implement them but 
I did not because:
- I felt like that it would add an extra 'noise' into an already complex 
OAuth2 runtime/API - after all, listing the existing tokens is quite a 
fundamental thing which would not be a new 'challenge' for the existing 
provider implementations - they store the tokens, can extract them by 
their ids, so obviously they can get them listed too


I had to do it for 3.1.5-SNAPSHOT because the OIDC module we do in Fediz 
does depend on 3.1.5-SNAPSHOT and we can not wait till 3.2.0 gets 
released (which is quite far away at this point of time).


Hope those who are working with CXF 3.1.4 and doing some custom OAuth2 
servers will not find it difficult to migrate. However if someone thinks 
it can pose some problems for their productions (and this is why I send 
this mail to users) then I can revisit the idea of getting the above 
methods added to dedicated interfaces. Let me know in this thread or 
contact me privately if you prefer


FYI, besides the above changes I've deprecated
OAuthDataProvider.removeAccessToken but will remove it only in 
3.2.0-SNAPSHOT (master). The reason being is that OAuthDataProvider also 
has a revokeToken accepting a token hint which is part of the standard 
oAuth2 token revocation API.
Removing OAuthDataProvider.removeAccessToken will make this interface a 
bit more minimalistic


Thanks Sergey



Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin
lve.java:123)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Caused by: ClientAbortException:  java.net.SocketException: Broken pipe
at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:413)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:366)
at
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:438)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:426)
at
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91)
at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:51)
at
org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:80)
at
com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:1731)
at
com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1070)
at
com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:426)
at
com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider.writeTo(JacksonJsonProvider.java:578)
at
org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1363)
at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:244)
... 36 more
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:366)
at
org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:240)
at
org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:117)
at
org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192)
at org.apache.coyote.Response.doWrite(Response.java:517)
at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:408)
... 49 more

Process finished with exit code 137

{http://X.X.X.X } - It was package name string ,which I hve replaced with
X.X.X.X










--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin
Well, first thing to check is whether this mapper is invoked, note it is 
not auto-discovered by default, unless you explicitly enable the 
auto-discovery, so it needs to be registered in jaxrs:providers.


But even if it is invoked, the problem is you still try to return some 
error message - the runtime will again attempt to write it to the output 
stream which is already terminated.


So make sure it is invoked, then make Throwable more specific and 
finally, do not set an entity on Response


Sergey

On 23/12/15 16:09, Sumit Arora wrote:

I have tried that as well, that didn't work :

@Provider
public class GTMGenericExceptionMapper implements
ExceptionMapper {

 public Response toResponse(Throwable th) {

 ErrorMessage errorMessage = new
ErrorMessage(th.getMessage(),500,"Example Message");
 return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
  .header("Content-Type", "application/json")
 .entity(errorMessage)
 .build();
 }
}

On Wed, Dec 23, 2015 at 9:35 PM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:


Try registering ExceptionMapper and see what happens

Cheers. Sergey

On 23/12/15 16:03, Sumit Arora wrote:


Sergey,

I tried using to write Exception Mapper :

1.Here MapperException - > IOException, ClientErrorException
public class GTMClientExceptionMapper implements
ExceptionMapper {

  public Response toResponse(IOException ce) {

  ErrorMessage errorMessage = new
ErrorMessage(ce.getMessage(),400,"Example : XYZ");
  return Response.status(Response.Status.NOT_FOUND)
  .header("Content-Type", "application/json")
  .entity(errorMessage)
  .build();
  }
}

But it doesn't work, other exception mapper stuff is working ?

May you please tell me If there is something else I supposed to do ? :
JAXRSOutInterceptor.handleWriteException

2. Suggest me one example of this : Another option to try is to wrap
Jackson with a custom JAX-RS MessageBoryWriter and handle the write
exception there.

3.May you suggest any example of this :

Finally, when working with AsyncResponse is used, one might want to
register


https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ConnectionCallback.html

'Sumit


On Wed, Dec 23, 2015 at 7:13 PM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:

Hi


JAXRSOutInterceptor.handleWriteException checks JAX-RS ExceptionMapper so
perhaps you can intercept that Exception and return Response with the
code
only from this exception mapper.

Another option to try is to wrap Jackson with a custom JAX-RS
MessageBoryWriter and handle the write exception there.

Finally, when working with AsyncResponse is used, one might want to
register



https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ConnectionCallback.html

HTH, Sergey

On 23/12/15 11:47, Sumit Arora wrote:

Hi All,


I have made a  web application, which uses Apache CXF on backend. In
many
situation - Client(user) uses the web application to fetch some data to
view ( say click on button) which  CXF web service provide from the
backend, But Client closes the browser, however the cxf web service was
busy to bring the data. So on logs it shows : ClientAbortException. This
behaviour is correct. Its fine.

But I need the help on following :

Is there any way to catch such exception in the CXF webservice code and
logs the customized error message, rather showing complete logs( as
below)
? If Client has aborted the connection then is there any way to handle
such
situation and act accordingly?


[http-bio-8080-exec-2:ERROR] org.apache.cxf.jaxrs.utils.JAXRSUtils:
Problem
with writing the data, class java.util.ArrayList, ContentType:
application/json
[http-bio-8080-exec-2:WARN] org.apache.cxf.phase.PhaseInterceptorChain:
Interceptor for {http://X.X.X.X }GTMDataServiceEndPointImpl
<http://X.X.X.X/%7DGTMDataServiceEndPointImpl> has thrown exception,

unwinding now
org.apache.cxf.interceptor.Fault
at


org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleWriteException(JAXRSOutInterceptor.java:363)
at


org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:266)
at


org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleWriteException(JAXRSOutInterceptor.java:365)
at


org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:266)
at


org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:117)
at


org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:80)
at


org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at


org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:81)
at


org.

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin

Try registering ExceptionMapper and see what happens

Cheers. Sergey
On 23/12/15 16:03, Sumit Arora wrote:

Sergey,

I tried using to write Exception Mapper :

1.Here MapperException - > IOException, ClientErrorException
public class GTMClientExceptionMapper implements
ExceptionMapper {

 public Response toResponse(IOException ce) {

 ErrorMessage errorMessage = new
ErrorMessage(ce.getMessage(),400,"Example : XYZ");
 return Response.status(Response.Status.NOT_FOUND)
 .header("Content-Type", "application/json")
 .entity(errorMessage)
 .build();
 }
}

But it doesn't work, other exception mapper stuff is working ?

May you please tell me If there is something else I supposed to do ? :
JAXRSOutInterceptor.handleWriteException

2. Suggest me one example of this : Another option to try is to wrap
Jackson with a custom JAX-RS MessageBoryWriter and handle the write
exception there.

3.May you suggest any example of this :

Finally, when working with AsyncResponse is used, one might want to register

https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ConnectionCallback.html

'Sumit


On Wed, Dec 23, 2015 at 7:13 PM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:


Hi

JAXRSOutInterceptor.handleWriteException checks JAX-RS ExceptionMapper so
perhaps you can intercept that Exception and return Response with the code
only from this exception mapper.

Another option to try is to wrap Jackson with a custom JAX-RS
MessageBoryWriter and handle the write exception there.

Finally, when working with AsyncResponse is used, one might want to
register


https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ConnectionCallback.html

HTH, Sergey

On 23/12/15 11:47, Sumit Arora wrote:


Hi All,

I have made a  web application, which uses Apache CXF on backend. In many
situation - Client(user) uses the web application to fetch some data to
view ( say click on button) which  CXF web service provide from the
backend, But Client closes the browser, however the cxf web service was
busy to bring the data. So on logs it shows : ClientAbortException. This
behaviour is correct. Its fine.

But I need the help on following :

Is there any way to catch such exception in the CXF webservice code and
logs the customized error message, rather showing complete logs( as below)
? If Client has aborted the connection then is there any way to handle
such
situation and act accordingly?


[http-bio-8080-exec-2:ERROR] org.apache.cxf.jaxrs.utils.JAXRSUtils:
Problem
with writing the data, class java.util.ArrayList, ContentType:
application/json
[http-bio-8080-exec-2:WARN] org.apache.cxf.phase.PhaseInterceptorChain:
Interceptor for {http://X.X.X.X }GTMDataServiceEndPointImpl
<http://X.X.X.X/%7DGTMDataServiceEndPointImpl> has thrown exception,

unwinding now
org.apache.cxf.interceptor.Fault
at

org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleWriteException(JAXRSOutInterceptor.java:363)
at

org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:266)
at

org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleWriteException(JAXRSOutInterceptor.java:365)
at

org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:266)
at

org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:117)
at

org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:80)
at

org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at

org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:81)
at

org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at

org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at

org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:243)
at

org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
at

org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:197)
at

org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
at

org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
at

org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
at

org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:211)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at

org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at

org.apa

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin
As I have already said, return Response with the error code only. 
Returning null indicates to the runtime that the mapping has not been 
done in which case it has to rethrow the original exception.


If returning a response with the code only does not help then move to 
the alternative 2 (write your own MessageBodyWriter which will 
internally delegate to Jackson MessageBodyWriter - it will be loaded 
inside your custom MBW, and register it instead of Jackson with the 
endpoint).


If that does not work - move to the alternative 3. Introduce 
AsyncResponse first into your code (see for ex AsyncResponse package 
docs), and then once you have it, you will be able to register the 
callback with this AsyncResponse


Sergey
On 23/12/15 16:28, Sumit Arora wrote:

It comes here on exception mapper :

public class GTMClientExceptionMapper implements
ExceptionMapper {

 public Response toResponse(IOException ce) {

   //  ErrorMessage errorMessage = new
ErrorMessage(ce.getMessage(),400,"Exmaple Message ");

 return null;
// return Response.status(Response.Status.NOT_FOUND)
 //.header("Content-Type", "application/json")
  //   .build();
 }
}

I tried to various stuff, but still throw the error, any guess here ?

On Wed, Dec 23, 2015 at 9:45 PM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:


Well, first thing to check is whether this mapper is invoked, note it is
not auto-discovered by default, unless you explicitly enable the
auto-discovery, so it needs to be registered in jaxrs:providers.

But even if it is invoked, the problem is you still try to return some
error message - the runtime will again attempt to write it to the output
stream which is already terminated.

So make sure it is invoked, then make Throwable more specific and finally,
do not set an entity on Response

Sergey


On 23/12/15 16:09, Sumit Arora wrote:


I have tried that as well, that didn't work :

@Provider
public class GTMGenericExceptionMapper implements
ExceptionMapper {

  public Response toResponse(Throwable th) {

  ErrorMessage errorMessage = new
ErrorMessage(th.getMessage(),500,"Example Message");
  return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
   .header("Content-Type", "application/json")
  .entity(errorMessage)
      .build();
  }
}

On Wed, Dec 23, 2015 at 9:35 PM, Sergey Beryozkin <sberyoz...@gmail.com>
wrote:

Try registering ExceptionMapper and see what happens


Cheers. Sergey

On 23/12/15 16:03, Sumit Arora wrote:

Sergey,


I tried using to write Exception Mapper :

1.Here MapperException - > IOException, ClientErrorException
public class GTMClientExceptionMapper implements
ExceptionMapper {

   public Response toResponse(IOException ce) {

   ErrorMessage errorMessage = new
ErrorMessage(ce.getMessage(),400,"Example : XYZ");
   return Response.status(Response.Status.NOT_FOUND)
   .header("Content-Type", "application/json")
   .entity(errorMessage)
   .build();
   }
}

But it doesn't work, other exception mapper stuff is working ?

May you please tell me If there is something else I supposed to do ? :
JAXRSOutInterceptor.handleWriteException

2. Suggest me one example of this : Another option to try is to wrap
Jackson with a custom JAX-RS MessageBoryWriter and handle the write
exception there.

3.May you suggest any example of this :

Finally, when working with AsyncResponse is used, one might want to
register



https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ConnectionCallback.html

'Sumit


On Wed, Dec 23, 2015 at 7:13 PM, Sergey Beryozkin <sberyoz...@gmail.com



wrote:

Hi



JAXRSOutInterceptor.handleWriteException checks JAX-RS ExceptionMapper
so
perhaps you can intercept that Exception and return Response with the
code
only from this exception mapper.

Another option to try is to wrap Jackson with a custom JAX-RS
MessageBoryWriter and handle the write exception there.

Finally, when working with AsyncResponse is used, one might want to
register




https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ConnectionCallback.html

HTH, Sergey

On 23/12/15 11:47, Sumit Arora wrote:

Hi All,



I have made a  web application, which uses Apache CXF on backend. In
many
situation - Client(user) uses the web application to fetch some data
to
view ( say click on button) which  CXF web service provide from the
backend, But Client closes the browser, however the cxf web service
was
busy to bring the data. So on logs it shows : ClientAbortException.
This
behaviour is correct. Its fine.

But I need the help on following :

Is there any way to catch such exception in the CXF webservice code
and
logs the customized error message, rather showing complete logs( as
belo

Re: FIQL query validation

2015-12-22 Thread Sergey Beryozkin

I've prototyped PropertyNameConverter and did some basic documentation here:

https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Search#JAX-RSSearch-Dealingwithmistypedpropertynames

Cheers, Sergey

On 04/11/15 11:07, Sergey Beryozkin wrote:

Hi

Thanks for experimenting with it, I've been actually keeping this thread
in the 'priority' line because may be we can have Beanspector producing
some default case-insensitive line that would be optionally used without
the user having to build the map manually (unless aliases are used).
Besides, I'm still planning to introduce an interface for more matches
to be possible in principle, should the application wish to do it,
example, from "supplierCod" (a user forgot to type 'e') or
"supplierCodee" (a user typed an extra 'e'), etc, to "supplierCode"

Cheers, Sergey
On 04/11/15 10:52, Diether wrote:

That is actually a great idea. I just tried it and it works fine.
Seems like I was seriously overcomplicating things :-)



--
View this message in context:
http://cxf.547215.n5.nabble.com/FIQL-query-validation-tp5762439p5762553.html

Sent from the cxf-user mailing list archive at Nabble.com.






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: CXF JAX-RS response chunk/buffer size

2015-12-18 Thread Sergey Beryozkin

Hi

It might be possible to control with a non-Servlet, standalone CXF HTTP 
Jetty transport, but perhaps you can configure it with in Tomcat/etc 
server.xml, there might be a way to do it.


Or add a ContainerResponseFilter with HttpServletResponse injected - 
this filter can be shared between all the application endpoints


Sergey

On 18/12/15 06:41, Julien Charon wrote:

   Hi,


Does CXF somehow support the configuration of the response chunk/buffer size 
for Transfer-Encoding: chunked? Until now, using non-CXF/non-JAX-RS 
implementation, I'm doing this by calling 
javax.servlet.ServletResponse.setBufferSize(int). However, I'd like to use 
response streaming as described in 
http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-ResponseStreaming.
One way I can think of is adding the javax.servlet.ServletResponse to my 
methods using the @Context annotation and calling 
javax.servlet.ServletResponse.setBufferSize(int) like before, but I don't know 
if that works and I'd prefer to be able to configure that on a per application 
basis rather than adding that call to each method.


Best regards,
Julien

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.cha...@avitech.aero<mailto:julien.cha...@avitech.aero>

Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero<http://avitech.aero/>

This message may contain confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: RS service method accepting 2 parameters

2015-12-16 Thread Sergey Beryozkin

Hi Max

It is unfortunate Form accepts parameters with String values, I think we 
missed it should be Object instead given that ParamConverterProvider is 
available in JAX-RS 2.0.


form() can deal with MultipartMap - CXF ships MetadataMap which 
implements it, and JAX-RS 2.0 ships a simple implementation too:


https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/core/MultivaluedHashMap.html

You'll still need registering ParamConverterProvider if values are not 
String and the beans do not override toString()


HTH, Sergey




It has to be MultivaluedMap, JAX-RS
On 16/12/15 10:04, Maxim Solodovnik wrote:

Hello All,

I'm currently trying to write RS service accepting 2 objects of different
types as parameters:

ex. code:

@WebService(serviceName="org.apache.openmeetings.webservice.UserWebService")
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Produces({MediaType.APPLICATION_JSON})
@Path("/user")
public class UserWebService {
@POST
@Path("/hash")
public ServiceResult getRoomHash(
@FormParam("user") BeanA user
, @FormParam("options") BeanB options
) throws ServiceException
{}
}

and I'm trying to invoke this method from JUnit test:


ExternalUserDTO user = new ExternalUserDTO();
RoomOptionsDTO options = new RoomOptionsDTO();
Map<String, List> map = new LinkedHashMap<>();
map.put("user", Arrays.asList((Object)user));
map.put("options", Arrays.asList((Object)options));
Response resp = getClient(USER_SERVICE_URL)
.path("/hash")
.form(map);
//throws no body wrapper for LinkedHashMap class

I cannot use .form(new Form().) due to it can only accepts string
parameters

can someone please point me to an example or provide with the hint how this
can be implemented

Thanks in advance





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Async in OSGi / pax-web

2015-12-14 Thread Sergey Beryozkin

Hi Benson

I suspect you may need to avoid depending on the default CXF HTTP 
Transport and deploy your bundle as a web bundle (with web.xml).

Do you work with Aries ? If yes then use CXFBlueprintServlet:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/resources/jaxrs_soap_blueprint/WEB-INF/web.xml

and have a blueprint-web-osgi dependency

Cheers, Sergey


On 13/12/15 18:11, Benson Margulies wrote:

How does the config in
http://cxf.apache.org/docs/servlet-transport.html for async map out in
pax-web?

is there a ConfigAdmin param that gets set?





Re: CXF 3.0.7 JAXRS POST read body

2015-12-14 Thread Sergey Beryozkin

Hi

Perhaps it is supposed to work with JAX-RS, so I've fixed it as part of
https://issues.apache.org/jira/browse/CXF-6709

I'd still recommend you to avoid dealing with Servlet request/response 
directly - one of the main ideas of JAX-RS was to provide a 
simpler/alternative mechanism.


Thanks, Sergey

On 14/12/15 08:23, Julien Charon wrote:

   Hi everybody,


I am currently refactoring a REST application whose implementation is based on 
a subclass of javax.servlet.http.HttpServlet and thus is using 
javax.servlet.http.HttpServletRequest and 
javax.servlet.http.HttpServletResponse quite extensively to use CXF and JAXRS.
The refactored version of the application extends 
org.apache.cxf.transport.servlet.CXFNonSpringServlet and is using a service 
class which defines methods using the javax.ws.rs.core.Context annotation to 
obtain HttpServletRequest objets, e.g.

 @POST
 public void doPost(@Context HttpServletRequest request, 
@Context HttpServletResponse response)  {
...
 }

Now, for GET operations this works as expected. When I try to read the body of 
a POST request using the javax.servlet.ServletRequest.getInputStream(), the 
returned InputStream ist empty.
According to JAX-RS spec, I guess I could extend my method to something like

 @POST
 public void doPost(@Context HttpServletRequest request, 
@Context HttpServletResponse response, String body)  {
...
 }

in order to get the body. However, I'd like to avoid that because I don't want 
to change the existing application implementation too much.
So  I have 2 questions:

1.   Why does javax.servlet.ServletRequest.getInputStream() return an 
InputStream that contains no data whe I using CXF? This work fine in the old 
style of the application.

2.   What can I do to be able to read the body that way using CXF?


Viele Grüße,
Julien

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.cha...@avitech.aero<mailto:julien.cha...@avitech.aero>

Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero<http://avitech.aero/>

This message may contain confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


Re: Async in OSGi / pax-web

2015-12-14 Thread Sergey Beryozkin

Hi Benson

It likely can be controlled from jetty.xml in pax-web (enabling the 
async mode) but as we have learnt recently, pax web only checks 
jetty.xml if a full blown war or web bundle is deployed.
Web Bundle is your regular bundle, with only web.xml added to it, plus 
an extra WebAppContext instruction in Manifest


Sergey


On 14/12/15 15:09, Benson Margulies wrote:

On consideration, I really don't want to get involved in a web.xml if
I can avoid it. I'm not using the stock http transport as things are,
somehow the code from the service factory plugs itself into the
pax-web universe. I think I'll do some sleuthing.


On Mon, Dec 14, 2015 at 9:22 AM, Benson Margulies <ben...@basistech.com> wrote:

I have avoided blueprint in favor of DS but both are in karaf so I can
probably go there.

On Dec 14, 2015 12:00 PM, "Sergey Beryozkin" <sberyoz...@gmail.com> wrote:


Hi Benson

I suspect you may need to avoid depending on the default CXF HTTP
Transport and deploy your bundle as a web bundle (with web.xml).
Do you work with Aries ? If yes then use CXFBlueprintServlet:


https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/resources/jaxrs_soap_blueprint/WEB-INF/web.xml

and have a blueprint-web-osgi dependency

Cheers, Sergey


On 13/12/15 18:11, Benson Margulies wrote:


How does the config in
http://cxf.apache.org/docs/servlet-transport.html for async map out in
pax-web?

is there a ConfigAdmin param that gets set?








--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


<    2   3   4   5   6   7   8   9   10   11   >