How to limit concurrent requests served by resource?

2016-01-15 Thread Vjacheslav V. Borisov
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 ?


Accessing init-param in spring with servlet transport

2016-01-15 Thread Paul Millar

Hi,

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.


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/


[Discuss] Working with secured JMS in weblogic requires InitialContext stay open per thread

2016-01-15 Thread Christian Schneider
I am working on a JMS issue reported by Guillaume. He reported that a 
secured weblogic jms can not be accessed with the

current JMS transport.

The reason seems to be that Weblogic seems to establish a security 
context on the thread when the InitialContext is opened.

It will remove that context when the InitialContext is closed.

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

The problem is that we currently only create the InitialContext when 
retrieving the ConnectionFactory or when looking up a Destination from 
JNDI close it directly after.
For most jms providers this seems to be fine but weblogic complains with 
a SecurityException when the Consumer is opened outside that context. A 
similar problem also appears on the sending side.


I have now committed a first part of the proposed change from Guillaume. 
It makes sure the InitialContext is opened before on creating the 
Consumer on the listener threads of the MessageListenerContainer. This 
seems to work fine and should not have a big performance impact.


The problem is rather on the client side. We currently open a new 
session and producer for each message we send. This is not a big problem 
as both of these objects are cheap to create.
It will be different though if we also need to make sure an 
InitialContext is open. I am not sure but I assume that creating an 
InitialContext might involve a remote connection and so it might impact 
the performance quite

severly.

Does anyone have experience with secured Weblogic and possible 
performance impacts?

Are there better solutions ?

Christian


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com



RE: CXF remove some namespaces

2016-01-15 Thread Neng.Xu
I have a similar requirement which is to remove unused namespaces from SOAP 
message dynamically. 
As Daniel indicated " JAXB adds namespaces prefixes on the root for every 
namespace it knows about so it doesn't have to do it later"
JAXB adds namespace prefixes based on service xml schema. 

A real SOAP message normally  does not contains every xml element defined by 
schema because optional XML element does not show up if it does not have data.
Therefore the namespaces of unused xml elements in the message are not needed. 
I have a web service having 250+ namespace (huge isn't it?).  The SOAP message 
contains 250+ line namespace prefix regardless how many elements being used in 
SOAP message. 
To reduce a SOAP message size, I am looking for a way to dynamically remove 
unused namespace prefix based on the xml elements used in the SOAP message.
Since each SOAP message uses different set of elements, unused namespaces are 
different accordingly.
What I did in AXIS world is to add a handler to find out unused namespace and 
remove them.

Is there way I can do it in  CXF JAXB?


Thanks

Ed


-Original Message-
From: Daniel Kulp [mailto:dk...@apache.org] 
Sent: Thursday, January 14, 2016 2:33 PM
To: users@cxf.apache.org; Roberto Bottoni - AfterBit
Subject: Re: CXF remove some namespaces


> On Jan 13, 2016, at 8:34 AM, Roberto Bottoni - AfterBit 
>  wrote:
> 
> Hi,
> CXF add automatically the following "namespaces" to Command_Cryptic and also 
> creates its prefixes (ns6, ns70...)  :
> 
> >> xmlns:ns6="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; >
> 
> and i cannot find why (and how) CXF add those namespaces
> for instance my package-info.java file is :

This is a JAXB thing.   JAXB adds namespaces prefixes on the root for every 
namespace it knows about so it doesn't have to do it later.   

Unfortunately, it's also not easy to "change" that behavior.  CXF's JAXB data 
binding has two maps on it that can be used to adjust some of the namespaces.  
One or both might be modifiable to test this.If you grab the DataBinding 
object out of the client, you should be able to call either:

void setNamespaceMap(Map namespaceMap) or public void 
setContextualNamespaceMap(Map contextualNamespaceMap)
to put in a map of URI to prefix.   I know they allow complete control over 
what the prefixes that are used (instead of ns6, ns7, etc...), but I also 
believe that if they are specified, JAXB doesn't output all of them up front.  
Not 100% sure on that though.

Dan





> @javax.xml.bind.annotation.XmlSchema(namespace = 
> "http://xml.afterbit.com/HSFREQ_07_3_1A;, elementFormDefault = 
> javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
> package com.afterbit.xml.hsfreq_07_3_1a;
> 
> maybe some other CXF configuration has to be done?
> 
> 
> 
> 
> - Original Message - From: "Sergey Beryozkin" 
> 
> To: 
> Sent: Wednesday, January 13, 2016 1:07 PM
> Subject: Re: CXF remove some namespaces
> 
> 
>> 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/;>
>>> 
>>> >> xmlns:wsse="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">
>>> >> wsu:Id="UsernameToken-371dcf1d-2ef6-4e29-8b96-eedd053fdf69">
>>> MYUSER
>>> >> Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-userna
>>> me-token-profile-1.0#PasswordDigest">QTh0CuaMLVIUpyLCM8vvobZZg28=>> sse:Password>
>>> 
>>> >> EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-ws
>>> s-soap-message-security-1.0#Base64Binary">B2BolkOOPUgz4uXRDQJlJA==>> wsse:Nonce>
>>> 
>>> 2016-01-12T15:58:31.142Z
>>> 
>>> 
>>> >> xmlns="http://www.w3.org/2005/08/addressing;>http://webservices.afte
>>> rbit.com/HSFREQ_07_3_1A
>>> 
>>> >> xmlns="http://www.w3.org/2005/08/addressing;>urn:uuid:59eeb370-c04c-
>>> 4457-bd77-b67784c37eab
>>> 
>>> >> xmlns="http://www.w3.org/2005/08/addressing;>https://test.webservice
>>> s.afterbit.com/MYUSER
>>> 
>>> http://www.w3.org/2005/08/addressing;>
>>> http://www.w3.org/2005/08/addressing/anonymous
>>> 
>>> >>