coldbox-request-context

Centralizes Rocket.Chat message sending, editing, and retrieval behind a unified interface.

1|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ColdBox/skills --skill coldbox-request-context
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coldbox-request-context
Source: https://github.com/ColdBox/skills/tree/main/coldbox/request-context
Command: npx skills add https://github.com/ColdBox/skills --skill coldbox-request-context

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes access to request data and response control in ColdBox by providing clear patterns for reading and writing public and private request collections, inspecting HTTP metadata, handling AJAX and REST payloads, and managing flash-scoped data across redirects.

Core Features & Use Cases

  • Request collection management: Read and write rc (public) and prc (private) collections, use event.getValue and event.getPrivateValue for defaults and existence checks.
  • HTTP introspection and body parsing: Detect HTTP methods, check isAjax/isSSL, read headers and raw or JSON bodies for REST handlers.
  • Response control and navigation: Render views with or without layouts, render JSON responses, set headers and status codes, suppress rendering, and relocate/redirect including named and external routes.
  • URL generation and flash patterns: Build links reliably with buildLink, persist ephemeral data across redirects with flash (including persistence and clearing), and implement PRG and AJAX-response patterns.
  • Use Case: Implement a listing that returns JSON for AJAX requests and full HTML for normal requests while safely populating prc for views and preserving form errors in flash across a redirect.

Quick Start

In a handler, use event.getValue to read parameters, set prc.user from your userService, use flash.put to store one-request messages if needed, and call event.setView to render the target template.

Frequently Asked Questions about coldbox-request-context

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I read and write request collection data in ColdBox handlers?

ColdBox request collections centralize request data access by using event.getValue and event.getPrivateValue to read public rc and private prc values with defaults and existence checks. You write to these collections to pass data from handlers to views.

How do I detect AJAX requests and parse JSON bodies in ColdBox?

ColdBox RequestContext detects AJAX requests using the isAjax method and parses HTTP metadata by reading headers and raw or JSON bodies. This allows REST handlers to inspect HTTP methods and handle payloads for API endpoints.

What is the best way to preserve form errors across a redirect in ColdBox?

Flash scope persistence in ColdBox stores ephemeral data across redirects using flash.put. This implements the Post/Redirect/Get pattern by preserving form errors or status messages for one request cycle until the target handler renders.

How do I generate URLs and build links with ColdBox routes?

The buildLink function in ColdBox RequestContext generates URLs reliably for named and external routes. It supports URL generation for navigation, redirects, and link construction within handlers and views.

Can I render different responses for JSON and HTML in the same ColdBox handler?

ColdBox RequestContext controls response rendering by detecting isAjax and switching between JSON responses and full HTML views. You can set headers, status codes, suppress rendering, or render views with or without layouts from a single handler.

Does ColdBox RequestContext support HTTP method detection for REST handlers?

ColdBox RequestContext supports HTTP method detection, isSSL checks, and header parsing for REST handlers. It centralizes HTTP introspection to read raw or JSON bodies and manage response status control for API endpoints.