Front-End Request Lifecycle - Mura Docs v7.0

Front-End Request Lifecycle

While there may be any number of contextual events that are triggered, dependent upon the requested action, the events listed below generally occur during a typical front-end request.

When it comes to the front-end request lifecycle, if you're most interested in the final string of code that will be returned to the browser, then you'll want to be aware of m.event('__MuraResponse__'). That's a double-underscore in front of, and after "MuraResponse". As noted in the lifecycle below, the "MuraResponse" will be sent to the browser.

onGlobalRequestStart
onSiteRequestInit
onSiteRequestStart
  standardEnableLockdownValidator
  standardEnableLockdownHandler // if lockdown enabled
  standardSetContentHandler
  // if `previewid` exists
  standardSetPreviewHandler
  // else
  standardSetAdTrackingHandler
standardWrongFilenameValidator
  standardWrongFilenameHandler // if wrong filename
  standard404Validator
  standard404Handler // contextual: if content item not found
  onSite404
  standardWrongDomainValidator
  standardWrongDomainHandler // if invalid domain
  standardTrackSessionValidator
  standardTrackSessionHandler // if session tracking enabled
  standardSetIsOnDisplayHandler
  standardDoActionsHandler // checks `doaction` (e.g., login, logout, etc.)
  standardSetPermissionsHandler
  standardRequireLoginValidator
  standardRequireLoginHandler // if login required
  standardSetLocaleHandler
  standardMobileValidator
  standardMobileHandler // if `request.muraMobileRequest` and no `altTheme`
standardSetCommentPermissions
  standardDoResponseHandler
standardForceSSLValidator
  standardForceSSLHandler // if necessary
  // This is a great place to put your logic
  // Mura begins compiling the code that will be returned to the browser
  onRenderStart
  // if content type is link
  standardLinkTranslationHandler
  // else if content type is file
  standardFileTranslationHandler
  standardFileTranslator
onBeforeFileRender
  onAfterFileRender
// else
standardTranslationHandler // sets m.event('__MuraResponse__')
  // if `returnformat` is JSON
  standardJSONTranslator
  onAPIResponse
  on{Type}APIResponse
  on{Type}{Subtype}APIResponse
  onAPIError // if an error occurs
  // else
standardHTMLTranslator // parses layout template and renders queues
  // other events could be announced, based on template code
  // `m.dspBody()` invokes several events (and is included in most templates)
  // if event('display') is `search`
onSiteSearchRender
  // else if event('display') is `editprofile`
onSiteEditProfileRender
  // else if event('display') is `login`
onSiteLoginPromptRender
  // else if content is restricted and user not allowed
onContentDenialRender
  // else if content is not on display
onContentOfflineRender
// else if `m.event('display')` is not an empty string
  onDisplayRender // allows you to have custom displays
  // else
  // default body rendering
  on{Type}{Subtype}BodyRender // e.g., onPageDefaultBodyRender
  // if a string isn't returned, then
  on{Type}BodyRender // e.g., onPageBodyRender
  // if a string still isn't returned, then
  // Mura will look for files by content type
  // `../{ThemeName}/content_types/{Type}_{Subtype}/index.cfm`
// Then, `../{ThemeName}/content_types/{Type}/index.cfm`
  // and so forth.
  // See the "Mura Rendering" section for more information
  // Mura has finished compiling the code to return to the browser
// In other words, the train is about to leave the station ...
  onRenderEnd // m.event('__MuraResponse__') is ready
onSiteRequestEnd
onGlobalRequestEnd