Railo Extension - Ram Resource Info

November 12, 2009 · By webrat · 5 Comments

Gert just tweeted about the "Ram Resource Info" being available on the preview site ( http://preview.getrailo.org/ExtensionProvider.cfc ). I thought I'd take a moment to show you how to install and use it.

Step 1.

Log into your local web context ( example: http://{your host}/railo-context/admin/web.cfm ) and underneath Extensions click on Providers. Type in "http://preview.getrailo.org/ExtensionProvider.cfc" into the input field and click save. Screenshot

Step 2. (Optional)

You can verify that this is working by clicking on the checkbox next to the provider and clicking the Verify button. Screenshot

Step 3.

Now that is done, go ahead and click on Extension-> Applications. Select the "Ram Resource Info" radio button and click Install. Screenshot - Once installed, you'll see a success message.

Using Ram Resource Info

If you did everything above correctly, you should see a new item in your navigation underneath Plugin called Ram Resource Info. Click on it and you'll see the application. Screenshot

At the moment, it doesn't look like it's doing much, but if we write up some CFML to populate the VFS (Virtual File System) - ram:///, we can see it in action.

Sample CFML Code to populate the VFS

<cfloop index="file" from="1" to="10">
<cfset fileWrite('ram:///test#file#.txt','blah')>
</cfloop>
<cfdirectory action="create" directory="ram:///stuff">
<cfloop index="file" from="1" to="10">
<cfset fileWrite('ram:///stuff/test#file#.txt','blah')>
</cfloop>

So, this is basically creating test1.txt -> test10.txt with the content of 'blah'. It's also creating a sub-directory called 'stuff' and creating 10 more text files inside of it. Go ahead and run the code (btw, there will be no output).

After running the code, go back and take a look at the Ram Resource Info page now and it should resemble this screenshot. As you can see, you can view all the files and folders in the ramdrive. You can download the files. You can navigate into the sub-directory called 'stuff' and see what files are available. You can navigate back up to the main ram drive space and then you can also use the check boxes available to delete particular files.

Hope this is useful and if there are any issues, please let us know!

Tags: Community · Extension · Preview

5 responses so far ↓

  • 1 Adrian Lynch // Nov 12, 2009 at 12:41 PM

    Is there a reason this works in web but not server admin?
  • 2 Todd Rafferty // Nov 12, 2009 at 2:52 PM

    I actually had to research this, but the answer is yes there is a good reason.

    I wasn't aware of this until just this morning, but ram:/// is specific to each web context. Case in point, my screenshots were showing everything I did on http://testbed/ - I went over to my http://localhost/ and installed the application and my ram:/// is empty.
  • 3 Tony Garcia // Nov 12, 2009 at 3:14 PM

    I haven't really played with the VFS features of ColdFusion 9 (or Railo, for that matter). But I heard the guys on the CFHour podcast say that VFS in CF9 should probably be disabled on shared hosts because because the RAM memory can be accessed accross the entire instance. (I don't have any first-hand experience with this, it's just what I heard the guys say).
    If that's true, I think it's actually cool that Railo implemented VFS so that each web context gets its own RAM space.
  • 4 Todd Rafferty // Nov 12, 2009 at 4:43 PM

    @All: Gert provided information for how you can get started on a &quot;global&quot; ram://
    ----
    Another thing. At the moment the ram resource is defined in each web context’s railo-web.xml.cfm file. The definition looks like this:

    &lt;resource-provider
    scheme=&quot;ram&quot;
    class=&quot;railo.commons.io.res.type.ram.RamResourceProvider&quot;
    arguments=&quot;case-sensitive:true;lock-timeout:1000;&quot;/&gt;

    If you now copy the above definition to the railo-server.xml file like follows:

    &lt;resource-provider
    scheme=&quot;gram&quot; &lt;&lt;&lt; this scheme just says something like global RAM
    class=&quot;railo.commons.io.res.type.ram.RamResourceProvider&quot;
    arguments=&quot;case-sensitive:true;lock-timeout:1000;&quot;/&gt;

    and restart the server, you could actually use a global ram resource in order to share files across the server. You can of course use any other scheme for it. Then after that you can use it like this:

    &lt;cffile action=”copy” source=”c:\temp.txt” destination=”gram:///test.txt”&gt;
  • 5 Todd Rafferty // Nov 12, 2009 at 4:46 PM

    Please note in the 2nd &lt;resource-provider&gt; he changed the name from &quot;RAM&quot; to &quot;GRAM&quot;.

Leave a Comment

Leave this field empty: