Archive for December, 2009

jQuery Post With HDA Payload

In a previous post I covered some examples of using jQuery with Content Server as well as a component to help facilitate testing out some of this functionality. Dan Kozlowski asked in the comments and over here on the Oracle ECM Forums about how he might use jQuery when the INPUT has HDA ResultSet data. He gives the following example:

@Properties LocalData
IdcService=EDIT_USER
dName=jsmith
dFullName=Jennifer Smith
dUserAuthType=Local
dPassword=password
dEmail=jsmith@stellent.com
dUserType=MKT
dUserLocale=English-US
@end
@ResultSet UserAttribInfo
2
dUserName
AttributeInfo
jsmith
role,admin,15,role,contributor,15
@end
   

There are two magical parts to get this to work. First, you need to set the REQUEST (not response) content type. Second, your payload has to be in a certain format. Let’s look at each of these in turn.

First, here’s a sneak peek of the jQuery AJAX request:

$.ajax(
{
   type: “POST”
   , contentType: “text/hda; charset=utf-8″
   , url: “”
   , data: jQuery(“#txtData”).html()
   , success: function(msg)
   {
      alert(msg);
   }
   , error: function(msg)
   {
      alert(“Error: ” + msg);
   }
});

Notice the contentType setting!

Now, the payload, specified by the variable named data, has to be in a certain format. This format should start with IsJava=1 and be followed by the encoding and finally the first ResultSet known as LocalData. LocalData will contain the IdcService to be called, and a variety of over key/value pairs. At the end of that set we can include additional necessary ResultSets.

I have added an Edit User Sample HCSP for you to download and play with. Check this HCSP into your content server, go to Doc Info and click the web viewable link. The page will load with a text area and a button. Adjust the data in the text area and click submit!

Play around with it some and you should see how this all works together!

Dan, thanks for what turned out to be a fun puzzle.

Good Forum Discussion on Accounts

There has been some good discussion going on over on the Oracle ECM Forums regarding Accounts. It started out as Accounts and Access Control Lists but it has morphed a little into some discussion about how to use Accounts in general and some possible structures people are using to layout their account hierarchies.

Check out these discussions about accounts in the Oracle ECM Forums:

http://forums.oracle.com/forums/thread.jspa?threadID=1001039&tstart=0

Output to Log

One of the easiest ways to see what might be going wrong, or right, in Content Server is the use of trace sections on the System Audit page. Trace sections allow you a great variety of control over what kind of information shows up in the server output.


See this former blog entry for more detailed information about tracing:


Content Server Tracing and Creating Your Own Custom Trace Sections


Refreshing the Server Output to show you what is going on can get annoying though. If you add this entry to General Configuration or config.cfg and restart you can get server output to be written to disk:


UseRedirectedOutput=true


To find the log on the disk look under the directory that is appropriate for your Operating System.


Windows: <install dir>/bin/IdcServerNT.log


Linux: <install dir>/etc/log


Now that you have found the log, it would be easier to keep an eye on what’s going on by using something like the tail command in Linux/UNIX. The tail command, with the -f switch will continuously show the data being added to the log file. In Linux you simply use this command:


tail -f /etc/log


There are several applications available that add similar functionality for windows:


http://tailforwin32.sourceforge.net/
http://www.baremetalsoft.com/baretail/index.php
http://www.withdata.com/tail4win.html