JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(BookStore.class);
//default lifecycle is per-request, change it to singleton
sf.setResourceProvider(BookStore.class,
new SingletonResourceProvider(new BookStore()));
KerberosAuthenticationFilter filter = new KerberosAuthenticationFilter();
filter.setLoginContextName("KerberosServer");
filter.setCallbackHandler(getCallbackHandler("HTTP/localhost", "http"));
//filter.setLoginContextName("KerberosServerKeyTab");
//filter.setServicePrincipalName("HTTP/ktab");
sf.setProvider(filter);
sf.setAddress("http://localhost:" + PORT + "/");