Post

2 followers Follow
1
Avatar

RelativeObjectPath

 

On localhost my RelativeObjectPath is :

D:/stadyIdea/Margo/siteMargo/src/main/resources/static/

After deploy on pivotal.io I try to use path:
/home/vcap/app/static/

but it's not working

Could you plz. explain to me, where I can receive relativeObjectPath?

Alexey As

Please sign in to leave a comment.

3 comments

0
Avatar

src/main/resources/static/ is on your class path, so you should be able to reference things relative to the class path.  You could also use relative filesystem paths.  

If you need to reference something using a full filesystem path, you can use the `user.home` system property to get the home directory or you can use the `user.dir` system property to get the working directory.  Then you can build paths based on that.

Hope that helps!

Daniel Mikusa 0 votes
0
Avatar

For my deploy on pivotal.io I use this code in application.properties:

img.curtain.path=/home/vcap/app/static/image/allFabric/curtain/
img.curtain.relative.path=image/allFabric/curtain/
...
I use this path for add/Edit images in my web application.
I have problem with img.curtain.path.
If I have correctly understood you, my path will have been such look:
img.curtain.path= user/home/static/image/allFabric/curtain/

It's will be correct? How you think?
Alexey As 0 votes
0
Avatar

If you're using Spring Boot, you can reference `${user.dir}` or `${user.home}` in `application.properties` and the correct value will be substituted.

Ex:

img.curtain.path=${user.home}/static/image/allFabric/curtain/

 

Daniel Mikusa 0 votes