In order to create a war file to serve a DirectMemory instance, you can:
In the first release, the DirectMemory Server use a single instance of DirectMemory cache and configured via System Properties:
Add a dependency to the server core artifact:
<dependency> <groupId>org.apache.directmemory.server</groupId> <artifactId>directmemory-server</artifactId> <version>0.2</version> </dependency>
Map the DirectMemory servlet in your web.xml:
<servlet> <servlet-name>DirectMemoryServlet</servlet-name> <servlet-class>org.apache.directmemory.server.services.DirectMemoryServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>DirectMemoryServlet</servlet-name> <url-pattern>/cache/*</url-pattern> </servlet-mapping>
Use the following command line.
mvn archetype:generate \ -DarchetypeGroupId=org.apache.directmemory.server \ -DarchetypeArtifactId=server-example-archetype \ -DarchetypeVersion=0.2
If you want to use a SNAPSHOT version you must add: -DarchetypeRepository=https://repository.apache.org/content/repositories/snapshots/
Now you have a simple war project configured to be a DirectMemory Server.
Try the provided sample with running mvn tomcat7:run and hit your browser to http://localhost:9091/dm/