Web Quick Start: Exploring the Web Tier

23
2 Brian Remmington Alfresco Product Architect, WCM

description

This session aims to give developers the knowledge they need to take the example WQS website and to develop their own website based on it. Kicking off with a quick demonstration of the website, we'll then take it apart bit by bit to expose the underlying architecture, how requests are handled, the WQS API, and how to write new templates and components.

Transcript of Web Quick Start: Exploring the Web Tier

Page 1: Web Quick Start: Exploring the Web Tier

2

Brian Remmington

Alfresco Product Architect, WCM

Page 2: Web Quick Start: Exploring the Web Tier

3

A quick demonstration

The architecture

How it’s wired together

The WQS API

How requests are handled

Creating and using a new page template

Primary goal:

• To equip you with knowledge of how the web tier of WQS works so

that you can start building your own websites based on it

What we’ll cover

Page 3: Web Quick Start: Exploring the Web Tier

4

Page 4: Web Quick Start: Exploring the Web Tier

5

Transfer Service

WQS API WQS API

Page 5: Web Quick Start: Exploring the Web Tier

6

web.xml

web-application-config.xml

wcmqs-webapp-context.xml

surf-config.xml

Creates Spring

dispatcher servlet

Loads up surf-config and

wcmqs-webapp-context

Bootstraps Surf itself and

defines new default request

handler and interceptors

Other request handlers, view

resolvers, Freemarker

directives, and interceptors

Page 6: Web Quick Start: Exploring the Web Tier

7

• API wired with “wcmqs-api-context.xml”

• Auto-bootstrapped when dropped into a Surf application

• Properties that can be adjusted (with their defaults):

• wcmqs.api.alfresco=http://localhost:8080/alfresco

• wcmqs.api.user=admin

• wcmqs.api.password=admin

• wcmqs.api.alfresco.cmis=%{wcmqs.api.alfresco}/service/cmis

• wcmqs.api.alfresco.webscript=%{wcmqs.api.alfresco}/service/api/

• Override in a file named “wqsapi-custom.properties” in the

“alfresco/extension” folder on the classpath

Page 7: Web Quick Start: Exploring the Web Tier

8

• Bean “webSiteService” is

a good starting point:

Page 8: Web Quick Start: Exploring the Web Tier

9

Page 9: Web Quick Start: Exploring the Web Tier

10

• Executes before the default controller is reached

• Uses the requested URL to find the website, section, and

asset that are being addressed

www.example.com/news/global/financial_outlook_good

• Stores the API objects on the request context with the

names “website”, “section”, and “asset”.

website

section

asset

Page 10: Web Quick Start: Exploring the Web Tier

11

• Wired in to respond

whenever an asset has

been resolved

• Discovers the page name

to be used to render the

asset

• Each section may define

template mappings from

asset type to view name

• Searches up the type

hierarchy first, then the

section hierarchy

Page 11: Web Quick Start: Exploring the Web Tier

12

• org.alfresco.wcm.client.controller.StreamedAssetController

• Provides support for simple-to-generate, permanent URLs

for assets:http://localhost:8081/wcmqs/asset/de2f9b66-6bbd-4347-8f24-4ed06299ad8a

• Slightly faster to generate

• Remains the same when the asset is renamed or moved

• Supports renditions:…/asset/de2f9b66-6bbd-4347-8f24-4ed06299ad8a?rendition=mediumNewsThumbnail

• Still looks for the appropriate template

• Is mapped to the path “/asset/**” (in wcmqs-webapp-

context.xml)

Page 12: Web Quick Start: Exploring the Web Tier

13

• org.alfresco.wcm.client.controller.SearchFormController

• An example of a Spring

Annotation Handler

Search RSS

• org.alfresco.wcm.client.controller.RssController

• Another annotated handler

• Mapped to “**/rss.xml”

Page 13: Web Quick Start: Exploring the Web Tier

14

Page 14: Web Quick Start: Exploring the Web Tier

15

Page 15: Web Quick Start: Exploring the Web Tier

16

Page 16: Web Quick Start: Exploring the Web Tier

17

Page 17: Web Quick Start: Exploring the Web Tier

18

five-block.ftl

Page 18: Web Quick Start: Exploring the Web Tier

19

bellyband

left1right1

bottom-left bottom-right

Page 19: Web Quick Start: Exploring the Web Tier

20

Page 20: Web Quick Start: Exploring the Web Tier

21

Page 21: Web Quick Start: Exploring the Web Tier

22

bottom-left bottom-right

webscripts/list/wide.get.js

webscripts/list/wide.get.html.ftl

Page 22: Web Quick Start: Exploring the Web Tier

23

left1

Page 23: Web Quick Start: Exploring the Web Tier

24

wiki.alfresco.com

forums.alfresco.com

twitter: @AlfrescoECM