[BLOSSOM-38] Add a mechanism for testing whether a controller is executed within pre-execution Created: 21/Jan/11  Updated: 30/Jan/15  Resolved: 12/Dec/14

Status: Closed
Project: Blossom
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.7, 3.0.5

Type: Improvement Priority: Neutral
Reporter: Tobias Mattsson Assignee: Tobias Mattsson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

In controllers its often necessary to find out if the controller is being pre-executed or not. In order to take different actions. This can be done by testing if the http method is POST, but that might not be specific enough since a POST can happen to the page for other reasons. It's also possible to test for it by looking at the state kept by the pre-execution mechanism. But there should be a recommended and documented way of finding out.

Possibly also as an argument directly to controllers, for instance:

@RequestMapping("/contactform")
public String handleRequest(ExecutionStatus executionStatus)

{...}

or

@RequestMapping("/contactform")
public String handleRequest(@PreExecutionStatus boolean preexecuting) {...}

 Comments   
Comment by Tobias Mattsson [ 21/Nov/14 ]

Implemented as a static utility method

info.magnolia.module.blossom.preexecution.PreexecutionUtils.isPreexecuting()
Generated at Sun Feb 11 23:29:30 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.