0

create subdirectory in zk

asked 2011-03-28 03:32:02 +0800

charmeleon gravatar image charmeleon
27

Hi! I am new to ZK. Is it possible to create new directories under WEB-INF in zk? I cannot seem to be able to make java.io.File work...Thanks

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2011-03-28 03:35:34 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

updated 2011-03-28 03:35:51 +0800

I am not sure this is a ZK issue.

application.getRealPath()

or similat might help to get the way to WEB-INF folder

Returns a String containing the real path for a given virtual path. For example, the path "/index.html" returns the absolute file path on the server's filesystem would be served by a request for "http://host/contextPath/index.html", where contextPath is the context path of this WebApp.
Notice that ZK don't count on this method to retrieve resources. If you want to change the mapping of URI to different resources, override org.zkoss.zk.ui.sys.UiFactory.getPageDefinition instead.
Parameters:
path

Hope it helps
Stefano

link publish delete flag offensive edit

answered 2011-03-28 03:42:44 +0800

charmeleon gravatar image charmeleon
27

Thanks for the info. Um, how about if I want to get the file's path in the disk like for example, "C:/workspace/zss/WebContent..."?

link publish delete flag offensive edit

answered 2011-03-28 06:02:40 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Doesn't application.getRealPath() already return this?!

link publish delete flag offensive edit

answered 2011-03-28 09:27:45 +0800

charmeleon gravatar image charmeleon
27

Hi again. My project can be found in D:\workspace but when I tried using

application.getRealPath("/")
I ended up with this: "D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dataLoad\" Am I missing something here? :( Thanks

link publish delete flag offensive edit

answered 2011-03-28 09:38:30 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Well... this is where Eclipse's Tomcat instance is actually deploying on the fly your application for development/testing purposes.
So the value obtained is correct.
You will never be able to get the Workspace location - i.e. where e.g. Eclipse is storing project files.
Your application is instead able to look at the position where it is deployed.
Suppose you will deploy under Tomcat, you will get:
C:\Programs\Tomcat\webapps\dataLoad\
Maybe if you explain what you have to do and why... ;)

link publish delete flag offensive edit

answered 2011-03-28 10:35:31 +0800

charmeleon gravatar image charmeleon
27

Thanks for clarifying. I tried deploying it by not using Eclipse and the path being returned is the one I need.

link publish delete flag offensive edit

answered 2011-03-28 10:55:18 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Great, good luck!

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-03-28 03:32:02 +0800

Seen: 211 times

Last updated: Mar 28 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More