Sets a message in azkaban.success.message in the cookie. This will be used by the web client
javascript to somehow display the message
179538
protected void setSuccessMessageInCookie(final HttpServletResponse response,
      final String message) {
    final Cookie cookie = new Cookie(AZKABAN_SUCCESS_MESSAGE, message);
    cookie.setPath("/");
    response.addCookie(cookie);
  }
594761
def save_account(message, collection=DATABASE.account):
    
    try:
        collection.create_index(
            [("account_cookie", ASCENDING), ("user_cookie", ASCENDING), ("portfolio_cookie", ASCENDING)], unique=True)
    except:
        pass
    collection.update(
        {'account_cookie': message['account_cookie'], 'portfolio_cookie':
            message['portfolio_cookie'], 'user_cookie': message['user_cookie']},
        {'$set': message},
        upsert=True
    )
814383
final JsMessage setPropertiesInMessage(LMEMessage theMessage)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "setPropertiesInMessage", theMessage);

    boolean copyMade = false;

    //  If this is pubsub we share this message with other subscribers so we have
    //  to make a copy prior to any updates. If this is pt-to-pt then any changes
    //  we make here can be done before the copy, the copy is still required to
    //  prevent a consumer from rolling back after modifying the message but
    //  anything we set here will be reset the next time round so there's no harm
    //  done. It is best to defer the 'copy' until after we've changed it so there
    //  is less likelyhood of a real copy being required.
    JsMessageWrapper jsMessageWrapper = (JsMessageWrapper) theMessage.message;
    JsMessage jsMsg = jsMessageWrapper.getMessage();

    try
    {
      //set the redeliveredCount if required
      if (jsMessageWrapper.guessRedeliveredCount() != 0)
      {
        if(isPubsub)
        {
          jsMsg = jsMsg.getReceived();
          copyMade = true;
        }

        jsMsg.setRedeliveredCount(jsMessageWrapper.guessRedeliveredCount());
      }

      long waitTime = jsMessageWrapper.updateStatisticsMessageWaitTime();

      //Only store wait time in message where explicitly
      // asked
      if (setWaitTime )
      {
        //defect 256701: we only set the message wait time if it is
        //a significant value.
        boolean waitTimeIsSignificant =
          waitTime > messageProcessor.getCustomProperties().get_message_wait_time_granularity();

        if(waitTimeIsSignificant)
        {
          if(isPubsub && !copyMade)
          {
            jsMsg = jsMsg.getReceived();
            copyMade = true;
          }

          jsMsg.setMessageWaitTime(waitTime);
        }
      }

      // If we deferred the copy till now we need to see if one is
      // needed. This will be the case either if the consumer has indicated that
      // it may change the message (not a comms client) and the message is still
      // on an itemStream (i.e. they could rollback the message with their changes).
      // Otherwise we can just give them our copy as we'll never want it back or
      // give it to anyone else.
      if(!copyMade && ((theMessage.isStored && copyMsg) || isPubsub))
        jsMsg = jsMsg.getReceived();
    }
    catch (MessageCopyFailedException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.setPropertiesInMessage",
        "1:2086:1.154.3.1",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] {
          "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
          "1:2093:1.154.3.1",
          e });

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "setPropertiesInMessage", e);

      throw new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
            "1:2104:1.154.3.1",
            e },
          null),
        e);
    }


    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "setPropertiesInMessage", jsMsg);
    return jsMsg;
  }
507908
def set_result (self, msg, valid=True, overwrite=False):
        
        if self.has_result and not overwrite:
            log.warn(LOG_CHECK,
              "Double result %r (previous %r) for %s", msg, self.result, self)
        else:
            self.has_result = True
        if not isinstance(msg, unicode):
            log.warn(LOG_CHECK, "Non-unicode result for %s: %r", self, msg)
        elif not msg:
            log.warn(LOG_CHECK, "Empty result for %s", self)
        self.result = msg
        self.valid = valid
        # free content data
        self.data = None
642146
public void setCookie(String name, String value, String path, long maxAge, boolean secure, boolean httpOnly) {
        Date now = new Date();
        Date expirationDate = new Date(now.getTime() + maxAge);
        setCookie(name, value, path, expirationDate, secure, httpOnly);
    }
926150
void setRuleMessage(XmlModelWriter xw, ValidatorRule rule, Element element)
    {
        String messageKey = rule.getMessageKey();
        String message = rule.getMessage();

        if ( messageKey != null || message != null )
        {
            Element msgElementToUse = findChildElement(xw, element, "msg", "name", rule.getRuleName(), true, null);
            setElementAttribute(msgElementToUse, "resource", true);

            if ( messageKey != null )
            {
                setElementAttribute(msgElementToUse, "key", messageKey);
                if (_isValidatorOneOne) {
                    setElementAttribute(msgElementToUse, "bundle", rule.getBundle());
                }
            }
            else // message != null (it's a hardcoded message)
            {
                // Add our special constant as the message key, append the hardcoded message to it.
                setElementAttribute(msgElementToUse, "key", ValidatorConstants.EXPRESSION_KEY_PREFIX + message);
            }
        }
    }
512051
def set_webhook_handler(self, scope, callback):
        
        scope = scope.lower()

        if scope == 'after_send':
            self._after_send = callback
            return

        if scope not in Page.WEBHOOK_ENDPOINTS:
            raise ValueError("The 'scope' argument must be one of {}.".format(Page.WEBHOOK_ENDPOINTS))

        self._webhook_handlers[scope] = callback
111372
public static void processMessageToMatchSession(HttpMessage message, List<HttpCookie> requestCookies,
			HttpSession session) {

		// Make a copy of the session tokens set, as they will be modified
		HttpSessionTokensSet tokensSet = session.getTokensNames();
		
		// If no tokens exists create dummy Object -> NPE
		if (tokensSet == null) {
			tokensSet = new HttpSessionTokensSet();
		}
		
		Set<String> unsetSiteTokens = new LinkedHashSet<>(tokensSet.getTokensSet());

		// Iterate through the cookies in the request
		Iterator<HttpCookie> it = requestCookies.iterator();
		while (it.hasNext()) {
			HttpCookie cookie = it.next();
			String cookieName = cookie.getName();

			// If the cookie is a token
			if (tokensSet.isSessionToken(cookieName)) {
				String tokenValue = session.getTokenValue(cookieName);
				if (log.isDebugEnabled())
					log.debug("Changing value of token '" + cookieName + "' to: " + tokenValue);

				// Change it's value to the one in the active session, if any
				if (tokenValue != null) {
					cookie.setValue(tokenValue);
				}// Or delete it, if the active session does not have a token value
				else {
					it.remove();
				}

				// Remove the token from the token set so we know what tokens still have to be
				// added
				unsetSiteTokens.remove(cookieName);
			}
		}

		// Iterate through the tokens that are not present in the request and set the proper
		// value
		for (String token : unsetSiteTokens) {
			String tokenValue = session.getTokenValue(token);
			// Change it's value to the one in the active session, if any
			if (tokenValue != null) {
				if (log.isDebugEnabled())
					log.debug("Adding token '" + token + " with value: " + tokenValue);
				HttpCookie cookie = new HttpCookie(token, tokenValue);
				requestCookies.add(cookie);
			}
		}
		// Store the session in the HttpMessage for caching purpose
		message.setHttpSession(session);

		// Update the cookies in the message
		message.getRequestHeader().setCookies(requestCookies);
	}
466545
def set_response_cookie(response, cookie_name, cookie_value):
    
    now = timezone.now()
    expire_date = now + datetime.timedelta(days=365)
    response.set_cookie(cookie_name, cookie_value, expires=expire_date)
397622
def set_cookie(key, value, options={})
      cookie = ["#{key}=#{value};"]


      if options.has_key? :expires and options[:expires].kind_of? Time
        options[:expires] = options[:expires].utc.strftime('%a, %d-%b-%Y %H:%M:%S GMT')
      end

      # Sort the cookies alphabetically.
      options.sort { |a,b| a.to_s <=> b.to_s }.each do |k,v|
        cookie << "#{k}=#{v.to_s};"
      end

      cookie_val = cookie.join(' ')

      if self.headers['Set-Cookie'].nil?
        self.headers['Set-Cookie'] = [cookie_val]
      else
        self.headers['Set-Cookie'] << cookie_val
      end
    end
1225657
def persistant_success(request, message, extra_tags='', fail_silently=False, *args, **kwargs):
    
    add_message(request, SUCCESS_PERSISTENT, message, extra_tags=extra_tags,
                fail_silently=fail_silently, *args, **kwargs)
469767
function set(name, value) {

        // if no value then remove
        if (!value) {
            remove(name);
            return;
        }

        if (localStorage) {
            try {
                localStorage.setItem(name, value);
            }
            catch (ex) {}
        }

        _.isFunction($cookies.put) ?
            $cookies.put(name, value, { domain: cookieDomain }) :
            $cookies[name] = value;

    }
633362
function setMessages() {
			var messages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

			__messages = _extends({}, __messages, messages);
		}
347092
public void setCookie(final String name, final String value) {
		if (name != null) {
			Cookie cookie = new Cookie(name, value);
			cookies.put(name, cookie);
		}
	}
1368046
public static void setRawCookie(String name, String value, HttpServletRequest req,
			HttpServletResponse res, boolean httpOnly, int maxAge) {
		if (StringUtils.isBlank(name) || value == null || req == null || res == null) {
			return;
		}
		Cookie cookie = new Cookie(name, value);
		cookie.setHttpOnly(httpOnly);
		cookie.setMaxAge(maxAge < 0 ? Config.SESSION_TIMEOUT_SEC : maxAge);
		cookie.setPath("/");
		cookie.setSecure(req.isSecure());
		res.addCookie(cookie);
	}
1100140
def set(key, value)
      method_name = "validate_#{key}"
      send(method_name.to_sym, value) if respond_to?(method_name.to_sym)
      @data[key.to_s] = value
    end
15418
def send_message(self, text, chat_id, reply_to_message_id=None, disable_web_page_preview=False, reply_markup=None):
        
        self.logger.info('sending message "%s"', format(text.replace('\n', '\\n')))
        payload = dict(text=text,
                       chat_id=chat_id,
                       reply_to_message_id=reply_to_message_id,
                       disable_web_page_preview=disable_web_page_preview,
                       reply_markup=reply_markup)
        return Message.from_api(self, **self._get('sendMessage', payload))