Add protocol for handling Request & Response
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- clojure
- Ambito
- api, backend-api-design
Direzione di ricerca
Start by reviewing the current ring-spec and the request/response handling in the Jetty adapter, Aleph, and Immutant mentioned in the issue. Compare those interfaces with the proposed RingRequest protocol and the Undertow wrapper context. Done would require an agreed protocol design, compatible implementations for existing server types, and a documented plan for the breaking change.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Many modern Java Web Server (Netty, Undertow, Vert.x) have their own abstractions for Requests and Responses. Current ring-spec states that requests and responses as map-like structures. While this is awesome in abstraction-wise (and the killer feature of Ring), performance-wise it can be bad as data needs to be copied into maps. Copying can be eager (like with the jetty-adapter) for all requests or lazy (like Aleph & Immutant) / on demand, but still things like accessing a single header value forced all headers to be read copied and keys lowercased.
Abstracting the request and response as protocols would allow best of both worlds. A protocol like:
(defprotocol RingRequest
(get-server-port [this])
(get-server-name [this])
(get-remote-addr [this])
(get-uri [this])
(get-query-string [this])
(get-scheme [this])
(get-request-method [this])
(get-protocol [this])
(get-headers [this])
(get-header [this header])
(get-body [this])
(get-context [this]))
could be implemented for maps so that they do the normal lookup, but the Aleph-style zero-copy-request (map-like) classes could implement those directly. (get-header request "Content-Type") would use the already parsed information without any copying.
This would allow low-level libraries to be programmed against effective protocols while keeping everything compatible with maps.
Currently working on a new lightweight and zero-fat new wrapper for Undertow and using a custom request protocol (like the one above) with it, but would not like to tie our other libraries to a server-specific protocols.
All the current web servers having their own request & response (map-like) types would need to conform to the new protocols, so would be a breaking change.
- Lingua principale
- Clojure
- Stelle
- 3.9k
- Fork
- 528
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ring-clojure/ring
-
Typo in wrap-nested-params docstringForse già presa @dajiaohuang l’ha presa 2 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
ring-clojure/ring#546 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
ring-clojure/ring#544 · 3 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ring-clojure/ring#542 · 5 commenti · 2 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ring-clojure/ring#541 · 3 commenti ·
-
[ring-jetty-adapter] No control over exceptions thrown when obtaining item from ISeq response bodyAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ring-clojure/ring#531 · 4 commenti ·
Tutte le issue di ring-clojure/ring
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
category:tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
.Needs Triage .Team/UXWest Priority:P2 Type:Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
metabase/metabase#83998 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno