You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,6 +218,21 @@ Register a custom mapper for any media type via `Builder.bodyMapper(mediaType, m
218
218
219
219
User-supplied mappers take precedence over built-in defaults, so you can override any of the above.
220
220
221
+
#### Restricting to the loopback interface
222
+
223
+
By default the server binds to the wildcard address (all local interfaces). To restrict it to loopback — useful for local development or sidecar processes — supply a bind address:
224
+
225
+
```java
226
+
importjava.net.InetAddress;
227
+
228
+
OpenApiServer.builder()
229
+
.spec(spec)
230
+
.handlers(handlers)
231
+
.port(8080)
232
+
.bindAddress(InetAddress.getLoopbackAddress())
233
+
.build();
234
+
```
235
+
221
236
### Response decorators
222
237
223
238
`Builder.responseDecorator(...)` registers a `ResponseDecorator` — a `(Request, Response) -> Response` transform applied to every handler's return value before rendering. Decorators compose in registration order: the result of one is fed to the next. Decorator-supplied headers override handler-supplied ones; if you want the opposite, set the header inside the handler with `Response.withHeader(...)`.
0 commit comments