Class MultistepFormsRestController
java.lang.Object
sk.iway.iwcm.components.multistep_form.rest.MultistepFormsRestController
@RestController
@RequestMapping("/rest/multistep-form")
public class MultistepFormsRestController
extends Object
Exposes public HTTP endpoints used while completing a multistep form.
The controller delegates validation and session handling to
MultistepFormsService and converts processing failures into localized JSON
responses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAutocompleteOptions(String formName, Long stepId, Long itemId, String term, jakarta.servlet.http.HttpServletRequest request) org.springframework.http.ResponseEntity<String>getFormStepHtml(String formName, Long stepId, String language, jakarta.servlet.http.HttpServletRequest request) Returns rendered content and saved state for a permitted form step.voidgetTempFilePreview(String formName, String fileKey, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Streams a temporary image that belongs to an upload field in the current form session.org.springframework.http.ResponseEntity<String>saveDraft(String formName, Long stepId, String language, jakarta.servlet.http.HttpServletRequest request) Saves unconfirmed step values without validating or submitting the form.org.springframework.http.ResponseEntity<String>saveForm(String formName, Long stepId, String language, jakarta.servlet.http.HttpServletRequest request) Validates and stores the submitted step, completing the form on its final step.org.springframework.http.ResponseEntity<String>validateField(String formName, Long stepId, String fieldId, String language, jakarta.servlet.http.HttpServletRequest request) Validates one field value without evaluating conditional rules or saving the step.
-
Constructor Details
-
MultistepFormsRestController
-
-
Method Details
-
saveForm
@PostMapping(value="/save-form", params={"form-name","step-id","language"}, consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<String> saveForm(@RequestParam("form-name") String formName, @RequestParam("step-id") Long stepId, @RequestParam("language") String language, jakarta.servlet.http.HttpServletRequest request) Validates and stores the submitted step, completing the form on its final step.- Parameters:
formName- logical form namestepId- submitted step identifierlanguage- language used to localize validation messagesrequest- request containing the JSON payload and form session- Returns:
- JSON result with the next step or localized error details
-
saveDraft
@PostMapping(value="/save-draft", params={"form-name","step-id","language"}, consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<String> saveDraft(@RequestParam("form-name") String formName, @RequestParam("step-id") Long stepId, @RequestParam("language") String language, jakarta.servlet.http.HttpServletRequest request) Saves unconfirmed step values without validating or submitting the form.- Parameters:
formName- logical form namestepId- current step identifierlanguage- language used for error messagesrequest- request containing JSON field values and the form session- Returns:
- success or localized error details; failures leave the current step available
-
validateField
@PostMapping(value="/validate-field", params={"form-name","step-id","field-id","language"}, consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<String> validateField(@RequestParam("form-name") String formName, @RequestParam("step-id") Long stepId, @RequestParam("field-id") String fieldId, @RequestParam("language") String language, jakarta.servlet.http.HttpServletRequest request) Validates one field value without evaluating conditional rules or saving the step.- Parameters:
formName- logical form namestepId- current step identifierfieldId- logical field identifier without the form-instance prefixlanguage- language used to localize validation messagesrequest- request containing the single-field JSON payload and form session- Returns:
- field errors, a bad-request response, or not found when blur validation is disabled
-
getFormStepHtml
@GetMapping(value="/get-step", params={"form-name","step-id","language"}) public org.springframework.http.ResponseEntity<String> getFormStepHtml(@RequestParam("form-name") String formName, @RequestParam("step-id") Long stepId, @RequestParam("language") String language, jakarta.servlet.http.HttpServletRequest request) Returns rendered content and saved state for a permitted form step.- Parameters:
formName- logical form namestepId- requested step identifierlanguage- language used to render localized form contentrequest- request containing the form session- Returns:
- JSON containing step HTML, the DOM identifier prefix, blur-validation setting, conditions, confirmed and draft values, and upload metadata, or an error response
-
getAutocompleteOptions
@GetMapping(value="/autocomplete", params={"step-id","item-id","term"}) public List<LabelValue> getAutocompleteOptions(@RequestParam(value="form-name",required=false) String formName, @RequestParam("step-id") Long stepId, @RequestParam("item-id") Long itemId, @RequestParam String term, jakarta.servlet.http.HttpServletRequest request) -
getTempFilePreview
@GetMapping(value="/temp-file-preview", params={"form-name","file-key"}) public void getTempFilePreview(@RequestParam("form-name") String formName, @RequestParam("file-key") String fileKey, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException Streams a temporary image that belongs to an upload field in the current form session.- Parameters:
formName- logical form namefileKey- temporary upload keyrequest- request containing the form sessionresponse- response receiving the image or a not-found status- Throws:
IOException- when the response cannot be written
-