5 Replies Latest reply on Sep 14, 2010 10:59 AM by Manik Surtani

    REST access to GUI demo cache

    Edouard Boily Newbie

      Hi
      I am trying to access the GUI demo cache from a REST interface.
      I did deploy the GUI demo on two servers with the following configuration:
      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan
            xsi:schemaLocation="urn:infinispan:config:4.0 http://www.infinispan.org/schemas/infinispan-config-4.0.xsd"
            xmlns="urn:infinispan:config:4.0">
       
         <global>
            <transport clusterName="demoCluster"/>
         </global>
         <default>
            <clustering mode="replication">
               <l1 enabled="true" lifespan="60000"/>
               <hash numOwners="2" rehashRpcTimeout="120000"/>
               <sync/>
               <stateRetrieval fetchInMemoryState="true" />
            </clustering>
         </default>
      </infinispan>
      {code}
      So far so good, the two servers share the cached data and everything works as expected.
      I then installed tomcat and deployed infinispan-server-rest.war in it. Of course I copied the ${infinispan}/gui-demo-cache-config.xml as ${tomcat}/webapps/infinispan-server-rest/WEB-INF/classes/infinispan.xml and I have the following lines in my ${tomcat}/webapps/infinispan-server-rest/web.xml:
      <init-param>
              <param-name>infinispan.configuration</param-name>
              <param-value>infinispan.xml</param-value>
      </init-param>
      When I access localhost:8080/infinispan-server-rest/, I do get the "Welcome to the Infinispan RESTful Server".
      Using the GUI, I put the (key,value)=(1,100) in the cache.
      Now, I expect that when I use my browser and go to localhost:8080/infinispan-server-rest/rest/___defaultCache/1, I would get
      100
      as the answer. But I get
      HTTP Status 404 - The requested resource () is not available.
      I am assuming that the compiled GUI demo uses the DefaultCacheManager and the cache name is ___defaultCache, and this is the one accessed by the REST server. However, when I use the python script sample_python_REST_client.py to play with the REST server, I got the right results (the script stores a key-value pair and gets it back). It seems that the REST server is not connected with the GUI demo cache but its own cache.
      Any idea what I did get wrong? Or am I totally in the far left field?
      Thanks for your help!
      - Edouard

      Hi

       

      I am trying to access the GUI demo cache from a REST interface.

       

      I did deploy the GUI demo on two servers with the following configuration:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <infinispan

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xsi:schemaLocation="urn:infinispan:config:4.0 http://www.infinispan.org/schemas/infinispan-config-4.0.xsd"

            xmlns="urn:infinispan:config:4.0">

       

         <global>

            <transport clusterName="demoCluster"/>

         </global>

       

         <default>

            <clustering mode="replication">

               <l1 enabled="true" lifespan="60000"/>

               <hash numOwners="2" rehashRpcTimeout="120000"/>

               <sync/>

               <stateRetrieval fetchInMemoryState="true" />

            </clustering>

         </default>

      </infinispan>

       

       

       

       

      So far so good, the two servers share the cached data and everything works as expected.

      I then installed tomcat and deployed infinispan-server-rest.war in it. Of course I copied the ${infinispan}/gui-demo-cache-config.xml as ${tomcat}/webapps/infinispan-server-rest/WEB-INF/classes/infinispan.xml and I have the following lines in my ${tomcat}/webapps/infinispan-server-rest/web.xml:

      <init-param>

              <param-name>infinispan.configuration</param-name>

              <param-value>infinispan.xml</param-value>

      </init-param>

       

      When I access localhost:8080/infinispan-server-rest/, I do get the "Welcome to the Infinispan RESTful Server".

       

      Using the GUI, I put the (key,value)=(1,100) in the cache.

      Now, I expect that when I use my browser and go to localhost:8080/infinispan-server-rest/rest/___defaultCache/1, I would get

      100

      as the answer. But I get

      HTTP Status 404 - The requested resource () is not available.

       

      I am assuming that the compiled GUI demo uses the DefaultCacheManager and the cache name is ___defaultCache, and this is the one accessed by the REST server. However, when I use the python script sample_python_REST_client.py to play with the REST server, I got the right results (the script stores a key-value pair and gets it back). It seems that the REST server is not connected with the GUI demo cache but its own cache.

       

      Any idea what I did get wrong? Or am I totally in the far left field?

       

      Thanks for your help!

       

      - Edouard