Package org.ametys.site
Class GeneratePageAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.site.GeneratePageAction
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,ThreadSafe
,Action
Call the BO for getting a page content and stores it in the local cache.
-
Field Summary
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_copyHeaders
(Request request, Response response, org.apache.http.HttpResponse cmsResponse, String[] names) Copy some response headers from the back-office.protected CacheAccessCounter
Get the cache access counterprotected CacheAccessManager
Get the cache access managerprotected void
_writePageOnDisk
(String decodedPage, org.apache.http.HttpResponse cmsResponse) Read the page from the back-office response and write it into the cache.act
(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) protected File
Get the cache file to write for the corresponding page.void
service
(ServiceManager sManager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
GeneratePageAction
public GeneratePageAction()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
_getCacheAccessCounter
Get the cache access counter- Returns:
- the CacheAccessCounter
-
_getCacheAccessManager
Get the cache access manager- Returns:
- the CacheAccessManager
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception -
_copyHeaders
protected void _copyHeaders(Request request, Response response, org.apache.http.HttpResponse cmsResponse, String[] names) Copy some response headers from the back-office.- Parameters:
request
- the front-office client request.response
- the front-office client response.cmsResponse
- the response from the back-office.names
- the header names.
-
_writePageOnDisk
protected void _writePageOnDisk(String decodedPage, org.apache.http.HttpResponse cmsResponse) throws IOException Read the page from the back-office response and write it into the cache.- Parameters:
decodedPage
- the page path.cmsResponse
- the back-office response, containing the page.- Throws:
IOException
- if an error occurs writing the page into the cache.
-
getFile
Get the cache file to write for the corresponding page.- Parameters:
root
- the cache root folder.pagePath
- the page path.- Returns:
- a valid file.
-