Questions and Answers from latest beta test




Firefox 3.0 is giving me errors about unsupported API on openSSL
Firefox added a check that only allows valid certificates (also disallowing self-signed ones). You can click on "Add exception..." and have it allow you to use the included self-signed one. If you plan on going live you should get a certificate signed by a recognized authority, the provided one is purely for development.



Can I generate images on the fly?
Yes, AOS uses gdlib (wrapped by AGdLib), see AOSOutput_generate_image.cpp for an example (in AOS_Example module). Here is the sample code (based on the aforementioned source file) for creating a blank 100x100 canvas and drawing 2 lines on it:
 // Create a blank canvas 
 const int x=100, y=100;
 AGdCanvas canvas(x,y);
 
 // draw 2 lines on it
 canvas.drawLine(0, 0, x-1, y-1, gdTrueColor(200,100,250));
 canvas.drawLine(x-1, 0, 0, y-1, gdTrueColor(200,100,250));

 // emit the canvas as a PNG image to the output buffer
 canvas.emitPNG(context.useOutputBuffer());
 
 // set the MIME type for PNG image
 context.useResponseHeader().setPair(AHTTPHeader::HT_ENT_Content_Type, ASW("image/png",9));

AGdCanvas is very simple in functionality but gives you access to the gdImagePtr struct from gdlib and supports all the advanced functions provided by the libraries included with AGdLib project (gd, freetype, libjpeg, libpng)



Can I gracefully shut the server down?
Yes, connect to the admin site (port 12345 by default) and select the Shutdown! (click on the explamation point).



I am getting an error in my controller how can I figure out where it is?
Use the AOSContextManager in the admin console (http://localhost:12345/) and find your request. If there was an error you will see a red exclamation point next to the context, you can then expand the context to get details. If you want a finer grained event history you can set the log_level on that page to 5 (DEBUG) and re-execute the URL, each context now will have detailed log of the execution.



How can I clear the template cache during development?
If you are developing you can turn the caches off in the conf/AObjectServer.xml configuration file. To do it to a running server: use the admin console and select AOSCacheManager object, it alllows clearing and disabling of the caches. Currently template cache and static cache are exposed.



How do I create a custom project or module?
See AOS_Modules/new_AOS_Project.HOWTO.txt, it explains how to create a new project with a new module. Also look at AObjectServer/AOS_BaseModules/ and projects in AOS_Modules/ for examples on how to create custom input processors, modules and output generators.



Why is my custom module not being loaded?
You have to add your project to the conf/AObjectServer.xml so that it loads that DLL: <load> <module>AOS_BaseModules</module> <module>AOS_DadaData</module> <module>AOS_Test</module> <module>AOS_Example</module> <module>AOS_Forum</module> <module>AOS_Blog</module> <module>AOS_Wiki</module> <module>AOS_Classified</module> <module>AOS_User</module> <module>AOS_MyCustomProject</module> </load> This will now load the AOS_MyCustomProject.dll and call aos_register function, it will then register you custom input processors, modules and/or output generators. From the sample project:
extern "C" AOS_SAMPLEPROJECTUPPERCASE_API int aos_register(
  AOSInputExecutor& inputExecutor, 
  AOSModuleExecutor& moduleExecutor, 
  AOSOutputExecutor& outputExecutor, 
  AOSServices& services
)
{
  services.useLog().add(ASWNL("AOS_SAMPLEPROJECT: aos_register"), ALog::INFO);

  //Register input processors
  inputExecutor.registerInputProcessor(...);

  //Register modules
  moduleExecutor.registerModule(...);
  
  //Register output generators
  outputExecutor.registerOutputGenerator(...);

  return 0;
}



What are ASW and ASWNL macros used for?
These are simple wrappers around static string constants and essentially call AString::wrap(...). AString is a buffered and efficient string object designed for web based output (by allocating in blocks to minimize resize during appends). ARope is even more efficient but sacrifices random access performance for append efficiency. ARopeDeque is optimized for push/pop operations of read/write buffers. Anyhow, most of the calls take AString or even more generically AOutputBuffer or AEmittable as parameters, this allows you to use quoted text without creating lots of temporary objects.
  context.useEventVisitor().addEvent(ASW("This is an event",16));  // macro specifies a quoted string and its length (avoids a call to strlen())
  context.useEventVisitor().addEvent(ASWNL("This is an event"));   // macro specifies a quoted string and calls strlen()



Why can't AXmlDocument and AXmlElement support full xpath?
AXmlElement and AXmlDocument were built for fast XML document generation and with ability to quickly access nodes inside. XPath contains many hidden perforamnce hits which I chose to avoid. You can think of AXmlElement as a node with attributes that contains an ordered list of other AXmlElement types thus it is a tree. AXmlDocument contains a root node and XML instructions.