I would like to build own REST service on domino. I’ve tried sample from ExtLib github source - ‘DAS - Domino REST service’ - com.ibm.domino.services.sample.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Create_your_own_Domino_REST_service_using_DAS
I’ve not found how to inject my own context to a Resource. My context has connections to several NotesDatabases, probably will have other objects, which I do not want to initialize every time HTTP request is processed.
In fact I use Spring AppContext to store my context object and other beans I need.
So the question is if there is any possibility how to inject some objects (preferably Spring AppContext) to a Resource object.
I look for something like this:
SampleService.java
package com.ibm.domino.services.sample.resources;
...
public class SampleService extends RestService {
>> private ApplicationContext ctx = new ClassPathXmlApplicationContext(...);
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
SAMPLE_SERVICE_LOGGER.getLogger().fine("Adding sample service resources."); // $NON-NLS-1$
classes.add(RootResource.class);
classes.add(ContactsListResource.class);
return classes;
}
...
RootResource.java
package com.ibm.domino.services.sample.resources;
...
@Path("sample") // $NON-NLS-1$
public class RootResource {
>> @Inject / @Autowired
>> private ApplicationContext ctx;
/**
* Gets links.
*
* @param uriInfo
* @return
*/
@GET
public Response getLinks(@Context UriInfo uriInfo) {
...
I’m a beginner in REST. Probably I’m moving in a wrong direction.
I would appreciate any ideas...