Samples JDK
Server.java
1 package com.freemindcafe.apache.cxf.jaxrs.sample4;
2 
3 import java.util.ArrayList;
4 import java.util.List;
5 
6 import org.apache.cxf.interceptor.Interceptor;
7 import org.apache.cxf.interceptor.LoggingInInterceptor;
8 import org.apache.cxf.interceptor.LoggingOutInterceptor;
9 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
10 import org.apache.cxf.message.Message;
11 import org.junit.Test;
12 
13 public class Server {
14 
15  @Test
16  public void send_list_in_the_response() throws Exception{
17  JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
18  sf.setResourceClasses(TicketsResource.class);
19  sf.setAddress("http://localhost:9000/");
20  final List<Interceptor<? extends Message>> list = new ArrayList<Interceptor<? extends Message>>();
21  list.add(new LoggingInInterceptor());
22  list.add(new LoggingOutInterceptor());
23  sf.setInInterceptors(list);
24  sf.create();
25  synchronized (sf) {
26  sf.wait();
27  }
28  }
29 
30 }