• Post Reply Bookmark Topic Watch Topic
  • New Topic

context root. accessing directory from browser  RSS feed

 
imran sujoy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though this is not jsp, but jhtml the problem is somewhat similar.

Scenario:

1. jhtmls are inside this:

KDCATG/modules/b2b/htdocs/global/en/b2b/private/admin/esrvtool/

2. I access these jhtmls in this way:

<server>:<port>/dyn/dyn/global/en/b2b/private/admin/esrvtool/
<some>.jhtml

3. /dyn is the context root.

4. Now I'm creating text file under a directory:

KDCATG/modules/b2b/htdocs/global/numberfile/

5. I want to download these text files after redirection from a
servlet:

<server>:<port>/dyn/dyn/global/numberfile/<some>.txt

Problem:

If I try to create the file using the relative path like "/dyn/dyn/
global/numberfile/" it cannot find the path, which is normal, there is
no such path. So I had to give the whole path. Now how to create the
file without a path which is not dependent on my own directory
structure, but should be dependent only on the webapp directory
structure.

Similarly, if I want to access as in #5 step, its giving 404: resource
not found. But, atleast here, it should access the directory, but it's
not.

Or, if I just want to see the directory listing in the browser from
<server>:<port>/dyn/dyn/global/
it doesn't show the "numberfile" directory.

So, how I can do it with relative path? Do I need to configure
somewhere?

And ok, I printed the req.getContextPath() --> /dyn
and
req.getRealPath(req.getContextPath()) --> null
[ December 11, 2008: Message edited by: Bear Bibeault ]
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I try to create the file using the relative path like "/dyn/dyn/
global/numberfile/" it cannot find the path,


Relative paths don't start with a "/" which represents absolute path from the context root.
 
imran sujoy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response. Now my question can be refreshed as, how can I create a directory under root, such as /data/file/ under which I'll create all my files, and I want to make them download from the browser, when a link is clicked?
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, i can say only regarding jsp/servlet containers...
any thing you place in any subdirectory of context root apart from WEB-INF can be directly accessed....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!