An HTML form for logging in.

 @param env the Rack environment
 @return a finished Rack response
517636
def provide_login_html(env)
      request = ::Rack::Request.new(env)
      html = login_html(env, :url => request['url'], :session_expired => request['session_expired'])

      html_response(html).finish
    end
309900
def on_complete(env)
      if env[:body].error?
        @logger.warn env[:raw_body] if VkontakteApi.log_errors?
      else
        @logger.debug env[:raw_body] if VkontakteApi.log_responses?
      end
    end
192147
def call(env)
      return render(500) do |xml|
        xml.h2("#{@key} env is not initialized")
      end unless env[@key]

      request = ::Rack::Request.new(env)

      if action = dispatch_action(request)
        send(action, request)
      else
        @app.call(env)
      end
    end
212145
def prepare_env(faraday_env)
      env = headers_to_rack(faraday_env)

      url = faraday_env[:url]
      env['rack.url_scheme'] = url.scheme
      env['PATH_INFO'] = url.path
      env['SERVER_PORT'] = url.respond_to?(:inferred_port) ? url.inferred_port : url.port
      env['QUERY_STRING'] = url.query
      env['REQUEST_METHOD'] = faraday_env[:method].to_s.upcase

      env['rack.errors'] ||= StringIO.new
      env['faraday'] = faraday_env

      env
    end
258870
def restore_env(rack_env)
      env = rack_env.fetch('faraday')
      headers = env[:request_headers]
      headers.clear

      rack_env.each do |name, value|
        next unless String === name && String === value
        if NonPrefixedHeaders.include? name or name.index('HTTP_') == 0
          name = name.sub(/^HTTP_/, '').downcase.tr('_', '-')
          headers[name] = value
        end
      end

      env[:method] = rack_env['REQUEST_METHOD'].downcase.to_sym
      env[:rack_errors] = rack_env['rack.errors']
      env
    end
887258
@Override public RackResponse call(RackEnvironment environment) {
    RubyHash environmentHash = convertToRubyHash(environment.entrySet());

    RubyArray response = callRackApplication(environmentHash);

    return convertToJavaRackResponse(response);
  }
945089
Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) {
        Env<AttrContext> localEnv =
            env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym)));
        localEnv.enclMethod = tree;
        if (tree.sym.type != null) {
            //when this is called in the enter stage, there's no type to be set
            localEnv.info.returnResult = attr.new ResultInfo(KindSelector.VAL,
                                                             tree.sym.type.getReturnType());
        }
        if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++;
        return localEnv;
    }
1304997
def authorized!(rack_env, allowed_by)
      Env.new(rack_env).tap do |env|
        env.authorize(allowed_by)
      end.to_rack
    end
387157
def to_env
      rack_input = normalize_body(@request.body)

      env = HttpMonkey::Client::Environment.new(DEFAULT_ENV)
      env.uri = @request.url

      env.update({
        # request info
        'REQUEST_METHOD'  => @method.to_s.upcase,

        'rack.input'      => rack_input,
        'CONTENT_LENGTH'  => rack_input.length.to_s,

        # custom info
        'http_monkey.request' => [@method, @request, @client],
        'http_monkey.storage' => @client.storage
      })
      env.add_http_header(@request.headers)
      env
    end
239616
def application(environ, start_response):
    """"""
    # the environment variable CONTENT_LENGTH may be empty or missing
    try:
        request_body_size = int(environ.get('CONTENT_LENGTH', 0))
    except ValueError:
        request_body_size = 0

    # When the method is POST the query string will be sent
    # in the HTTP request body which is passed by the WSGI server
    # in the file like wsgi.input environment variable.
    if request_body_size > 0:
        request_body = environ['wsgi.input'].read(request_body_size)
    else:
        request_body = environ['wsgi.input'].read()
    form = cgi.parse_qs(request_body)

    status = '200 OK'
    start_response(status, get_response_headers())
    for output in checklink(form=form, env=environ):
        yield output
497005
def _login(self, environ, start_response):
        """"""
        response = HTTPUnauthorized()
        response.www_authenticate = ('Basic', {'realm': self._realm})
        return response(environ, start_response)
527683
def options_response(env):
        
        status_headers = StatusAndHeaders('200 Ok', [
            ('Content-Type', 'text/plain'),
            ('Content-Length', '0'),
        ])
        response = WbResponse(status_headers)
        response.add_access_control_headers(env=env)
        return response
829718
function getServeEnv (baseDir) {
  let serverEnv

  const envPath = path.join(baseDir, 'config/env')
  if (fs.existsSync(envPath)) {
    serverEnv = fs.readFileSync(envPath, 'utf8')
  }

  if (!serverEnv) {
    serverEnv = process.env.KNOTWORK_ENV || process.env.KOA_ENV
  }

  if (!serverEnv) {
    if (process.env.NODE_ENV === 'test') {
      serverEnv = 'unittest'
    } else if (process.env.NODE_ENV === 'production') {
      serverEnv = 'prod'
    } else {
      serverEnv = 'local'
    }
  } else {
    serverEnv = serverEnv.trim()
  }

  return serverEnv
}
1247241
@RequestMapping(value = "/getZooTree", method = RequestMethod.GET)
    @ResponseBody
    public JsonObject<?> getZooTree(@RequestParam(value = "env", required = true) String env) {
        LOG.info("Get" + env + " zoo tree");
        JsonObject<?> result = JsonObject.create();
        try {
            ZooNode zooNode = null;
            if (ZooEnv.ONLINE.getValue().equalsIgnoreCase(env)) {
                User sessionVisitor = (User) ThreadContext.getSessionVisitor();
                if (sessionVisitor != null
                        && !sessionVisitor.getAuths().contains(
                        UserWebConstant.UserAuth.ZOO_ONLINE.getValue())) {
                    return sysError(GlobalResponseStatusMsg.AUTH_DENIED.getMessage().getMessage());
                }
                zooNode = onlineZooServiceImpl.getNodeRecrusively();
            } else {
                zooNode = offlineZooServiceImpl.getNodeRecrusively();
            }
            if (CollectionUtils.isEmpty(zooNode.getChildren())) {
                return sysError(GlobalResponseStatusMsg.GET_ZOO_TREE_FAILED.getMessage("找不到任何节点")
                        .getMessage());
            }
            result.addData("zooNodes", new ZooNode[] {zooNode});
        } catch (Exception e) {
            LOG.error("Query zoo tree failed!", e);
            return sysError();
        }
        return result;
    }
1027781
def wsgi(self, environ, start_response):
        
        try:
            out = self._cast(self._handle(environ))
            # rfc2616 section 4.3
            if response._status_code in (100, 101, 204, 304)\
            or environ['REQUEST_METHOD'] == 'HEAD':
                if hasattr(out, 'close'): out.close()
                out = []
            start_response(response._status_line, response.headerlist)
            return out
        except (KeyboardInterrupt, SystemExit, MemoryError):
            raise
        except Exception:
            if not self.catchall: raise
            err = '<h1>Critical error while processing request: %s</h1>' \
                  % html_escape(environ.get('PATH_INFO', '/'))
            if DEBUG:
                err += '<h2>Error:</h2>\n<pre>\n%s\n</pre>\n' \
                       '<h2>Traceback:</h2>\n<pre>\n%s\n</pre>\n' \
                       % (html_escape(repr(_e())), html_escape(format_exc()))
            environ['wsgi.errors'].write(err)
            headers = [('Content-Type', 'text/html; charset=UTF-8')]
            start_response('500 INTERNAL SERVER ERROR', headers, sys.exc_info())
            return [tob(err)]
143057
def call(env)
      request = env['rack-accept_headers.request'] ||= Request.new(env)
      check!(request) unless @checks.empty?
      @app.call(env)
    rescue AcceptError
      response = Response.new
      response.not_acceptable!
      response.finish
    end
252922
def call(env)
      info      = (env[ENV_INFO_KEY] ||= RequestDetails.new)
      info.id ||= env[HTTP_X_REQUEST_ID] || env[ACTION_DISPATCH_REQUEST_ID] || SecureRandom.uuid

      time_started_service = Time.now                      # The wall time the request started being processed by rack
      ts_started_service   = fsecs                         # The monotonic time the request started being processed by rack
      time_started_wait    = RT._read_x_request_start(env) # The time the request was initially received by the web server (if available)
      effective_overtime   = (wait_overtime && RT._request_has_body?(env)) ? wait_overtime : 0 # additional wait timeout (if set and applicable)
      seconds_service_left = nil

      # if X-Request-Start is present and wait_timeout is set, expire requests older than wait_timeout (+wait_overtime when applicable)
      if time_started_wait && wait_timeout
        seconds_waited          = time_started_service - time_started_wait # how long it took between the web server first receiving the request and rack being able to handle it
        seconds_waited          = 0 if seconds_waited < 0                  # make up for potential time drift between the routing server and the application server
        final_wait_timeout      = wait_timeout + effective_overtime        # how long the request will be allowed to have waited
        seconds_service_left    = final_wait_timeout - seconds_waited      # first calculation of service timeout (relevant if request doesn't get expired, may be overriden later)
        info.wait, info.timeout = seconds_waited, final_wait_timeout       # updating the info properties; info.timeout will be the wait timeout at this point
        if seconds_service_left <= 0 # expire requests that have waited for too long in the queue (as they are assumed to have been dropped by the web server / routing layer at this point)
          RT._set_state! env, :expired
          raise RequestExpiryError.new(env), "Request older than #{info.ms(:timeout)}."
        end
      end

      # pass request through if service_timeout is false (i.e., don't time it out at all.)
      return @app.call(env) unless service_timeout

      # compute actual timeout to be used for this request; if service_past_wait is true, this is just service_timeout. If false (the default), and wait time was determined, we'll use the shortest value between seconds_service_left and service_timeout. See comment above at service_past_wait for justification.
      info.timeout = service_timeout # nice and simple, when service_past_wait is true, not so much otherwise:
      info.timeout = seconds_service_left if !service_past_wait && seconds_service_left && seconds_service_left > 0 && seconds_service_left < service_timeout

      RT._set_state! env, :ready                            # we're good to go, but have done nothing yet

      heartbeat_event = nil                                 # init var so it's in scope for following proc
      register_state_change = ->(status = :active) {        # updates service time and state; will run every second
        heartbeat_event.cancel! if status != :active        # if the request is no longer active we should stop updating every second
        info.service = fsecs - ts_started_service           # update service time
        RT._set_state! env, status                          # update status
      }
      heartbeat_event = RT::Scheduler.run_every(1) { register_state_change.call :active }  # start updating every second while active; if log level is debug, this will log every sec

      timeout = RT::Scheduler::Timeout.new do |app_thread|  # creates a timeout instance responsible for timing out the request. the given block runs if timed out
        register_state_change.call :timed_out
        app_thread.raise(RequestTimeoutException.new(env), "Request #{"waited #{info.ms(:wait)}, then " if info.wait}ran for longer than #{info.ms(:timeout)}")
      end

      response = timeout.timeout(info.timeout) do           # perform request with timeout
        begin  @app.call(env)                               # boom, send request down the middleware chain
        rescue RequestTimeoutException => e                 # will actually hardly ever get to this point because frameworks tend to catch this. see README for more
          raise RequestTimeoutError.new(env), e.message, e.backtrace  # but in case it does get here, re-raise RequestTimeoutException as RequestTimeoutError
        ensure
          register_state_change.call :completed
        end
      end

      response
    end