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://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, [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("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.<http://site.thomsonreuters.com/site/disclosures/>
>> 
> 

Reply via email to