0

Where does Finatra search for the files? When I write

response.ok.file(...)

in which folder should the files be placed to be found?

In the docs it says the "classpath root" which is nowhere to be found (as it doesn't exist, strictly speaking).

LowFieldTheory
  • 1,722
  • 1
  • 26
  • 39
  • `classpath root` is the path which you provide as the argument when you start your java process - `java -classpath your_class_path your_jar_file.jar` – sarveshseri Jan 15 '20 at 10:10
  • I know what they mean by that, but since the classpath is often composed of different directories it's an ambiguous term – LowFieldTheory Jan 15 '20 at 10:15
  • If classpath in Java is ambiguous, then Javapocalypse is eminent. But the problem of classpath comprising of multiple directories should not hurt you. – sarveshseri Jan 15 '20 at 11:57
  • Every one of these directories is on your classpath. The classpath root can be thought of as a directory obtained by combining all these directories. Now, you just want to give a path relative to any of these directories. – sarveshseri Jan 15 '20 at 12:03

2 Answers2

0

It will search inside the resources folder

src/main/resources

In the example below I have a web folder inside the resources

  get("/:*") { request: Request =>
    response.ok.fileOrIndex(
      s"web/${request.params("*")}",
      "web/index.html")
  }

If you are using intellijIdea you have to make sure you all the resources types defined in the configuration:

compiler->resource patters

Otherwise when compiling it won't copy it over to the output folder

0

The files taken from the resources folder will be copied under:

target/scala-2.12/classes

for Scala 2.12, BUT for files which will be created during runtime this path won't be available, i.e. the process will find only the files created before doing sbt run. This is true for both root projects and subprojects (it depends on where the run was executed).

If you need to have files loaded at all times, you need to set the flag -local.doc.root .

LowFieldTheory
  • 1,722
  • 1
  • 26
  • 39