Save POST parameters to the cookie or session.

@param req
@param res
556351
public void save(HttpServletRequest req, HttpServletResponse res) {
		AuthenticationResult authResult = new AuthenticationResult(AuthResult.SUCCESS, (String) null);
		save(req, res, authResult);
		List<Cookie> cookieList = authResult.getCookies();
		if (cookieList != null && cookieList.size() > 0) {
			CookieHelper.addCookiesToResponse(cookieList, res);
		}
	}
660862
def POST_query(self, req_hook, req_args):
        '''  '''
        # HTTP POST queries require keyManagerTokens and sessionTokens
        headers = {'Content-Type': 'application/json',
                   'sessionToken': self.__session__,
                   'keyManagerToken': self.__keymngr__}

        # HTTP POST query to keymanager authenticate API
        try:
            if req_args is None:
                response = requests.post(self.__url__ + req_hook,
                                         headers=headers,
                                         verify=True)
            else:
                response = requests.post(self.__url__ + req_hook,
                                         headers=headers,
                                         data=req_args,
                                         verify=True)
        except requests.exceptions.RequestException as err:
            self.logger.error(err)
            return '500', 'Internal Error in RESTful.POST_query()'
        # return the token
        return response.status_code, response.text
932001
@Override
	public <T extends Resource> T post(final String uri, final Parameters params) {
		return doRequest(uri).set(params).post();
	}
211165
private void addPostParams(final Request request) {
        if (key != null) {
            request.addPostParam("Key", key);
        }

        if (value != null) {
            request.addPostParam("Value", value);
        }
    }
1242475
@Override
  protected void doPost(final HttpServletRequest req, final HttpServletResponse resp)
      throws ServletException, IOException {
    final Map<String, Object> ret = new HashMap<>();

    if (hasParam(req, ACTION_PARAM)) {
      final String action = getParam(req, ACTION_PARAM);
      if (action.equals(STATS_SET_REPORTINGINTERVAL)) {
        handleChangeMetricInterval(req, ret);
      } else if (action.equals(STATS_SET_CLEANINGINTERVAL)) {
        handleChangeCleaningInterval(req, ret);
      } else if (action.equals(STATS_SET_MAXREPORTERPOINTS)) {
        handleChangeEmitterPoints(req, ret);
      } else if (action.equals(STATS_GET_ALLMETRICSNAME)) {
        handleGetAllMMetricsName(req, ret);
      } else if (action.equals(STATS_GET_METRICHISTORY)) {
        handleGetMetricHistory(req, ret);
      } else if (action.equals(STATS_SET_ENABLEMETRICS)) {
        handleChangeManagerStatusRequest(req, ret, true);
      } else if (action.equals(STATS_SET_DISABLEMETRICS)) {
        handleChangeManagerStatusRequest(req, ret, false);
      } else {
        ret.put(RESPONSE_ERROR, "Invalid action");
      }
    }

    JSONUtils.toJSON(ret, resp.getOutputStream(), true);
  }
1136641
async def save(self, request, response):
        """"""
        if isinstance(response, Response) and SESSION_KEY in request and not response.prepared:
            session = request[SESSION_KEY]
            if session.save(response.set_cookie):
                self.app.logger.debug('Session saved: %s', session)
802278
function execute(req, res) {
  Persistence.save(this.state.store, this.state.conf);
  res.send(null, Constants.OK);
}
372210
private void addPostParams(final Request request) {
        if (read != null) {
            request.addPostParam("Read", read.toString());
        }

        if (write != null) {
            request.addPostParam("Write", write.toString());
        }

        if (manage != null) {
            request.addPostParam("Manage", manage.toString());
        }
    }
259657
function(uri, method, form) {
  this.method = method = method || 'GET';
  this.headers = {};
  this.url = uri;
  this.pathname = uri;
  this.cookies = {};
  this.params = [];

  if (document.cookie) {
    this.headers['Cookie'] = document.cookie;
    this.cookies = DOM.getCookies();
  }

  if (form) {
    var serial = DOM.serialize(form) || {};
    this.headers['Content-Type'] =
      form.enctype || 'application/x-www-form-urlencoded';
    if (method === 'GET') {
      this.query = serial.data;
      this.rawQuery = serial.encoded;
    } else {
      this.body = serial.data;
      this.rawBody = serial.encoded;
    }
    // method override
    if (serial.data & serial.data._method) {
      this.method = method = serial.data._method.toUpperCase();
    }
  }

  if (~uri.indexOf('?')) {
    uri = uri.split('?');
    this.query = parsePairs(uri[1], '&');
    this.rawQuery = uri[1];
    this.pathname = uri = uri[0];
  }
}
18966
def _post_response(self, params):
        
        return self._session.post(
            self._api_url, data=params, timeout=self._timeout
        ).json(encoding="utf8")
761745
function setSecret (req, res, sessionKey, val, cookie) {
  if (cookie) {
    // set secret on cookie
    var value = val

    if (cookie.signed) {
      value = 's:' + sign(val, req.secret)
    }

    setCookie(res, cookie.key, value, cookie)
  } else {
    // set secret on session
    req[sessionKey].csrfSecret = val
  }
}
322803
def post(self, uri, params={}, data={}):
        '''
        '''
        return self._session.post(
            urljoin(Investigate.BASE_URL, uri),
            params=params, data=data, headers=self._auth_header,
            proxies=self.proxies
        )
642979
function (req, res, options) {
    if (!options) {
      options = {};
    }
    options.operation = 'SAVE';
    options.res = res;
    if (req.params.model) {
      options.model = req.params.model;
    }
    if (req.body) {
      options.item = req.body;
    }
    if (req.params.data) {
      options.data = req.params.data;
    }
    exports.save.before(req, res, options);
    var userId = req.session['user-id'];
    vulpejs.models.save({
      model: options.model,
      item: options.item,
      data: options.data,
      validate: options.validate || false,
      userId: userId,
      callback: {
        success: function (item) {
          if (!vulpejs.utils.execute(options.callback, {
              item: item,
              postedItem: options.item,
              res: res,
            })) {
            exports.save.after(req, res, item);
            res.json({
              item: item,
              postedItem: options.item,
            });
          }
        },
        error: function (error) {
          exports.response.error(options, error);
        },
        validate: function (validate) {
          exports.response.validate(options, validate);
        },
      },
    });
  }
1098941
public static void storeSessionDataInCookie(String key, String value, ServletResponse response)
	{
		Cookie cookie = new Cookie(key, value);
		cookie.setPath("/");
		cookie.setMaxAge(-1);//expire when browser closes
		((HttpServletResponse) response).addCookie(cookie);
	}
1110402
function(res) {
  function addCookie(cookie) {
    try {
      cookieJar.setCookieSync(cookie, config.base_url);
    } catch (err) {
      throw err;
    }
  }

  if (Array.isArray(res.headers['set-cookie'])) {
    res.headers['set-cookie'].forEach(addCookie);
  } else {
    addCookie(res.headers['set-cookie']);
  }
}
424720
def post(self, query):
        
        res, response = self._do_post(query)
        cookies = res.getheader('Set-Cookie', None)
        if len(response) == 0 and cookies is not None and res.status == 200:
            logging.debug('Got 0-length 200 response with Set-Cookies header; '
                          'retrying request with cookies')
            _, response = self._do_post(query, [('Cookie', cookies)])
        return response
716077
private void addPostParams(final Request request) {
        if (ttl != null) {
            request.addPostParam("Ttl", ttl.toString());
        }

        if (collectionTtl != null) {
            request.addPostParam("CollectionTtl", collectionTtl.toString());
        }
    }