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.
      • gson

        protected final transient com.google.gson.Gson gson
      • 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​(boolean suppressMessage,
                                                        jakarta.servlet.http.HttpServletResponse response,
                                                        Path path,
                                                        Pattern filePathPattern,
                                                        Pattern grepPattern,
                                                        boolean recursive,
                                                        boolean listDirectories)
      • 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,
                               boolean usedefault)
        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,
                                                       boolean listDirectories)
      • 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.
      • abbreviate

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

        protected boolean isNotEmpty​(String s)
      • gitIgnored

        protected static boolean gitIgnored​(Path path)