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
public class GeneratePageAction extends ServiceableAction implements ThreadSafe
Call the BO for getting a page content and stores it in the local cache.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static String
__BACKOFFICE_JSESSION_ID
private CacheAccessManager
_cacheAccess
private CacheAccessCounter
_cacheAccessCounter
private BackOfficeRequestProxyExtensionPoint
_requestHeaderEP
-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description GeneratePageAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_copyHeaders(Request request, Response response, org.apache.http.HttpResponse cmsResponse, String[] names)
Copy some response headers from the back-office.private String
_encodeRequestedUrl(Request request)
protected CacheAccessCounter
_getCacheAccessCounter()
Get the cache access counterprotected CacheAccessManager
_getCacheAccessManager()
Get the cache access managerprivate void
_log(String message)
private void
_redirect(org.apache.http.HttpResponse cmsResponse, Redirector redirector, String page, boolean permanent)
private void
_transposeCookies(Request request, Response response, org.apache.http.HttpResponse cmsResponse)
protected void
_writePageOnDisk(String decodedPage, org.apache.http.HttpResponse cmsResponse)
Read the page from the back-office response and write it into the cache.Map
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
protected File
getFile(File root, String pagePath)
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
-
-
-
-
Field Detail
-
__BACKOFFICE_JSESSION_ID
static final String __BACKOFFICE_JSESSION_ID
- See Also:
- Constant Field Values
-
_cacheAccess
private CacheAccessManager _cacheAccess
-
_cacheAccessCounter
private CacheAccessCounter _cacheAccessCounter
-
_requestHeaderEP
private BackOfficeRequestProxyExtensionPoint _requestHeaderEP
-
-
Constructor Detail
-
GeneratePageAction
public GeneratePageAction()
-
-
Method Detail
-
service
public void service(ServiceManager sManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
_getCacheAccessCounter
protected CacheAccessCounter _getCacheAccessCounter()
Get the cache access counter- Returns:
- the CacheAccessCounter
-
_getCacheAccessManager
protected CacheAccessManager _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
-
_encodeRequestedUrl
private String _encodeRequestedUrl(Request request)
-
_redirect
private void _redirect(org.apache.http.HttpResponse cmsResponse, Redirector redirector, String page, boolean permanent) throws Exception
- 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.
-
_transposeCookies
private void _transposeCookies(Request request, Response response, org.apache.http.HttpResponse cmsResponse)
-
_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.
-
-