The GST Site Foundation comes with a couple of samples:
The project show some of the mostly used coding features of GSF. It is meant as a showcase for the possibilities and code constructs. Happy browsing.
A in groovy implemented ObjectFactory that is used in for sites or when the site is not known yet. If in a site specific object factory a service is not defined, the one from this class is used.
Compare the file with an Spring XML file. We believe that this construct is easier to manage.
An ObjectFactory specific for the mysite site. The site selection is based on the ics variable site.
A Action by the name of root. If GST/Dispatcher SiteEntry sets an argument action=root then this is the default action used, unless the action is overwritten by the GET or POST request.
This allows for easy override of the default RenderPageAction. This RenderPageAction is the default action that is used if no action parameter is provided.
A skeleton sample of a service
Domain bean used by the SolrSearchService.
Interface of a service definition.
A ObjectFactory that extends IcsBackedOjectFactoryTemplate. This is an alterbative approach to the groovy ObjectFactories.
A sample on how to get your beans from Spring, aka Spring integration.
An example FactoryProducer that uses Spring to create the services. This is used by SpringAppContext.
An example of a AppContext. This is usefull if you want to do deeper level modifications.
A rudimentary sample of an AppContext for your company.
A sample Seed (java bridge from an XML element) to help with Device Detection.
An example on how to create a bean from an asset, making use of all the helpers in the AssetAccessTemplate.
A domain bean used in ProductInfoAcessTemplate.
A domain bean used in ProductInfoAcessTemplate.
An Action that shows the use of ProductInfoAccessTemplate.
An unfinished sample on how to do redirection based on different devices.
A sample action showing the use of a search service.
A sample action showing the use of a service.
A showcase of reading the current asset (based on c/cid) and an asset associaton, and putting them on the model, so the JSP template can use then in JSP Expression Language, ie $asset.name.
A sample Layout template.
A sample detail template.
This sample does is a showcase for coding. It does not include vanity urls, as this would involve changing content assets.
To install this sample you need to add the gst-foundation-all.jar to WEB-INF/lib, add the groovy-all.jar as mentioned in the install guide. The copy the gsf-groovy directory from the gsf-sample-avisports project folder to WEB-INF/gsf-groovy. Restart appserver. The use csdt command tools to export the existing code assets to the workspce. The copy the content from gsf-sample-avisports/csdt into that folder in such a way that the src folders map. After that import thew workspace with csdt.
Use for instance the following command line script.
java -cp ./ContentServer/11.1.1.6.0/csdt-client-1.2.jar com.fatwire.csdt.client.main.CSDT \ http://localhost:8080/cs/ContentServer username=fwadmin password=xceladmin \ resources='Template:*;CSElement:*;SiteEntry:*' \ datastore=tmp/avi fromSites=avisports cmd=export
After copying the csdt folder files issue:
java -cp ./ContentServer/11.1.1.6.0/csdt-client-1.2.jar com.fatwire.csdt.client.main.CSDT \ http://localhost:8080/cs/ContentServer username=fwadmin password=xceladmin \ resources='Template:*;CSElement:*;SiteEntry:*' \ datastore=tmp/avi cmd=import
Generic ObjectFactory, used in all sites, to create services to be used in Actions, via the @InjectForRequest annotation.
Specific ObjectFactory, only used in avisports site. This complements the generic ObjectFactory and the out of the box IcsBackedObjectFactory. For this factory to be selected the site parameter at the beginning of the element needs to be correct. This means that one should be carefull if you use a generic GST/Dispatcher element for all sites and the site param is not set correcttly. Use of this inside Template is mostly predictable.
A named action, in this case root, that is aware of locale and device. It will select the correct translated asset based on browser preferences, or explicitly choosen locales, as well as device types (dekstop, mobile,tablet). It will try to dispatch to the device specific layout template, for instanace 3ColumnLayout_mobile, if the asset has a 3ColumnLayout template specified.
Action for creating a link to an ArticleCategory.
Action for creating a link to a Page.
Action for creating a link to a the Home page.
Action for the Summary templates.
Action for creating a link to a AVIArticle.
This is a sample of an Action defined in a CSElement. In this case the action can be manged in the same way as any CSElement and can be published.
This is a GSF Dispatcher element. Because avisports does not make use of a outer wrapper, this is an addition. The sample code in this project for the link builder is not changed to make use of Wrapper. If you call the site via this wrapper, the device detection and asset locale selection is kicked in.
Sample urls to use the wrapper:
http://localhost:8080/cs/ContentServer?c=Page&pagename=Wrapper&childpagename=avisports/Page/HomeLayout&cid=1327351719456
http://localhost:8080/cs/ContentServer?c=Page&pagename=Wrapper&childpagename=avisports/Page/SectionLayout3&cid=1327351719525
To change avisports to make use of Vanity urls, you would need to register VirtualRoot assets, set the path fields of all the assets, set up a webserver with the rewrite rules. For all the assets that are not vanity assets you would need to change the actions that create links to dispatch to the wrapper.