Hi,

we are using the ch.ivyteam.ivy.scripting.objects.File object to create a temporary file, which we want to use as a source for a stream. This seems to work fine and we have no troubles in our development environment.

In our productive environment, however, we expierence sometimes a "file not found" exception. As far as I know, the temporary files should be stored in a temp folder like /files/sessions/{sessionID}/ .

In our environment, these files are not in a session subfolder but can be found directly in the folder /session/tempfileXYZ. We therefore assume that whenever we close a session, the whole tempfolder is deleted, which will result in our "file not found" exception for other users.

Is there any way to enable that files will be stored in session folders again?

Thx,

Gerald

asked 21.11.2017 at 08:06

Gerald's gravatar image

Gerald
(suspended)
accept rate: 0%

edited 21.11.2017 at 08:40


Hi there,

we obviously got confused by the presented Link in our PDF Reader (which is without the session id). On the file level there is indeed a folder structure based on the session ids.

But can anyone give me a hint what could be the reason why files from the temporary folder (delegated through the stream object) become invalid within a session? I'm using the following code to create the stream.

            Ivy.log().info("Original Path: " + pathOrUrlToPdf);
            SecureRandom random = new SecureRandom();

            String tempFileName = "temp" + random.nextLong() + ".pdf";
            URL source = new URL(pathOrUrlToPdf);
            File tempFileIvy = new File(tempFileName, true);

            FileUtils.copyURLToFile(source, tempFileIvy.getJavaFile());

            returnPath = Ivy.html().fileref(tempFileIvy);

Thx,

Gerald

link
This answer is marked "community wiki".

answered 21.11.2017 at 08:39

Gerald's gravatar image

Gerald
(suspended)
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×18

Asked: 21.11.2017 at 08:06

Seen: 1,799 times

Last updated: 21.11.2017 at 08:40