Class: Ewigkeks::CookiesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ewigkeks/cookies_controller.rb

Instance Method Summary collapse

Instance Method Details

#cacheObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/ewigkeks/cookies_controller.rb', line 16

def cache
  if cookies[Ewigkeks.cache_cookie_name].present?
    response.headers['Content-Type']  = 'text/html'
    response.headers['Last-Modified'] = 'Wed, 30 Jun 2010 21:36:48 GMT'
    response.headers['Expires']       = 'Tue, 31 Dec 2030 23:30:45 GMT'
    response.headers['Cache-Control'] = 'private, max-age=630720000'

    render text: cookies[Ewigkeks.cache_cookie_name]
  else
    head status: :not_modified
  end
end

#etagObject



29
30
31
32
33
34
35
36
# File 'app/controllers/ewigkeks/cookies_controller.rb', line 29

def etag
  if cookies[Ewigkeks.etag_cookie_name].present?
    response.headers['Etag'] = cookies[Ewigkeks.etag_cookie_name]
    render text: cookies[Ewigkeks.etag_cookie_name]
  else
    render text: request.headers.fetch('If-None-Match', ''), status: :not_modified
  end
end

#pngObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/ewigkeks/cookies_controller.rb', line 3

def png
  if cookies[Ewigkeks.png_cookie_name].present?
    response.headers['Content-Type']  = 'image/png'
    response.headers['Last-Modified'] = 'Wed, 30 Jun 2010 21:36:48 GMT'
    response.headers['Expires']       = 'Tue, 31 Dec 2030 23:30:45 GMT'
    response.headers['Cache-Control'] = 'private, max-age=630720000'

    render text: png_blob, content_type: 'image/png'
  else
    head status: :not_modified
  end
end