-
Notifications
You must be signed in to change notification settings - Fork 2
Usage
By adding the springboot row starter dependency, row will be configured to run when your project starts. First of all, in case you want to add the dependency, and not start row, for example in test environments, you can change these configurations in your application.properties:
row.enable = false;
row.ws.enable = false;
By disabling row, websocket is disabled too. But in case you want to make change in default handlers, you better disable ws too so you can override it with your own websocket handlers. By setting row.ws.enable = false
row will not create websocket endpoints for your application, but still scans your packages and creates protocol wrapper.
Other important properties:
# Set prefix for your websocket endpoint. Should be unique in your application
row.ws.prefix = /ws
# Set allowed origins for websocket
row.ws.allowedOrigins = *
# You can also set maxBinaryBuffer, maxTextBuffer, maximumAsyncSendTimeout, maximumSessionIdle for your websocket container
Most of row usage happens through annotations that are provided by spring itself, but you need to know about couple of them that is specific for row.
@RowController: This annotation is used to create a row controller. Its already extending springs RestController, so you might consider changing your RestControllers
to RowControllers
only on the controllers that you want to be scanned by row.
@RowIgnore: In case there are some contoller methods that you want to be skip during controller scanning, you should annotate them with RowIgnore
. This means your application wont serve those endpoints.
@RowQuery: Currently row does not support @RequestParam
annotation by spring. Instead you should create object that contains all your parameters and row will pass parameters to your object.
Spring annotations that are covered in row: @PathVariable
, @RequestBody
, @GetMapping
, @PostMapping
, @PutMapping
, @PatchMapping
, @DeleteMapping
.
If your controller is accepting any other arguments that are not supported by row, row will pass them as null.
One restriction is already mentioned: You should use @RowQuery
for your query string parameters.
You should know that you can not get ServletRequest
or ServletResponse
in your controllers or services too. Row can not pass them when invoking controller methods. Instead, someday, it will pass its own request response objects.
Also, currently you can not upload files through row.
You can add your own filters to row filter chain. All you need to do is to implement RowFilter
interface and then mark it with @Filter
annotation. Your filter will be scanned and will be added before or after RowInvokerFiler
which invokes the controller method.
Idioglossia Lab - ROW - Spring boot starter