/* ------------------------------------------------------------
182938
public void setContextPath(String contextPathSpec)
    {
        if (_httpServer!=null)
            _httpServer.removeMappings(this);

        contextPathSpec=canonicalContextPathSpec(contextPathSpec);

        if (contextPathSpec.length()>1)
            _contextPath=contextPathSpec.substring(0,contextPathSpec.length()-2);
        else
            _contextPath="/";

        _contextName=null;

        if (_httpServer!=null)
            _httpServer.addMappings(this);
    }
182907
public void doInitialKey()
    {
        FileListener nextListener = (FileListener)this.getNextEnabledListener();
        if (nextListener != null)
        {
            boolean bOldState = nextListener.setEnabledListener(false);  // Don't allow it to be called again
            nextListener.doInitialKey();
            nextListener.setEnabledListener(bOldState);
        }
        else if (this.getOwner() != null)
            this.getOwner().doInitialKey();
    }
918945
public function process()
    {
        parent::process();

        if ($this->value === null) {
            return;
        }

        if ($this->value == '') {
            $this->value = null;
            return;
        }

        if (!$this->validateEmailAddress()) {
            $this->addMessage($this->getValidationMessage('email'));
        }
    }
1183651
public function Bind()
	{
		$this->getAbstractNode(0)->Bind();
		/**
		 * @var QName $qname
		 */
		$qname = $this->getQNVarName();
		$this->_varRef = $this->getContext()->RunningContext->NameBinder->PushVar( $qname );
		$this->getAbstractNode(1)->Bind();
		$this->getContext()->RunningContext->NameBinder->PopVar();
	}
495561
@Override
    public void write(final String s) {
        usageFlag = true;
        if (trouble || s == null) {
            return;
        }

        try {
            getOut().write(s);
        }
        catch (IOException e) {
            handleIOException(e);
        }
    }
1108393
private void encodeThis() throws IOException {
        DerOutputStream out = new DerOutputStream();
        out.putInteger(skipCerts);
        this.extensionValue = out.toByteArray();
    }
1289520
@Override
    public void setHeader(String name, String value) {
        this.checkState();
        super.setHeader(name, value);
    }
1155837
public function init(): void
    {
        if ($this->sourcePath !== null) {
            $this->sourcePath = $this->findPath($this->sourcePath);
        }
        if ($this->basePath !== null) {
            $this->basePath = $this->findPath($this->basePath);
        }
        if ($this->baseUrl !== null) {
            $this->baseUrl = rtrim(Yii::getAlias($this->baseUrl), '/');
        }
    }
991664
@Override
    public void execute() {
        try {
            String str = editor.readLine("Find:");
            editor.findNext(str);
            FindContext.setLastSearch(str);
        } catch (IOException e) {
            //noop
        }
    }
1349210
@Override
    public void clear() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Clearing this request: " + this);
        }
        super.clear();
        this.myMethod = MethodValues.UNDEF;
        this.myScheme = null;
        this.myURIBytes = SLASH;
        this.myURIString = null;
        this.myQueryBytes = null;
        this.queryParams = null;
        this.sUrlHost = null;
        this.sHdrHost = null;
        this.iUrlPort = HeaderStorage.NOTSET;
        this.iHdrPort = NOT_TESTED;
    }
455772
@Override
    String sourceContentFor(String aSource, Boolean nullOnMissing) {
        if (this.sourcesContent == null) {
            return null;
        }

        if (this.sourceRoot != null) {
            aSource = Util.relative(this.sourceRoot, aSource);
        }

        if (this._sources.has(aSource)) {
            return this.sourcesContent.get(this._sources.indexOf(aSource));
        }

        ParsedUrl url;
        if (this.sourceRoot != null && ((url = Util.urlParse(this.sourceRoot)) != null)) {
            // XXX: file:// URIs and absolute paths lead to unexpected behavior for
            // many users. We can help them out when they expect file:// URIs to
            // behave like it would if they were running a local HTTP server. See
            // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
            String fileUriAbsPath = aSource.replaceAll("^file://", "");
            if (url.scheme.equals("file") && this._sources.has(fileUriAbsPath)) {
                return this.sourcesContent.get(this._sources.indexOf(fileUriAbsPath));
            }

            if ((url.path == null || url.path.equals("/")) && this._sources.has("/" + aSource)) {
                return this.sourcesContent.get(this._sources.indexOf("/" + aSource));
            }
        }

        // This function is used recursively from
        // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
        // don't want to throw if we can't find the source - we just want to
        // return null, so we provide a flag to exit gracefully.
        if (nullOnMissing != null && nullOnMissing) {
            return null;
        } else {
            throw new RuntimeException("\"" + aSource + "\" is not in the SourceMap.");
        }
    }
741400
@Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
            throws IOException, ServletException {
        HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;

        // set cache directives
        httpServletResponse.setHeader(HTTPCacheHeader.CACHE_CONTROL.getName(), "no-cache, no-store");
        httpServletResponse.setDateHeader(HTTPCacheHeader.EXPIRES.getName(), 0L);

        filterChain.doFilter(servletRequest, servletResponse);
    }
516212
@Override
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Context context =
                ReadOnlyContext.getContext(Constants.HTTP_REQUEST.REST.uri,
                                           request);
        try {
            // Create a new file upload handler
            ServletFileUpload upload = new ServletFileUpload();

            // Parse the request, looking for "file"
            InputStream in = null;
            FileItemIterator iter = upload.getItemIterator(request);
            while (in == null && iter.hasNext()) {
                FileItemStream item = iter.next();
                logger.info("Got next item: isFormField={} fieldName={}", item.isFormField(), item.getFieldName());
                if (!item.isFormField() && item.getFieldName().equals("file")) {
                    in = item.openStream();
                }
            }
            if (in == null) {
                sendResponse(HttpServletResponse.SC_BAD_REQUEST,
                             "No data sent.",
                             response);
            } else {
                sendResponse(HttpServletResponse.SC_CREATED,
                             m_management.putTempStream(context, in),
                             response);
            }
        } catch (AuthzException ae) {
            throw RootException.getServletException(ae,
                                                    request,
                                                    "Upload",
                                                    EMPTY_STRING_ARRAY);
        } catch (Exception e) {
            e.printStackTrace();
            sendResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e
                    .getClass().getName()
                    + ": " + e.getMessage(), response);
        }
    }
380755
public void init() throws UnavailableException
    {
        ServletContext config = getServletContext();
        _servletHandler = ((ServletHandler.Context) config).getServletHandler();
        _httpContext = _servletHandler.getHttpContext();

        _acceptRanges = getInitBoolean("acceptRanges");
        _dirAllowed = getInitBoolean("dirAllowed");
        _putAllowed = getInitBoolean("putAllowed");
        _delAllowed = getInitBoolean("delAllowed");
        _redirectWelcomeFiles = getInitBoolean("redirectWelcome");
        _minGzipLength = getInitInt("minGzipLength");

        String rrb = getInitParameter("relativeResourceBase");
        if (rrb != null)
        {
            try
            {
                _resourceBase = _httpContext.getBaseResource().addPath(rrb);
            }
            catch (Exception e)
            {
                log.warn(LogSupport.EXCEPTION, e);
                throw new UnavailableException(e.toString());
            }
        }

        String rb = getInitParameter("resourceBase");

        if (rrb != null && rb != null)
            throw new UnavailableException("resourceBase & relativeResourceBase");

        if (rb != null)
        {
            try
            {
                _resourceBase = Resource.newResource(rb);
            }
            catch (Exception e)
            {
                log.warn(LogSupport.EXCEPTION, e);
                throw new UnavailableException(e.toString());
            }
        }
        if (log.isDebugEnabled())
            log.debug("resource base = " + _resourceBase);

        if (_putAllowed)
            _AllowString += ", PUT";
        if (_delAllowed)
            _AllowString += ", DELETE";
        if (_putAllowed && _delAllowed)
            _AllowString += ", MOVE";
    }
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);
  }
362130
public function process()
    {
        parent::process();

        $data = &$this->getForm()->getFormData();

        if (!isset($data[$this->id])) {
            return;
        }

        $this->value = $data[$this->id];
        $length = $this->getValueLength();

        if ($length === 0) {
            $this->value = null;
        }

        if ($this->required && $length === 0) {
            $message = $this->getValidationMessage('required');
            $this->addMessage($message);
        } elseif ($this->maxlength !== null && $length > $this->maxlength) {
            $message = $this->getValidationMessage('too-long');
            $message->primary_content = sprintf(
                $message->primary_content,
                $this->maxlength
            );

            $this->addMessage($message);
        }
    }
672848
public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException {
    NameNode.getNameNodeMetrics().numFileDataServletDoGet.inc();
    final UnixUserGroupInformation ugi = getUGI(request);
    final ClientProtocol nnproxy = createNameNodeProxy(ugi);

    try {
      final String path = request.getPathInfo() != null
        ? request.getPathInfo() : "/";
      FileStatus info = nnproxy.getFileInfo(path);
      if ((info != null) && !info.isDir()) {
        response.sendRedirect(createUri(info, ugi, nnproxy,
              request).toURL().toString());
      } else if (info == null){
        response.sendError(400, "cat: File not found " + path);
      } else {
        response.sendError(400, "cat: " + path + ": is a directory");
      }
    } catch (URISyntaxException e) {
      response.getWriter().println(e.toString());
    } catch (IOException e) {
      response.sendError(400, e.getMessage());
    }
  }