Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


In this chapter, we are looking at filtering and validating requests and responses. Filters can help keep the logic in your service simple and easy to maintain, while validators can help with form presentation of errors as well as isolating the validation logic from your services. Filters and validators in ServiceStack provide a huge amount of functionality to simplify your web services. Request-and-response filters allow you to control what happens before a request is processed as well as providing a nice way to do any postprocessing to the response if required. Server-side validation with human-readable messages is always something a web application requires, and ServiceStack validators, along with fluent syntax creates an encapsulated and easy-to-read way of building that functionality into your web application.

The fluent syntax style often leads to code that is more expressive and, thereby, more easily understood. This style is often thought to be richer and more concise...