This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-30
Channels
- # aws (2)
- # beginners (139)
- # boot (9)
- # cider (1)
- # clara (2)
- # cljs-dev (35)
- # cljsrn (3)
- # clojure (112)
- # clojure-dusseldorf (9)
- # clojure-greece (6)
- # clojure-italy (13)
- # clojure-russia (160)
- # clojure-seattle-old (1)
- # clojure-uk (79)
- # clojurescript (85)
- # clojutre (1)
- # community-development (11)
- # core-async (32)
- # cryogen (2)
- # cursive (5)
- # data-science (16)
- # datomic (2)
- # events (1)
- # fulcro (29)
- # funcool (1)
- # graphql (4)
- # immutant (5)
- # instaparse (20)
- # jobs (2)
- # juxt (6)
- # leiningen (11)
- # luminus (21)
- # lumo (1)
- # off-topic (7)
- # onyx (20)
- # parinfer (33)
- # pedestal (4)
- # re-frame (41)
- # reagent (34)
- # ring-swagger (14)
- # rum (5)
- # spacemacs (9)
- # specter (11)
- # sql (14)
- # test-check (3)
- # yada (20)
the documentation on large request bodies mentions an S3 bucket as a container https://juxt.pro/yada/manual/index.html#capturing-large-request-bodies
we stream request bodies to a local tempfile before sending to S3 @stijn iirc because the amazon S3 client makes it easier to deal with files
@mccraigmccraig ok, that seems the easiest solution. Do you use multipart or binary data as the body?
multipart
i can show you our code for the tempfile handling if that would help ?
I'd like to see the multipart handling yes. The docs don't have anything on that right?
ha, don't know now - it's been a while since i did it - i don't think there were any docs then
you can also use an InputStream + metadata for putObject http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Client.html#putObject-java.lang.String-java.lang.String-java.io.InputStream-com.amazonaws.services.s3.model.ObjectMetadata-
iirc you have to specify content-length for that - and we weren't always getting it, so it was easier to stream to a file then upload from there
here's our tempfile handling, and a resource which uses it https://gist.github.com/mccraigmccraig/cc97ae2f0fde1e0bbda7b51e1a0001dd https://gist.github.com/mccraigmccraig/e1f06fc113dd6d86507f758fbd7e0562
Is there a way to override the list of interceptors in a request so that I'm not using certain default Yada interceptors?
I want to write a handler that does not automatically decode the input data when Content-Encoding
is set to gzip
@mccraigmccraig thanks for the hints. turns out it's easier for us on the client to upload every image separately as a binary. makes it a lot easier to process in yada too: https://gist.github.com/stijnopheide/7cf154f0fc7a7dd7ad7487a9ea0473e5
@aengelberg Yep. You can access the interceptors list for a resource under the :interceptors
key after doing yada/resource
on it.
@aengelberg I have a few utils for doing stuff like that over many resources
(defn update-resources [routes f & args]
(walk/postwalk
(fn [x]
(if (or (instance? Resource x)
(instance? Handler x))
(resource (apply f x args))
x))
routes))
and then
(update-resources
yada.handler/insert-interceptor i/invoke-method
add-query
add-command)
I wrote remove-interceptors to pull stuff out which might be useful:
(defn remove-interceptors [res & interceptors]
(let [interceptor-set (set interceptors)]
(update res :interceptor-chain
(partial remove (fn [i]
(contains? interceptor-set i))))))