/* -------------------------------------------------------------------
773048
public void handleGet(HttpRequest request,
                          HttpResponse response,
                          String pathInContext,
                          String pathParams,
                          Resource resource)
        throws IOException
    {
        if(log.isDebugEnabled())log.debug("Looking for "+resource);
        
        if (resource!=null && resource.exists())
        {            
            // check if directory
            if (resource.isDirectory())
            {
                if (!pathInContext.endsWith("/") && !pathInContext.equals("/"))
                {
                    log.debug("Redirect to directory/");
                    
                    String q=request.getQuery();
                    StringBuffer buf=request.getRequestURL();
                    if (q!=null&&q.length()!=0)
                    {
                        buf.append('?');
                        buf.append(q);
                    }
                    response.setField(HttpFields.__Location, URI.addPaths(buf.toString(),"/"));
                    response.setStatus(302);
                    request.setHandled(true);
                    return;
                }
  
                // See if index file exists
                String welcome=getHttpContext().getWelcomeFile(resource);
                if (welcome!=null)
                {     
                    // Forward to the index
                    String ipath=URI.addPaths(pathInContext,welcome);
                    if (_redirectWelcomeFiles)
                    {
                        // Redirect to the index
                        ipath=URI.addPaths(getHttpContext().getContextPath(),ipath);
                        response.setContentLength(0);
                        response.sendRedirect(ipath);
                    }
                    else
                    {
                        URI uri=request.getURI();
                        uri.setPath(URI.addPaths(uri.getPath(),welcome));
                        getHttpContext().handle(ipath,pathParams,request,response);
                    }
                    return;
                }

                // Check modified dates
                if (!passConditionalHeaders(request,response,resource))
                    return;
                // If we got here, no forward to index took place
                sendDirectory(request,response,resource,pathInContext.length()>1);
            }
            // check if it is a file
            else if (resource.exists())
            {
                // Check modified dates
                if (!passConditionalHeaders(request,response,resource))
                    return;
                sendData(request,response,pathInContext,resource,true);
            }
            else
                // don't know what it is
                log.warn("Unknown file type");
        }
    }
1196252
@Override
	public void run() {
		try {
			byte[] bytes = new byte[8192];

			int pos = 0;

			// Read the first part of the header
			while (true) {
				int read = input.read();
				if (read == -1) {
					break;
				}
				bytes[pos] = (byte) read;
				if (pos >= 4) {
					// Find \r\n\r\n
					if (bytes[pos - 3] == '\r' && bytes[pos - 2] == '\n' && bytes[pos - 1] == '\r' && bytes[pos] == '\n') {
						break;
					}
				}
				pos++;
			}

			// Read from the header data
			BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes, 0, pos)));

			// Read the first line, defined as the status line
			String l = reader.readLine();

			// Sanity check, after not returning data the client MIGHT attempt
			// to send something back and it will end up being something we
			// cannot read.
			if (l == null) {
				sendError(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST.toString());
				return;
			}

			// Otherwise continue on
			int idx = l.indexOf(' ');

			// Split out the method and path
			String methodString = l.substring(0, idx);
			HttpMethod method = null;

			for (HttpMethod m : HttpMethod.values()) {
				if (m.name().equals(methodString)) {
					method = m;
				}
			}

			// If it's an unknown method it won't be defined in the enum
			if (method == null) {
				sendError(HttpStatus.METHOD_NOT_ALLOWED, "This server currently does not support this method.");
				return;
			}

			// The URI
			String path = l.substring(idx + 1, l.lastIndexOf(' '));

			// Parse the headers
			Map<String, String> headers = new HashMap<String, String>();
			while ((l = reader.readLine()) != null) {
				// End header.
				if (l.equals(""))
					break;

				// Headers are usually Key: Value
				String key = l.substring(0, l.indexOf(':'));
				String value = l.substring(l.indexOf(':') + 1).trim();

				// Put the header in the map, correcting the header key if
				// needed.
				headers.put(HttpUtil.capitalizeHeader(key), value);
			}

			// Close the reader used for the header
			reader.close();

			HttpRequest request = new HttpRequest(this, method, path, headers);

			int questionIdx = path.indexOf('?');
			if (questionIdx != -1) {
				String queryString = path.substring(questionIdx + 1);
				request.setQueryString(queryString);
				request.setGetData(HttpUtil.parseData(queryString));

				path = path.substring(0, questionIdx);
				request.setUri(path);
			}

			// Parse cookies, only if the server has the capability enabled (to save time, processing power, and memory if it isn't used)
			if (headers.containsKey(HttpHeader.COOKIE) && server.hasCapability(HttpCapability.COOKIES)) {
				List<HttpCookie> cookies = new LinkedList<HttpCookie>();
				StringTokenizer tok = new StringTokenizer(headers.get(HttpHeader.COOKIE), ";");
				while (tok.hasMoreTokens()) {
					String token = tok.nextToken();
					int eqIdx = token.indexOf('=');
					if (eqIdx == -1) {
						// Invalid cookie
						continue;
					}
					String key = token.substring(0, eqIdx);
					String value = token.substring(eqIdx + 1);

					cookies.add(new HttpCookie(key, value));
				}
				request.setCookies(cookies);
			}

			// Read the request data
			if (method == HttpMethod.POST) {
				boolean acceptsStandard = server.hasCapability(HttpCapability.STANDARD_POST), acceptsMultipart = server.hasCapability(HttpCapability.MULTIPART_POST);
				// Make sure the server will accept POST or Multipart POST
				// before we start checking the content
				if (acceptsStandard || acceptsMultipart) {
					// Validate that there's a length header
					if (!headers.containsKey(HttpHeader.CONTENT_LENGTH)) {
						// If there isn't, send the correct response
						sendError(HttpStatus.LENGTH_REQUIRED, HttpStatus.LENGTH_REQUIRED.toString());
					} else {
						// Otherwise, continue on
						int contentLength = Integer.parseInt(headers.get(HttpHeader.CONTENT_LENGTH));

						String contentTypeHeader = headers.get(HttpHeader.CONTENT_TYPE);

						// Copy it to trim to what we need, keeping the original
						// to parse the boundary
						String contentType = contentTypeHeader;

						if (contentTypeHeader.indexOf(';') != -1) {
							contentType = contentTypeHeader.substring(0, contentTypeHeader.indexOf(';'));
						}
						// Check the content type
						if (contentType.equalsIgnoreCase("multipart/form-data")) {
							if (acceptsMultipart) {
								// The server will accept post requests with
								// multipart data
								String boundary = contentTypeHeader.substring(contentTypeHeader.indexOf(';')).trim();
								boundary = boundary.substring(boundary.indexOf('=') + 1);
								// Parse file uploads etc.
								request.setPostData(readMultipartData(boundary));
							} else {
								// The server has the multipart post
								// capabilities disabled
								sendError(HttpStatus.BAD_REQUEST, "This server does not support multipart/form-data requests.");
							}
						} else {
							if (acceptsStandard) {
								// Read the reported content length, TODO some
								// kind of check/timeout to make sure it won't
								// hang the thread?
								byte[] b = new byte[contentLength];
								int read, totalRead = 0;
								while (contentLength - totalRead > 0 && (read = input.read(b, totalRead, contentLength - totalRead)) > -1) {
									totalRead += read;
								}
								// We either read all of the data, or the
								// connection closed.
								if (totalRead < contentLength) {
									sendError(HttpStatus.BAD_REQUEST, "Unable to read correct amount of data!");
								} else {
									String data = new String(b);
									if (contentType.equalsIgnoreCase("application/x-www-form-urlencoded")) {
										// It is FOR SURE regular data.
										request.setPostData(HttpUtil.parseData(data));
									} else {
										// Could be JSON or XML etc
										request.setData(data);
									}
								}
							} else {
								// The server has the Standard post capabilities
								// disabled
								sendError(HttpStatus.BAD_REQUEST, "This server does not support POST requests.");
							}
						}
					}
				} else {
					// The server has the Standard and Multipart capabilities
					// disabled
					sendError(HttpStatus.METHOD_NOT_ALLOWED, "This server does not support POST requests.");
				}
			}

			this.request = request;

			server.dispatchRequest(request);
		} catch (SocketException e) {
			//Socket was closed probably
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
419222
private synchronized void lazyInit(HttpServletRequest request) throws IOException {
        List<File> files;
        URL url;
        long lastModified;
        long now;
        Resolver resolver;
        Node localhost;
        FileNode file;
        Object[] tmp;

        resolver = application.resolver;
        if (engine != null && resolver.isLife()) {
            for (Node node : reloadFiles) {
                lastModified = node.getLastModified();
                if (lastModified > loaded) {
                    now = System.currentTimeMillis();
                    if (lastModified > now) {
                        // fail to avoid repeated re-init
                        throw new IOException(node.getUri() + " has lastModifiedDate in the future: "
                                + new Date(lastModified) + "(now: " + new Date(now) + ")");
                    }
                    LOG.info("reloading jasmin for application '" + application.getContextPath() + "' - changed file: " + node);
                    engine = null;
                    resolver.reset();
                }
            }
        }
        if (engine == null) {
            url = new URL(request.getRequestURL().toString());
            try {
                localhost = resolver.getWorld().node(new URI(url.getProtocol(), null, url.getHost(), url.getPort(), "", null, null));
            } catch (URISyntaxException e) {
                throw new IllegalStateException(e);
            }
            tmp = application.createEngine(docroot, localhost);
            engine = (Engine) tmp[0];
            LOG.info("started engine, initial url=" + url);
            for (Module module : engine.repository.modules()) {
                files = module.files();
                if (files.size() > 2) {
                    LOG.warn("deprecated: module '" + module.getName() + "' contains more than 2 file: " + files);
                }
                for (File f : files) {
                    if (f.getNormal() instanceof HttpNode) {
                        LOG.warn("deprecated: module '" + module.getName() + "' uses base LOCALHOST: " + f.getNormal().getUri());
                    }
                }
            }
            if (resolver.isLife()) {
                reloadFiles = (List<Node>) tmp[1];
                file = resolver.getLiveXml();
                if (file != null) {
                    reloadFiles.add(file);
                }
                LOG.info("reload if one of these " + reloadFiles.size() + " files is modified: ");
                for (Node node : reloadFiles) {
                    LOG.info("  " + node.getUri());
                }
                loaded = System.currentTimeMillis();
            }
            if (engine == null) {
                throw new IllegalStateException();
            }
        }
    }
84854
@Override
    protected void doPost(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
        LOG.debug("Entering");
        final AtomHandler handler = createAtomRequestHandler(req, res);
        final String userName = handler.getAuthenticatedUsername();
        if (userName != null) {
            final AtomRequest areq = new AtomRequestImpl(req);
            try {
                if (handler.isCollectionURI(areq)) {

                    if (req.getContentType().startsWith("application/atom+xml")) {

                        // parse incoming entry
                        final Entry entry = Atom10Parser.parseEntry(new BufferedReader(new InputStreamReader(req.getInputStream(), "UTF-8")), null, Locale.US);

                        // call handler to post it
                        final Entry newEntry = handler.postEntry(areq, entry);

                        // set Location and Content-Location headers
                        for (final Object element : newEntry.getOtherLinks()) {
                            final Link link = (Link) element;
                            if ("edit".equals(link.getRel())) {
                                res.addHeader("Location", link.getHrefResolved());
                                break;
                            }
                        }
                        for (final Object element : newEntry.getAlternateLinks()) {
                            final Link link = (Link) element;
                            if ("alternate".equals(link.getRel())) {
                                res.addHeader("Content-Location", link.getHrefResolved());
                                break;
                            }
                        }

                        // write entry back out to response
                        res.setStatus(HttpServletResponse.SC_CREATED);
                        res.setContentType("application/atom+xml; type=entry; charset=utf-8");

                        final Writer writer = res.getWriter();
                        Atom10Generator.serializeEntry(newEntry, writer);
                        writer.close();

                    } else if (req.getContentType() != null) {

                        // get incoming title and slug from HTTP header
                        final String title = areq.getHeader("Title");

                        // create new entry for resource, set title and type
                        final Entry resource = new Entry();
                        resource.setTitle(title);
                        final Content content = new Content();
                        content.setType(areq.getContentType());
                        resource.setContents(Collections.singletonList(content));

                        // hand input stream off to hander to post file
                        final Entry newEntry = handler.postMedia(areq, resource);

                        // set Location and Content-Location headers
                        for (final Object element : newEntry.getOtherLinks()) {
                            final Link link = (Link) element;
                            if ("edit".equals(link.getRel())) {
                                res.addHeader("Location", link.getHrefResolved());
                                break;
                            }
                        }
                        for (final Object element : newEntry.getAlternateLinks()) {
                            final Link link = (Link) element;
                            if ("alternate".equals(link.getRel())) {
                                res.addHeader("Content-Location", link.getHrefResolved());
                                break;
                            }
                        }

                        res.setStatus(HttpServletResponse.SC_CREATED);
                        res.setContentType("application/atom+xml; type=entry; charset=utf-8");

                        final Writer writer = res.getWriter();
                        Atom10Generator.serializeEntry(newEntry, writer);
                        writer.close();

                    } else {
                        res.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "No content-type specified in request");
                    }

                } else {
                    res.sendError(HttpServletResponse.SC_NOT_FOUND, "Invalid collection specified in request");
                }
            } catch (final AtomException ae) {
                res.sendError(ae.getStatus(), ae.getMessage());
                LOG.debug("An error occured while processing POST", ae);
            } catch (final Exception e) {
                res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
                LOG.debug("An error occured while processing POST", e);
            }
        } else {
            res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\"");
            res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
        }
        LOG.debug("Exiting");
    }
329333
private synchronized void initOut() throws IOException
   {
      if (out == null)
      {
         OutputStream os = new IndexOutputStream(dir.createOutput(REDO_LOG));
         out = new BufferedWriter(new OutputStreamWriter(os));
      }
   }
199046
public void init(HttpServletRequest request) {
		resetTimers();
		
		if (request != null) {
			String p = request.getPathInfo();
			final int pathLength = (p == null ? 0 : p.length());
			
			final StringBuffer urlSb = request.getRequestURL();
			String simpleUrl = urlSb.toString(); // without qs
			
			String qs = request.getQueryString();
			if (qs != null) urlSb.append("?").append(qs);
			final String fullUrl = urlSb.toString();
			contextUrl.set(fullUrl);
		
			requestCookies.remove();
			responseCookies.remove();
			
			StringBuilder cookiesDump = new StringBuilder();
			Map<String, Cookie> cookiez = requestCookies.get();
			for (javax.servlet.http.Cookie c : Check.ifNull(request.getCookies(), new javax.servlet.http.Cookie[0])) {
				cookiez.put(c.getName(), new BasicClientCookie(c.getName(), c.getValue()));
				cookiesDump.append(c.toString()).append(";");
			}
	
			String xForwardedFor = request.getHeader(HEADER_X_FORWARDED_FOR);
			clientIp.set(xForwardedFor != null ? xForwardedFor : request.getRemoteAddr());
			
			String xForwardedUrl = request.getHeader(HEADER_X_FORWARDED_URL);
			if (xForwardedUrl != null) {
				int i = xForwardedUrl.lastIndexOf("?");
				simpleUrl = (i == -1 ? xForwardedUrl : xForwardedUrl.substring(0, i));
			}
			
			try {
				simpleUrl = URLDecoder.decode(simpleUrl, "UTF-8"); // convert "%xx" stuff before working with lengths
			} catch (UnsupportedEncodingException e) {
				log.error(e.toString());
			}
			contextPath.set(simpleUrl.substring(0, simpleUrl.length() - pathLength));

			if (verbose) log.info(">>> Time 0 [" + fullUrl + "]. cookies from client: " + cookiesDump.toString());
		}
		
		initialized.set(true);
	}
104400
public function init() {
        $this->_req = $this->getRequest()->getParam('request');
        $this->_response = $this->getRequest()->getParam('response');
    }
84608
private void encodeThis() throws IOException {
        if (names == null || names.isEmpty()) {
            this.extensionValue = null;
            return;
        }
        DerOutputStream os = new DerOutputStream();
        names.encode(os);
        this.extensionValue = os.toByteArray();
    }
898472
private void process()
    {
        if (requestUri.length() > 1) {
            parts = new ArrayList<String>(10);
            for ( int i = 1; i < requestUri.length(); ) {
                int sIdx = i;
                int eIdx = requestUri.indexOf('/', sIdx + 1);
                
                //not matched or reach the end
                if ( eIdx == -1 ) {
                    parts.add(requestUri.substring(sIdx));
                    break;
                } 
                
                parts.add(requestUri.substring(sIdx, eIdx));
                i = eIdx + 1;
            }
            
            /*
             * check and add a empty method name
             * with request style like /tokenizer/
            */
            if ( requestUri.charAt(requestUri.length()-1) == '/' ) {
                parts.add("");
            }
            
            int length = parts.size();
            if ( length > 1 ) {
                IStringBuffer sb = new IStringBuffer();
                for ( int i = 0; i < length - 1; i++ ) {
                    int l = sb.length();
                    sb.append(parts.get(i));
                    
                    //make sure the first letter is uppercase
                    char chr = sb.charAt(l);
                    if ( chr >= 90 ) {
                        chr -= 32;
                        sb.set(l, chr);
                    }
                }
                
                controller = sb.toString();
            }
            
            method = parts.get(length-1);
        }
    }
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);
        }
    }
1093354
public function execute()
    {
        /** @var EventHandler $eventHandler */
        $eventHandler = $this->make(EventHandler::class);
        $eventHandler->trigger(BeforeExecute::class);

        /** @var Request $request */
        $request = $this->make(Request::class);
        $request->compute();
    }
1170541
public void init()
    throws IOException
  {
    long now = CurrentTime.getExactTime();

    // server/0263
    // _nextRolloverCheckTime = now + _rolloverCheckPeriod;

    Path path = getPath();

    if (path != null) {
      Files.createDirectories(path.getParent());

      _rolloverPrefix = path.getName(path.getNameCount() - 1).toString();

      long lastModified = Files.getLastModifiedTime(path).toMillis();
      
      if (lastModified <= 0 || now < lastModified) {
        lastModified = now;
      }

      // _calendar.setGMTTime(lastModified);

      _nextPeriodEnd = nextRolloverTime(lastModified);
    }
    else {
      _nextPeriodEnd = nextRolloverTime(now);
    }
    
    if (_archiveFormat != null || getRolloverPeriod() <= 0) {
    }
    else if (_rolloverCron != null)
      _archiveFormat = _rolloverPrefix + ".%Y%m%d.%H";
    else if (getRolloverPeriod() % DAY == 0)
      _archiveFormat = _rolloverPrefix + ".%Y%m%d";
    else if (getRolloverPeriod() % HOUR == 0)
      _archiveFormat = _rolloverPrefix + ".%Y%m%d.%H";
    else
      _archiveFormat = _rolloverPrefix + ".%Y%m%d.%H%M";
    
    _isInit = true;

    _rolloverListener.requeue(_rolloverAlarm);
    rollover();
  }
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'));
        }
    }
521452
public final void doWork(final HttpServletRequest pReq,
    final HttpServletResponse pResp) throws ServletException, IOException {
    pReq.setCharacterEncoding("UTF-8");
    pResp.setCharacterEncoding("UTF-8");
    try {
      HashMap<String, Object> reqVars = new HashMap<String, Object>();
      HttpRequestData requestData = new HttpRequestData(pReq, pResp);
      requestData.setAttribute("reqVars", reqVars);
      IHandlerRequest hndlI18nRequest = (IHandlerRequest) this
        .factoryAppBeans.lazyGet("hndlI18nRequest");
      hndlI18nRequest.handle(reqVars, requestData);
      String nmRnd = pReq.getParameter("nmRnd");
      if (this.defaultJsp != null && "index".equals(this.defaultJsp)) {
        //TODO extract into handler
        if (pReq.getParameter("logoff") != null) {
          pReq.getSession().invalidate();
        }
        @SuppressWarnings("rawtypes")
        SrvAddTheFirstUser srvAddFiU = (SrvAddTheFirstUser) getServletContext()
          .getAttribute("srvAddTheFirstUser");
        if (srvAddFiU != null && !srvAddFiU.checkIsThereAnyUser()) {
          nmRnd = "addFirstUser";
        }
      }
      if (nmRnd == null) {
        nmRnd = this.defaultJsp;
      }
      if (this.handlerName != null) {
        IHandlerRequest handleRequest = (IHandlerRequest) this
          .factoryAppBeans.lazyGet(this.handlerName);
        handleRequest.handle(reqVars, requestData);
      }
      ISrvI18n srvI18n = (ISrvI18n) this.factoryAppBeans.lazyGet("ISrvI18n");
      UtlJsp utlJsp = (UtlJsp) this.factoryAppBeans.lazyGet("UtlJsp");
      pReq.setAttribute("srvI18n", srvI18n);
      pReq.setAttribute("utlJsp", utlJsp);
      //renderer maybe overridden:
      String nmRnRd = (String) pReq.getAttribute("nmRnd");
      if (nmRnRd != null) {
        nmRnd = nmRnRd;
      }
      //processor can set redirect servlet, e.g. transactional to non-one:
      String srvlRd = (String) pReq.getAttribute("srvlRed");
      if (srvlRd != null) {
        RequestDispatcher rd = getServletContext().getRequestDispatcher(srvlRd);
        rd.forward(pReq, pResp);
      } else {
        String path = dirJsp + nmRnd + ".jsp";
        RequestDispatcher rd = getServletContext().getRequestDispatcher(path);
        rd.include(pReq, pResp);
      }
    } catch (Exception e) {
      if (this.factoryAppBeans != null) {
        ILog logger = null;
        try {
          logger = (ILog) this.factoryAppBeans.lazyGet("ILog");
          logger.error(null, getClass(), "WORK", e);
        } catch (Exception e1) {
          e1.printStackTrace();
          e.printStackTrace();
        }
      } else {
        e.printStackTrace();
      }
      if (e instanceof ExceptionWithCode) {
        pReq.setAttribute("error_code",
          ((ExceptionWithCode) e).getCode());
        pReq.setAttribute("short_message",
          ((ExceptionWithCode) e).getShortMessage());
      } else {
        pReq.setAttribute("error_code",
          HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
      }
      pReq.setAttribute("javax.servlet.error.status_code",
        HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
      pReq.setAttribute("javax.servlet.error.exception", e);
      pReq.setAttribute("javax.servlet.error.request_uri",
        pReq.getRequestURI());
      pReq.setAttribute("javax.servlet.error.servlet_name", this.getClass()
        .getCanonicalName());
      pResp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
  }
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);
        }
    }
84079
public function init()
    {
        parent::init();

        if (($this->module === null) || ($this->match === false)) {
            return;
        }

        $this->module->on(
            Module::EVENT_BEFORE_ACTION,
            function (ActionEvent $event) {
                $this->beforeAction($event);
            }
        );

        $this->module->on(
            Module::EVENT_AFTER_ACTION,
            function (ActionEvent $event) {
                $this->afterAction($event);
            }
        );

        $this->module->on(
            Module::EVENT_PROCESS_FILE,
            function ($event) {
                $this->onProcessFile($event);
            }
        );
    }
366959
@Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);

    isPruned = in.readBoolean();
    size = in.readVInt();
    termsEncoding = TermsByQueryRequest.TermsEncoding.values()[in.readVInt()];
    encodedTerms = in.readBytesRef();
  }