0

gwan/csp/strangesubfolder/inc.c can be visited via http://domainName.com/strangesubfolder/?inc

I feel this servlet mapping strange but that suits my need. I can't find the mapping description in the gwan user's manual.

Please correct me if I am wrong and confirm if it is the expected behavior.

Gil
  • 3,279
  • 1
  • 15
  • 25
k.k. lou
  • 1,805
  • 2
  • 13
  • 16

2 Answers2

0

Yes it is a standard feature.

The '?' tells G-WAN that it is a servlet. If there's no '?' it will look for the file in WWW folder.

Update:

Now I understand your confusion.

Since version release 3.3.27 this has been changed so users can easily make restful URL's

G-WAN timeline

Read the update for March 27 2012.

Now you need to place the '?' before the actual servlet name. By doing this G-WAN can efficiently rewrite '/' to '&' so you can use restful URL's like these without writing any code.

//Old way
http://domain/?user/profile&user1
http://domain/?blog/archive&2012&march

//New way (more restful no '&')
http://domain/user/?profile/user1
http://domain/blog/?archive/2012/march
Richard Heath
  • 349
  • 3
  • 12
  • What I feel strange is not the "?", but is the "strangesubfolder". As my understanding, inc.c should be visited via http: //domainName.com/**?strangesubfolder/inc**. But now, it is ...**/strangesubfolder/?inc** – k.k. lou Nov 15 '12 at 23:57
  • Originally, strangesubfolder is under csp. But now, see the url, the csp is under strangesubfolder. – k.k. lou Nov 16 '12 at 00:05
  • As i know, ".../?strangesubfolder/inc" has different meaning, i.e. to run a C-script named strangesubfolder.c with the input parameter inc(= &inc) for GET method. – k.k. lou Nov 16 '12 at 00:12
  • If it is a standard feature, i can put many levels of subfolders under /csp, then visit these pages via http: //donaminName.com/sub1/sub2/.../subN/?cscript/para1=1/para2=2/.../paramN=N – k.k. lou Nov 16 '12 at 00:15
  • I updated my answer. Yes using ".../?strangesubfolder/inc" will make "inc" a url parameter. – Richard Heath Nov 16 '12 at 16:11
  • thanks for the hyperlink to the gwan timeline, release 3.3.27. i got the answer. – k.k. lou Nov 17 '12 at 02:50
0

Yes, as Richard rightly (and promptly, thanks Richard!) explained it, this is the expected behavior.

The directory /gwan/.../csp/script.c is used to store servlets that must be run while /gwan/.../www/script.c is used to store files intended to be served as an HTTP resource.

The corresponding URLs are GET /?script.c and GET /script.c.

Any sub-directory used in the /csp or /www folders is reflected accordingly in the HTTP request: GET /folder/?script.c for dynamic contents and GET /folder/script.c for static contents.

The choice of moving the '?' query character (which can be replaced by other characters) from the old GET /csp?/folder/script.c form to the new GET /folder/?script.c form was motivated by the need to:

  • distinguish servlet names from folder names (requests can lack the servlet extension for the defined 'default' programming language, which is C if nothing is defined)
  • allow any number of sub-directories in HTTP requests
  • allow any number of query arguments in HTTP queries
  • distinguish between folders and query arguments in HTTP requests
  • make it possible to have RESTFUL requests in all the above cases.

It took us a while to find the proper mix of features with the minimal verbosity but experience has shown that this works well.

Here is an example of a RESTFUL query having both a sub-folder and query arguments:

GET /folder/?script/arg1/value1/arg2/value2/arg3/value3

By default, this is a C script, unless another language (among the 15 available for scripting) has been defined as the 'default' language.

Note that the 50+ script examples provided in the download archive illustrate this scheme which is also presented on the developers page.

Gil
  • 3,279
  • 1
  • 15
  • 25