function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pcalpcal 

Getting 'raw' output from a controller

Is there a way to get the 'raw' output of an Apex controller or VisualForce page?

My problem:

I'm trying to wire up the extjs tree control to display a tree of my custom objects.  The extjs tree widget wants a URL that will describe the tree structure in JSON format.

I can generate the JSON, and I can display it in a visualforce page per the docs, but that includes the entire application frame; I need to be able to give the widget a URL to the raw JSON document.

What is the best way to go about doing this kind of thing?

Thanks very much in advance.  (And apologies if I'm missing something obvious - I'm a newbie).
jwetzlerjwetzler
It should be safe to use core.apexpages.devmode.url=1

We use that for loading pages without the development mode footer so it should give you what you need.

To get rid of the doctype use the contentType on your page tag.

Code:
<apex:page contentType="text/html" showHeader="false" >
</apex:page>

 

pcalpcal
Brilliant!  That does the trick.  Thanks very much to you both.
dchasmandchasman
I would recommend using contentType="text/plain" ("text/javascript", or some other non-HTML mime type value) which will automatically suppress the header, remove the doctype, etc.


Message Edited by dchasman on 07-16-2008 08:48 AM
pcalpcal
Right, I'm using text/javascript.  Thanks.
valpvalp
Did you get this to work ?