webmcp

changeset 454:4e03ecb28665

Do not include _tempstore by default for external URLs
author jbe
date Thu Jul 21 19:19:42 2016 +0200 (2016-07-21)
parents 1b380a0ab940
children e2389cc82214
files framework/env/request/handler.lua framework/env/request/redirect.lua
line diff
     1.1 --- a/framework/env/request/handler.lua	Thu Jul 21 19:13:02 2016 +0200
     1.2 +++ b/framework/env/request/handler.lua	Thu Jul 21 19:19:42 2016 +0200
     1.3 @@ -235,10 +235,12 @@
     1.4      end)
     1.5    elseif redirect_data then
     1.6      redirect_data = table.new(redirect_data)
     1.7 -    redirect_data.params = table.new(redirect_data.params)
     1.8 -    local slot_dump = slot.dump_all()
     1.9 -    if slot_dump ~= "" then
    1.10 -      redirect_data.params._tempstore = tempstore.save(slot_dump)
    1.11 +    if not redirect_data.external or redirect_data.include_tempstore then
    1.12 +      redirect_data.params = table.new(redirect_data.params)
    1.13 +      local slot_dump = slot.dump_all()
    1.14 +      if slot_dump ~= "" then
    1.15 +        redirect_data.params._tempstore = tempstore.save(slot_dump)
    1.16 +      end
    1.17      end
    1.18      http_request:send_status("303 See Other")
    1.19      for i, header in ipairs(request._response_headers) do
     2.1 --- a/framework/env/request/redirect.lua	Thu Jul 21 19:13:02 2016 +0200
     2.2 +++ b/framework/env/request/redirect.lua	Thu Jul 21 19:19:42 2016 +0200
     2.3 @@ -1,14 +1,15 @@
     2.4  --[[--
     2.5  request.redirect{
     2.6 -  external = external,   -- external URL (instead of specifying base, module, etc. below)
     2.7 -  base     = base,       -- optional string containing a base URL of a WebMCP application
     2.8 -  static   = static,     -- an URL relative to the static file directory
     2.9 -  module   = module,     -- a module name of the WebMCP application
    2.10 -  view     = view,       -- a view name of the WebMCP application
    2.11 -  action   = action,     -- an action name of the WebMCP application
    2.12 -  id       = id,         -- optional id to be passed to the view or action to select a particular data record
    2.13 -  params   = params,     -- optional parameters to be passed to the view or action
    2.14 -  anchor   = anchor      -- anchor in URL
    2.15 +  external = external,  -- external URL (instead of specifying base, module, etc. below)
    2.16 +  base     = base,      -- optional string containing a base URL of a WebMCP application
    2.17 +  static   = static,    -- an URL relative to the static file directory
    2.18 +  module   = module,    -- a module name of the WebMCP application
    2.19 +  view     = view,      -- a view name of the WebMCP application
    2.20 +  action   = action,    -- an action name of the WebMCP application
    2.21 +  id       = id,        -- optional id to be passed to the view or action to select a particular data record
    2.22 +  params   = params,    -- optional parameters to be passed to the view or action
    2.23 +  anchor   = anchor,    -- anchor in URL
    2.24 +  include_tempstore = include_tempstore  -- set to true to include slot data via _tempstore param when using external URL
    2.25  }
    2.26  
    2.27  Calling this function causes the WebMCP to do a 303 HTTP redirect after the current view or action and all filters have finished execution. If routing mode "redirect" has been chosen, then this function is called automatically after an action and all its filters have finished execution. Calling request.redirect{...} (or request.forward{...}) explicitly inside an action will cause routing information from the browser to be ignored. To preserve GET/POST parameters of an action, use request.forward{...} instead. Currently no redirects to external (absolute) URLs are possible, there will be an implementation in future though.

Impressum / About Us