Hi all-
I've got a service I've written which extends ResourceConfig and contains
a setter method to pass in a configuration string. How can I call that
setter from the Grizzly server at init time?
@Provider
@Singleton
@Path("/entitlement")
public class EntitlementResource extends ResourceConfig {
String entitlementStoreClass =
SampleEntitlementsStore.class.getName();
public void setEntitlementStoreClass(String entitlementStoreClass) {
this.entitlementStoreClass = entitlementStoreClass;
}
....
}
My Grizzly Server:
public class EntitlementResourceServer {
/**
* Starts Grizzly HTTP server exposing JAX-RS resources defined in
this application.
*
* @return Grizzly HTTP server.
*/
public static HttpServer startServer(String baseUri, String
entitlementStoreClass) {
// create a resource config that scans for JAX-RS resources and
providers in com.idfconnect.security.entitlements package
final ResourceConfig rc = new
ResourceConfig().packages("com.idfconnect.security");
// HOW DO I CONFIGURE THE APPLICATION HERE?
// create and start a new instance of grizzly http server exposing
the Jersey application at BASE_URI
return
GrizzlyHttpServerFactory.createHttpServer(URI.create(baseUri), rc);
}
}
Richard Sand | CEO
IDF Connect, Inc.
2207 Concord Ave, #359
Wilmington | Delaware 19803 | USA
Office: +1 888 765 1611 | Fax: +1 866 765 7284
Mobile: +1 267 984 3651