Blog

Luis Majano

May 10, 2010

Spread the word


Share your thoughts

With ColdBox 3.0.0 you can use any kind of regular expression with your SES routes which makes it extremely flexible.  One way to accomplish this is by using the constraints arguments when calling the addRoute() method to add a routing entry. So if I wanted to add a placeholder that matches a regex then I would do this:

addPattern(pattern="/api/:format/", constraints={format="(xml|json)"})

As you can see from the code above, the constraints argument is a structure in which the keys match a :placeholder in the pattern string.  Then you start of the values with a parenthesis so the expression can be grouped and match and then I place my regex, which in my case is a simple xml or json value.  However, you can get very funky and use your own regular expressions on ANY placeholder.

Add Your Comment

Recent Entries

Ortus June 2024 Newsletter!

Ortus June 2024 Newsletter!

Welcome to the latest edition of the Ortus Newsletter! This month, we're excited to bring you highlights from our sessions at CFCamp and Open South Code, as well as a sneak peek into our upcoming events. Discover the latest developments in BoxLang, our dynamic new JVM language, and catch up on all the insightful presentations by our expert team. Let's dive in!

Maria Jose Herrera
Maria Jose Herrera
June 28, 2024
BoxLang June 2024 Newsletter!

BoxLang June 2024 Newsletter!

We're thrilled to bring you the latest updates and exciting developments from the world of BoxLang. This month, we're diving into the newest beta release, introducing a new podcast series, showcasing innovative integrations, and sharing insights from recent events. Whether you're a seasoned developer or just getting started, there's something here for everyone to explore and enjoy.

Maria Jose Herrera
Maria Jose Herrera
June 28, 2024
BoxLang 1.0.0 Beta 3 Launched

BoxLang 1.0.0 Beta 3 Launched

We are thrilled to announce the release of BoxLang 1.0.0-Beta 3! This latest beta version is packed with exciting new features and essential bug fixes, including robust encryption functionality, enhanced Java interoperability, and more efficient event handling. Key highlights include the introduction of query caching capabilities, seamless coercion of Java Single Abstract Method (SAM) interfaces from BoxLang functions, and support for virtual thread executors. So, let’s dive into the details of what’s new in BoxLang 1.0.0-Beta 3 and how you can start leveraging these updates today!

Luis Majano
Luis Majano
June 28, 2024