1
votes

It´s the first time i post so i'm sorry if i´m not so clear

I am developer and i use liferay. I have created a portlet in which you generate a .pdf to print once you have uploaded to the server.

Once the file is created, the portlet leads you to a page where loads that .pdf

The problem is when you go to that page it says:

Forbidden You don't have permission to access /pdf/EP54879.pdf on this server.

It says that because when the .pdf is created, it´s generated only with the permissions 640 and i try to access with 644.(Guest)

Currently i´ve put a CRON in the server to change the permissions, but i need access with 644 permissions at the same moment is created.

I´ve been looking for about that but i have find nothing.

It´s possible to change that permissions?

I use weblogic and i don´t know if the problem of that is liferay or weblogic.

Thanks!

1
cant you use setReadable/setWritable/setExecutable of File class? - Pankaj Kathiriya
Thank you so much Pankaj! I though the file was generated with all permissions. - Javier Piqueras Pascual
You mean your problem got solved. Should I Post any answer? - Pankaj Kathiriya
It´s solved. You can answer if you want someone with the same problem than me wants solve it.Or if not i do it :) - Javier Piqueras Pascual

1 Answers

1
votes

You can use file API methods to set proper permissions using following methods.

setReadable(readable, ownerOnly) / setReadable(readable)
setWritable(writable, ownerOnly) /  setWritable(writable)
setExecutable(executable, ownerOnly) /   setExecutable(executable)

Regards,