Chapter 11. Java-Backed Web Scripts

WHAT'S IN THIS CHAPTER?

  • Understanding Java-backed Web scripts

  • Implementing a Java Folder Listing Web script

  • Creating a new kind of Web script

In this chapter, you will discover how to develop Java-backed Web scripts, which are Web scripts whose controller implementation is written in Java, rather than JavaScript. You might be wondering why you would need to dive into Java, when JavaScript Web scripts seem to cater to most requirements. Although rare, Java-backed Web scripts are useful when:

  • Accessing Alfresco Content Application Services not available via the JavaScript API

  • Interacting with systems whose only API is exposed via Java

  • Overriding how responses are rendered, such as to stream large content

  • Performance is absolutely critical

Unlike scripted Web scripts, Java-backed Web scripts require more tooling for their development. The Java source code has to be compiled, then packaged, and finally deployed to the Alfresco Content Application Server. This means deeper knowledge of the Alfresco architecture is required, such as knowing how Alfresco employs the Spring Framework for registering and binding together Java components.

Although this seems daunting, it's not that different from developing a scripted Web script, especially if you're already familiar with Java. A Java-backed Web script (as shown in Figure 11-1) has a very similar construction to that of a scripted Web script.

Figure 11.1. FIGURE 11-1

The primary difference is that a Java class replaces ...

Get Professional Alfresco: Practical Solutions for Enterprise Content Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.