Programming__WebObjects-Web Applications-Development-Custom Resource Manager

Version 2.1 by smmccraw on 2007/07/08 09:45

Petite Abeille

Here is a little example on how to write your own WOResourceManager:

The main methods to implement are urlForResourceNamed() and bytesForResourceNamed().

  • urlForResourceNamed simply build an URL for a resource from wherever you would like (eg a jar file). Unfortunately, urlForResourceNamed uses pathForResourceNamed so you will need to rewrite that also:
Error

There is no valid license for Pro Macros. Please visit the Licenses section.

  • bytesForResourceNamedsimplyretrievearesourcefromwhereveryouwouldlike(egajarfile):
Error

There is no valid license for Pro Macros. Please visit the Licenses section.

  • Last but not least, you need to take care of those funky WOURLValuedElementData so dataForResourceNamed will work:
Error

There is no valid license for Pro Macros. Please visit the Licenses section.

  • Finally, you need to register your resource manager with WOApplication:
Error

There is no valid license for Pro Macros. Please visit the Licenses section.

Handling of languages and frameworks are left as an exercise to the reader.

Category:WebObjects