Class AbstractPluginAction

    • Field Detail

      • BINARY_FILES_PATTERN

        public static final Pattern BINARY_FILES_PATTERN
        A pattern for filenames of binary files where grep would not work.
      • gitIgnoreRules

        protected static Map<Path,​net.stoerr.chatgpt.codevengine.AbstractPluginAction.GitIgnoreRules> gitIgnoreRules
    • Constructor Detail

      • AbstractPluginAction

        public AbstractPluginAction()
    • Method Detail

      • findMatchingFiles

        protected static Stream<Path> findMatchingFiles​(jakarta.servlet.http.HttpServletResponse response,
                                                        Path path,
                                                        Pattern filePathPattern,
                                                        Pattern grepPattern)
      • isIgnored

        protected static boolean isIgnored​(Path path)
      • getUrl

        public abstract String getUrl()
        The URL it is deployed at, e.g. /listFiles.
      • openApiDescription

        public abstract String openApiDescription()
        The OpenAPI description for this operation.
      • getQueryParam

        protected String getQueryParam​(jakarta.servlet.http.HttpServletRequest request,
                                       String name)
      • getMandatoryQueryParam

        protected String getMandatoryQueryParam​(jakarta.servlet.http.HttpServletRequest request,
                                                jakarta.servlet.http.HttpServletResponse response,
                                                String name)
      • getPath

        protected Path getPath​(jakarta.servlet.http.HttpServletRequest request,
                               jakarta.servlet.http.HttpServletResponse response,
                               boolean mustExist)
        Returns the path parameter from the request, checks if it is within the current directory.
      • getSimilarFilesMessage

        protected static String getSimilarFilesMessage​(jakarta.servlet.http.HttpServletResponse response,
                                                       Path path,
                                                       String filename)
      • getBodyParameter

        @Nullable
        protected String getBodyParameter​(jakarta.servlet.http.HttpServletResponse response,
                                          String json,
                                          String parameterName,
                                          boolean mandatory)
        Returns a parameter encoded in JSON the request body; returns "" if that parameter isn't there.
      • mappedFilename

        protected String mappedFilename​(Path path)
      • abbreviate

        protected String abbreviate​(String s,
                                    int max)
      • isNotEmpty

        protected boolean isNotEmpty​(String s)
      • gitIgnored

        protected static boolean gitIgnored​(Path path)