web quick start: exploring the web tier
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
2
Brian Remmington
Alfresco Product Architect, WCM
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
4
5
Transfer Service
WQS API WQS API
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
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
8
• Bean “webSiteService” is
a good starting point:
9
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
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
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)
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”
14
15
16
17
18
five-block.ftl
19
bellyband
left1right1
bottom-left bottom-right
20
21
22
bottom-left bottom-right
webscripts/list/wide.get.js
webscripts/list/wide.get.html.ftl
23
left1
24
wiki.alfresco.com
forums.alfresco.com
twitter: @AlfrescoECM