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, [email protected] 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:[email protected]]
Sent: 23 February 2016 12:34
To: [email protected]
Subject: Re: Adding NCSARequestLog via JAXRSServerFactoryBean
Yeah, the configuration way works, something like
<httpj:engine port="8183">
<httpj:handlers>
<bean class="org.eclipse.jetty.server.handler.RequestLogHandler">
<property name="requestLog">
<bean class="org.eclipse.jetty.server.NCSARequestLog">
<property name="filename" value="/home/ffang/test/tym.log"/>
<property name="filenameDateFormat" value="yyyy_MM_dd"/>
<property name="retainDays" value="90"/>
<property name="append" value="true”/>
….
</bean>
</property>
</bean>
</httpj:handlers>
</httpj:engine>
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On Feb 23, 2016, at 8:13 PM, Sergey Beryozkin <[email protected]> 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&d=CwIFaQ&c=4ZIZThy
kDLcoWk-GVjSLm9hvvvzvGv0FLoWSRuCSs5Q&r=ykXcTN60h3-cXsX5t7kv8zVQwTSxpeA
xKWimPUn10ALTg1Uk6Ao2R1mxc0lzB5Ia&m=tCDKXnNyVwy8AwK0XtEPUZjGzz6XSLoDWQ
YbA4oG-NM&s=_0kGFcXUU-GIcEYu72VvjMaJimjoof7nCUjyHemzUUA&e=
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&d=CwIFaQ&c=4ZIZThykDLcoWk-GVjSLm9hvvvzvGv
0FLoWSRuCSs5Q&r=ykXcTN60h3-cXsX5t7kv8zVQwTSxpeAxKWimPUn10ALTg1Uk6Ao2R1
mxc0lzB5Ia&m=tCDKXnNyVwy8AwK0XtEPUZjGzz6XSLoDWQYbA4oG-NM&s=9K8w1aY1JRY
xpRo7sg1V3BcTWkVKZyB7dLLFMi1MZCw&e=
HTH, Sergey
On 23/02/16 11:56, [email protected] 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&d=CwIFaQ&c=4ZIZThykDLcoWk-GVjSLm9hvvvzvGv0FLoWSRuCSs5Q
&r=ykXcTN60h3-cXsX5t7kv8zVQwTSxpeAxKWimPUn10ALTg1Uk6Ao2R1mxc0lzB5Ia&m
=tCDKXnNyVwy8AwK0XtEPUZjGzz6XSLoDWQYbA4oG-NM&s=MN2PXIbv9RImP4of7wb92Q
3p7Mr6N-Zmk7nDaMryD8k&e= ");
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/