pedestal

zeitstein 2025-08-15T08:38:10.313929Z

I'm migrating from 0.6.4 to 0.8.0-rc-1. This is the route table in 0.8:

├────────┼────────────────┼──────────────────────────────────────────────┤
│   :get │              / │ :home                                        │
│   :get │         /*path │ :io.pedestal.service.resources/get-resource  │
│   :get │     /:id/*rest │ :rest-redirect                               │
│   :get │           /:id │ :by-block                                    │
│  :post │           /api │ :api                                         │
│   :get │         /login │ :login                                       │
│  :post │         /login │ :login-post                                  │
│  :post │        /logout │ :logout                                      │
│  :post │        /upload │ :upload                                      │
│   :get │ /uploads/*file │ :io.pedestal.http.ring-middlewares/file      │
└────────┴────────────────┴──────────────────────────────────────────────┘
Same as in 0.6, apart from the first route. Previously I used https://tonsky.me/blog/pedestal/#routing for route conflicts and was looking forward to using :sawtooth to achieve the same. I did not anticipate the conflict on the get-resource route (it never triggers!). To be clear, this is an issue with my own routes, but I thought I'd share in case others are considering migrating. TLDR: My 0.6 resource paths haven't changed, but they lead to conflicting routes with the new approach in 0.8.

hlship 2025-08-20T20:02:07.274699Z

Odd that you're having a problem; the :home and get-resource routes should not conflict; though a the get-resource and :by-block routes will conflict when the path is just one term (:by-block will win).

zeitstein 2025-08-15T08:39:27.845769Z

Now I'm wondering how did this even work in 0.6 🙂 It's nice that 0.8 makes this explicit. I'm not yet sure how to resolve this. Probably will add a segment to the resource path. That seems like the 'safest' change to make.

sirwobin 2025-08-15T10:11:08.613949Z

Do you want that interceptor to serve file resources that do exist when no other route matches?

sirwobin 2025-08-15T10:15:55.833889Z

If so, you can modify the interceptors in the service map which touch all calls, regardless of routing. Detect that it's missing like the https://pedestal.io/api/0.8/io.pedestal.service.interceptors.html#var-not-found does, check if the file resource exists and serve it if so.

sirwobin 2025-08-15T10:18:10.158189Z

Might be better to have explicit file routes instead though. Perhaps the https://pedestal.io/pedestal/0.8/reference/resources.html is helpful.

zeitstein 2025-08-15T11:26:41.447099Z

Yep, I think I'm going to do (resource-routes {:resource-root "public" :prefix "/ui" ...}) and move all relevant files (and URLs...) from resource/public to resource/public/ui. So the resources path will be /ui/*path.

zeitstein 2025-08-15T11:24:20.269859Z

For 0.8 Jetty websockets, how can I do the equivalent of setIdleTimeout and setMaxTextMessageSize? I've found nothing in tests. Digging around the source, it seems that servlet-interceptor/create-server-endpoint-config is the way to go? But the Java docs are proving impenetrable so far 😅

sirwobin 2025-08-16T07:10:15.418979Z

Make an issue, discuss it with @hlship then make a PR. I did this recently for some SSL handling in Jetty and it didn't take long (a week from start of discussion to accepted PR if I recall). My changes were merged around 0.8-beta-1. If you act quickly, maybe it could be part of 0.8 release.

1
sirwobin 2025-08-16T07:11:05.787439Z

I've not used web sockets on pedestal yet so haven't much to add but I'm watching with interest. 🙂

zeitstein 2025-08-15T11:41:01.732609Z

I like the look of io.pedestal.websocket/create-server-endpoint-config, but that doesn't seem to be a part of the io.pedestal.service.websocket approach which I'm trying out (the route and interceptor approach).

zeitstein 2025-08-15T11:57:44.429539Z

> Digging around the source, it seems that servlet-interceptor/create-server-endpoint-config is the way to go? But the Java docs are proving impenetrable so far 😅 AI tells me:

The jakarta.websocket.server.ServerEndpointConfig.Builder class in Jakarta WebSocket does not directly provide a method to set the idle timeout for a specific server endpoint. The idle timeout is typically managed at the level of the WebSocketContainer or the underlying server implementation (e.g., Tomcat, Jetty).
And similarly for set max text message size.

zeitstein 2025-08-19T07:41:04.805609Z

It is easy enough to add for jetty, at the ws container init. For http-kit, I'm not finding a timeout option. For the max msg size, there's nothing to do – the users can pass the :max-ws opt to create-connector and it is passed down to hk/run-server. Do you want a PR for jetty, @hlship?

sirwobin 2025-08-19T12:25:06.124459Z

You have the most interest and urgency so I'd assume yes. 😉 See the contribution guide above for how to get it done.

1
sirwobin 2025-08-18T09:19:47.814739Z

I forgot to drop a link to https://pedestal.io/pedestal/0.8/contributing.html.

hlship 2025-08-18T15:17:46.069239Z

These sound like things that could be implemented as connector-specific arguments to the connector constructor function for Jetty and for Http-Kit. They're going to be implemented quite differently for each of them.

zeitstein 2025-08-18T15:57:38.616159Z

Hey, @hlship! I assume you're talking about this https://clojurians.slack.com/archives/C0K65B20P/p1755262122279029?thread_ts=1755257060.269859&cid=C0K65B20P? Does that mean that there is currently no way to set these opts for the io.pedestal.service.websocket/websocket-interceptor way of using websockets? Would you like a PR or do you prefer to impl this yourself?