// Path: sample-web-app/src/main/java/com/example/rs/JaxRsApiApplication.java
// @ApplicationPath( "api" )
// public class JaxRsApiApplication extends Application {
// }
// 
// Path: sample-web-app/src/main/java/com/example/rs/PeopleRestService.java
// @Path("/people")
// public class PeopleRestService {
// 	@Inject
// 	private PeopleService peopleService;
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@GET
// 	public Collection<Person> getPeopleList(@QueryParam("page") @DefaultValue("1") final int page) {
// 		return peopleService.getPeople(page, 5);
// 	}
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@Path("/{email}")
// 	@GET
// 	public Person getPeople(@PathParam("email") final String email) {
// 		return peopleService.getByEmail(email);
// 	}
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@POST
// 	public Response addPerson(@Context final UriInfo uriInfo, @FormParam("email") final String email,
// 			@FormParam("firstName") final String firstName, @FormParam("lastName") final String lastName) {
// 
// 		peopleService.addPerson(email, firstName, lastName);
// 		return Response.created(uriInfo.getRequestUriBuilder().path(email).build()).build();
// 	}
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@Path("/{email}")
// 	@PUT
// 	public Person updatePerson(@PathParam("email") final String email, @FormParam("firstName") final String firstName,
// 			@FormParam("lastName") final String lastName) {
// 
// 		final Person person = peopleService.getByEmail(email);
// 
// 		if (firstName != null) {
// 			person.setFirstName(firstName);
// 		}
// 
// 		if (lastName != null) {
// 			person.setLastName(lastName);
// 		}
// 
// 		return person;
// 	}
// 
// 	@Path("/{email}")
// 	@DELETE
// 	public Response deletePerson(@PathParam("email") final String email) {
// 		peopleService.removePerson(email);
// 		return Response.ok().build();
// 	}
// 
// }
// 
// Path: sample-web-app/src/main/java/com/example/services/PeopleService.java
// @Service
// public class PeopleService {
// 	private final ConcurrentMap< String, Person > persons = new ConcurrentHashMap< String, Person >(); 
// 	
// 	public Collection< Person > getPeople( int page, int pageSize ) {
// 		final Collection< Person > slice = new ArrayList< Person >( pageSize );
// 		
//         final Iterator< Person > iterator = persons.values().iterator();
//         for( int i = 0; slice.size() < pageSize && iterator.hasNext(); ) {
//         	if( ++i > ( ( page - 1 ) * pageSize ) ) {
//         		slice.add( iterator.next() );
//         	}
//         }
// 		
// 		return slice;
// 	}
// 	
// 	public Person getByEmail( final String email ) {
// 		final Person person = persons.get( email );
// 		
// 		if( person == null ) {
// 			throw new PersonNotFoundException( email );
// 		}
// 		
// 		return person;
// 	}
// 
// 	public Person addPerson( final String email, final String firstName, final String lastName ) {
// 		final Person person = new Person( email );
// 		person.setFirstName( firstName );
// 		person.setLastName( lastName );
// 				
// 		if( persons.putIfAbsent( email, person ) != null ) {
// 			throw new PersonAlreadyExistsException( email );
// 		}
// 		
// 		return person;
// 	}
// 	
// 	public void removePerson( final String email ) {
// 		if( persons.remove( email ) == null ) {
// 			throw new PersonNotFoundException( email );
// 		}
// 	}
// }


import java.util.Arrays;
import javax.ws.rs.ext.RuntimeDelegate;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import com.example.rs.JaxRsApiApplication;
import com.example.rs.PeopleRestService;
import com.example.services.PeopleService;
package com.example.config;





@Configuration
public class AppConfig {	
	@Bean( destroyMethod = "shutdown" )
	public SpringBus cxf() {
		return new SpringBus();
	}
	
	@Bean @DependsOn( "cxf" )
	public Server jaxRsServer() {
		JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(), JAXRSServerFactoryBean.class );
// Path: sample-web-app/src/main/java/com/example/rs/JaxRsApiApplication.java
// @ApplicationPath( "api" )
// public class JaxRsApiApplication extends Application {
// }
// 
// Path: sample-web-app/src/main/java/com/example/rs/PeopleRestService.java
// @Path("/people")
// public class PeopleRestService {
// 	@Inject
// 	private PeopleService peopleService;
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@GET
// 	public Collection<Person> getPeopleList(@QueryParam("page") @DefaultValue("1") final int page) {
// 		return peopleService.getPeople(page, 5);
// 	}
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@Path("/{email}")
// 	@GET
// 	public Person getPeople(@PathParam("email") final String email) {
// 		return peopleService.getByEmail(email);
// 	}
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@POST
// 	public Response addPerson(@Context final UriInfo uriInfo, @FormParam("email") final String email,
// 			@FormParam("firstName") final String firstName, @FormParam("lastName") final String lastName) {
// 
// 		peopleService.addPerson(email, firstName, lastName);
// 		return Response.created(uriInfo.getRequestUriBuilder().path(email).build()).build();
// 	}
// 
// 	@Produces({ MediaType.APPLICATION_JSON })
// 	@Path("/{email}")
// 	@PUT
// 	public Person updatePerson(@PathParam("email") final String email, @FormParam("firstName") final String firstName,
// 			@FormParam("lastName") final String lastName) {
// 
// 		final Person person = peopleService.getByEmail(email);
// 
// 		if (firstName != null) {
// 			person.setFirstName(firstName);
// 		}
// 
// 		if (lastName != null) {
// 			person.setLastName(lastName);
// 		}
// 
// 		return person;
// 	}
// 
// 	@Path("/{email}")
// 	@DELETE
// 	public Response deletePerson(@PathParam("email") final String email) {
// 		peopleService.removePerson(email);
// 		return Response.ok().build();
// 	}
// 
// }
// 
// Path: sample-web-app/src/main/java/com/example/services/PeopleService.java
// @Service
// public class PeopleService {
// 	private final ConcurrentMap< String, Person > persons = new ConcurrentHashMap< String, Person >(); 
// 	
// 	public Collection< Person > getPeople( int page, int pageSize ) {
// 		final Collection< Person > slice = new ArrayList< Person >( pageSize );
// 		
//         final Iterator< Person > iterator = persons.values().iterator();
//         for( int i = 0; slice.size() < pageSize && iterator.hasNext(); ) {
//         	if( ++i > ( ( page - 1 ) * pageSize ) ) {
//         		slice.add( iterator.next() );
//         	}
//         }
// 		
// 		return slice;
// 	}
// 	
// 	public Person getByEmail( final String email ) {
// 		final Person person = persons.get( email );
// 		
// 		if( person == null ) {
// 			throw new PersonNotFoundException( email );
// 		}
// 		
// 		return person;
// 	}
// 
// 	public Person addPerson( final String email, final String firstName, final String lastName ) {
// 		final Person person = new Person( email );
// 		person.setFirstName( firstName );
// 		person.setLastName( lastName );
// 				
// 		if( persons.putIfAbsent( email, person ) != null ) {
// 			throw new PersonAlreadyExistsException( email );
// 		}
// 		
// 		return person;
// 	}
// 	
// 	public void removePerson( final String email ) {
// 		if( persons.remove( email ) == null ) {
// 			throw new PersonNotFoundException( email );
// 		}
// 	}
// }


// Path: sample-web-app/src/main/java/com/example/config/AppConfig.java
import java.util.Arrays;
import javax.ws.rs.ext.RuntimeDelegate;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import com.example.rs.JaxRsApiApplication;
import com.example.rs.PeopleRestService;
import com.example.services.PeopleService;

package com.example.config;





@Configuration
public class AppConfig {	
	@Bean( destroyMethod = "shutdown" )
	public SpringBus cxf() {
		return new SpringBus();
	}
	
	@Bean @DependsOn( "cxf" )
	public Server jaxRsServer() {
		JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(), JAXRSServerFactoryBean.class );
		factory.setServiceBeans( Arrays.< Object >asList( peopleRestService() ) );