Hi Josh, you should post Ring-related questions here:

https://groups.google.com/forum/?fromgroups#!forum/ring-clojure

To answer your question, it's hard to say without seeing your code.  In
fact, I'm having a hard time reproducing the problem without explicitly
telling ring to serve an HTML file as text/plain--it's showing up as
text/html without me explicitly setting it.

Also, did you mean ring.util.response (
http://ring-clojure.github.io/ring/ring.util.response.html) rather than
ring.util.resource (which doesn't exist as far as I know)?

For a very vanilla example which explicitly sets Content-Type, take a look
at this.  Let's say we had a plain file-response (note again that this is
giving me text/html, but anyways...):


(defn handler [request]
 (resource-response "index.html" {:root "public"}))

If we wanted to explicitly set it as text/html, we could wrap it using the
content-type function:

(defn handler [request]
  (->
   (resource-response "index.html" {:root "public"})
   (content-type "text/html")))

Of course, this is the most basic method--there are smarter ways to do it.
 Check out the Ring wiki for more, especially the section on creating
responses (https://github.com/ring-clojure/ring/wiki/Creating-responses),
static resources (https://github.com/ring-clojure/ring/wiki/Static-Resources)
and Content Types (https://github.com/ring-clojure/ring/wiki/Content-Types).

And again, I would suggest using the Ring list for these questions.

Hope this helps!

Best,
Dave

2013/4/19 Josh Kamau <joshnet2...@gmail.com>

> Hi there ;
>
> Please help. How do i set the ContentType header in a
> (ring.util.resouce/resource-response ) ?
>
> I am serving html file and its being served as plain text.
>
> Josh
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to