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.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).
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.
Do you want that interceptor to serve file resources that do exist when no other route matches?
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.
Might be better to have explicit file routes instead though. Perhaps the https://pedestal.io/pedestal/0.8/reference/resources.html is helpful.
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.
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 😅
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.
I've not used web sockets on pedestal yet so haven't much to add but I'm watching with interest. 🙂
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).
> 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.Would be nice to https://github.com/ring-clojure/ring/blob/ff98ba59ec202fdc1eec2d09d9298040ff5975fe/ring-jetty-adapter/src/ring/adapter/jetty.clj#L100-L109.
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?
You have the most interest and urgency so I'd assume yes. 😉 See the contribution guide above for how to get it done.
I forgot to drop a link to https://pedestal.io/pedestal/0.8/contributing.html.
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.
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?