>>
APLDN Home

>>
Events

>>
Trainings

>>
APL Books

>>
APLDN Links

>>
Discussion Groups

>>
Downloads

>>
Articles

>>
Library

>>
Learning Tools

>>
APLDN User IO

>>
APL2000.com




General

Author Thread: Virtual Directories
Jon.Capps
Virtual Directories
Posted: Wednesday, May 05, 2004 5:46 PM (EST)

Where is the root of a virtual directory?

 

I have an HTML page that the user clicks a link on.  It points to a "virtual directory" and it's correspondin APL function.  It runs and returns a page back to the browser that points to a subdirectory for graphics as in:

 

<img source="images/header.gif">

 

However, the virtual directory looks like:  www.mysite.com/apl/signup  so the resulting link looks like www.mysite.com/apl/images/header.gif and it does not find it.  Interesting note is the web directory tree looks like:

    

    APLwww

         WS

          Logs

          Public

              Talisman

                  images

 

The workspaces are in the WS subdirectory.  Logs are where all the log files are kept.  Public houses the web sites. 

 

I wanted the link to be www.mysite.com/talisman/images.  Are the vitual directories hanging off of APLwww/Public?  I tried "../talisman/images" and hard coding the location to no avail. 

 

Also, I noticed that a virtual directory has to start with a "/" if the system is going to find it.  Is this true, or have I botched my install?

 

Jon.

 


Comments:

Author Thread:
Jairo.Lopez
Virtual Directories
Posted: Wednesday, May 05, 2004 5:56 PM (EST)

To served the images from "/talisman/images" you need to change your link to:

<img src="/talisman/images/header.gif">

This way you are always certain the browser is going to the "root" folder to resolve the path for the files. Also, this syntax is easier to maintain that the "../../" hell.

To clarify, virtualpaths have to start with "/", there is nothing wrong with your setup.

 

 

     

davin.church
Virtual Directories
Posted: Wednesday, May 05, 2004 6:33 PM (EST)
Is there a way to specify a virtual directory for normal files (not workspaces) to be served from?  If I want to specify a relative path to a file (for images, like above, or for other reasons), but it's just a file and not a workspace to be executed, then I'd like to be able to specify it that way.  This also applies to having an APL workspace-returned page use hyperlinks to another page by using the same (base) virtual path as the workspace, except that it's a plain HTML file instead of another workspace.  I don't see any obvious way to do that (and a solution could also be applied to the above <img> problem).

     

Jairo.Lopez
Virtual Directories
Posted: Wednesday, May 05, 2004 6:48 PM (EST)

Any subdirectories under the "Home Directory" will appear under your webserver with a folder icon. Any files you put in this directory will be returned by the server.

For instance, if you put a folder in your public directory named "logos" and then place a file named "company.gif" in the logos directory then the following will return that image:

<img src="/logos/company.gif">

When you click on the folder under your webserver you will see a property named "access-directory". This property can be used to restrict access.

This property has the same behaviour as the virtualpath access property.

If access-directory is set to a virtualpath the result of this virtualpath must be set to document.

The valid responses are:

1 or True: allow access.

0 of False: denied access and the response is set to HTTP 403 Forbidden.
This could be used in conjunction with a login process which had set a cookie.

     

davin.church
Virtual Directories
Posted: Wednesday, May 05, 2004 7:05 PM (EST)

Yeah, but that sounds like a real directory, not a virtual directory.  Let's look at a contrived example...

 

Say I've got project Alpha in virtual directory /projects/alpha/ (so the user can see & use that in his URL) and project Beta in /projects/beta/.  I want all my references to all related files (images, html pages, whatever) to always start with the appropriate path.  But all my pages share a common set of icons, which I have stored in physical path /all_images/ (not under the /projects/ directory tree at all).  But I want all my HTML to refer to them as if they were href's in the appropriately-matching virtual directory, so the alpha pages would appear to look for them in /projects/alpha/images/ and the beta pages would look for /projects/beta/images/, but either way I want the server to actually find the files to return from /all_images/ instead.

 

So for this case I'd like to set up two virtual (file) directories named /projects/alpha/images/ and /projects/beta/images/ and point both of them to the physical /all_images/ directory.

 

Am I making sense?

     

brent.hildebrand
Virtual Directories
Posted: Wednesday, May 05, 2004 7:38 PM (EST)

From my understand on how WebServices currently works,  if you want to serve a fixed file, it must be in a "real" directory off the Home directory for a given web server.  There is no way to server out a real file like you have above via virtual directories.  This is my primary complaint in the prior thread.  Well actually, you could create a virtual directory with the path you want which points to a workspace and function which returns the file. But it would be for only one file.   You would need a virtual path for each file which is not a great solution.  Virtual paths with Wildcards, would allow APL to provide the required files, but this has not been implemented in WebServices (yet?).

 

In your example,  the directory/file,  /apl/images/header.gif,   must be a real directory  and file off the home directory of your web server. 

 

I'm still learning - so everything I just said could be wrong. 

 

 

     

brent.hildebrand
Virtual Directories
Posted: Wednesday, May 05, 2004 7:46 PM (EST)
Ah - maybe another WebServices "enhancement" and potential slowdown, but perhaps a Virtual Directory could point to a Real Directory, instead of a workspace and APL function.  The Virtual Directory would only be a replacement for the Real directory path, and APL would never be touched in this case as everything would be handled in WebServices.  This would have the added benefit in the you could reuse real directories from multiple web servers.

     

Jon.Capps
Virtual Directories
Posted: Wednesday, May 05, 2004 9:19 PM (EST)

So I am correct in assuming that the root directory is (in my case) the APLwww/Public?  It knows this because the home directory for the server is set up as C:\APLwww\Public\Talisman.

 

So virtual directories map in at one level above the directory where the web site maps? 

 

Just out of curiosity, if I made the virtual directory /Talisman/wMyPage would I have had the problem?  The original

 

<img src="images/header.gif">

 

would still work?  mmm - I will set up a test and post the results.

 

Jon.

     

davin.church
Virtual Directories
Posted: Wednesday, May 05, 2004 9:29 PM (EST)
That's kinda what I was asking for -- if it can't now do it (which I don't think it can), then I'd like to be able to do it (probably in just the way you described).

     

Jon.Capps
Virtual Directories
Posted: Thursday, May 06, 2004 3:52 PM (EST)

I stand corrected.  The "/" returns you to the home directory (where ever you defined that to be in Properties/Home Directory.  So,

 

<img src="/images/header.gif">

 

always works in the case defined above.  Assigning the virtual directory to /Talisman/wMyPage also works, but is a bit silly since the first time you change the directory structure you break the site. 

 

I promised to post the results -   The problem is clearly a short circuit between the keyboard and the floor...

     



APL2000 Official Web Site

The influence of each human being on others in this life is a kind of immortality.
--- John Quincy Adams

APLDN Home   |    |  Events   |  Trainings   |  APL Books   |  APLDN Links   |    |  Discussion Groups   |    |  Downloads   |  Articles   |  Library   |  Learning Tools   |  APLDN User IO   |  APL2000.com   |