-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item14339: Implement rest/jsonrpc support for paramaterized URLs
This adjusts the API documentation for Func::getScriptUrl and Foswiki::getScriptUrl to claify that the Web and Topic positional parameters are not always a web or topic name. Add support for: rest subject= verb= jsonrpc namespace= method= Update documentation and unit tests.
- Loading branch information
Showing
6 changed files
with
205 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
%META:TOPICINFO{author="ProjectContributor" date="1458616800" format="1.1" version="1"}% | ||
%META:TOPICINFO{author="ProjectContributor" date="1489457305" format="1.1" version="1"}% | ||
%META:TOPICPARENT{name="Macros"}% | ||
---+ SCRIPTURLPATH -- URL path of script(s) | ||
Expands to the base URL of scripts, without protocol or host | ||
---++ Parameters | ||
| *Parameter* | *Description* | *Default* | | ||
| ="$script"= | Name of script | | | ||
| =web= | Web name to add to URL | | | ||
| =topic= | Topic (or Web.Topic) to add to URL | | | ||
| Any other parameters to the macro will be added as parameters to the URL ||| | ||
%INCLUDE{"VarSCRIPTURL" section="params"}% | ||
---++ Examples | ||
* =%<nop>SCRIPTURLPATH{"view" topic="Cartoons.EvilMonkey"}%= expands to =%SCRIPTURLPATH{"view" topic="Cartoons.EvilMonkey"}%= | ||
* =%<nop>SCRIPTURLPATH{"view" web="Cartoons"}%= expands to =%SCRIPTURLPATH{"view" web="Cartoons"}%= | ||
* =%<nop>SCRIPTURLPATH{"view" topic="Cartoons.EvilMonkey" rev="1"}%= will expand to =%SCRIPTURLPATH{"view" topic="Cartoons.EvilMonkey" rev="1" }%= | ||
* =%<nop>SCRIPTURLPATH{"edit" web="Cartoons" topic="EvilMonkey" t="%<nop>GMTIME{"$epoch"}%"}%= expands to =%SCRIPTURLPATH{"edit" web="Cartoons" topic="EvilMonkey" t="%GMTIME{"$epoch"}%"}%= | ||
* =%<nop>SCRIPTURLPATH%= expands to =%SCRIPTURLPATH%= | ||
* =%<nop>SCRIPTURLPATH{script}%= expands to =%SCRIPTURLPATH{script}%= | ||
* =%<nop>SCRIPTURLPATH{"rest" subject="CommentPlugin" verb="comment" topic="Web.Topic"}%= expands to =%SCRIPTURLPATH{"rest" subject="CommentPlugin" verb="comment" topic="Web.Topic"}%= | ||
* =%<nop>SCRIPTURLPATH{"jsonrpc" namespace="Configure" }%= expands to =%SCRIPTURLPATH{"jsonrpc" namespace="Configure" }%= | ||
<div class="foswikiHelp"> | ||
%H% The =edit= script should always be used in conjunction with a =t="%<nop>GMTIME{"$epoch"}%"= parameter to ensure pages about to be edited are not cached in the browser | ||
|
||
%H% See =[[VarSCRIPTURL][SCRIPTURL]]= if you expect to need the protocol and host e.g. if you are saving the HTML of the page and using it on a different host. | ||
|
||
%X% The 'old' way of building URLs using =SCRIPTURLPATH= involved concatenating the web and topic names to the =SCRIPTURLPATH= e.g. =%<nop>SCRIPTURLPATH{"script"}%/Cartoons/EvilMonkey=. This practice is *strongly* discouraged, as it does not correctly handle encoding of the parts of the URL. At the first opportunity you should replace such URLs with the equivalent %<nop>SCRIPTURLPATH%{"script" topic="Cartoons.EvilMonkey"}%, which will handle URL encoding for you. | ||
|
||
%X% The SCRIPTURL macro does NOT support building =jsonrpc= or =rest= requests with parameters. They should still use the "contatenation" method. This is expected to be fixed in Foswiki 2.2.</div> | ||
</div> | ||
%STOPINCLUDE% | ||
---++ Related | ||
[[VarPUBURLPATH][PUBURLPATH]], [[VarSCRIPTNAME][SCRIPTNAME]], [[VarSCRIPTSUFFIX][SCRIPTSUFFIX]], [[VarSCRIPTURL][SCRIPTURL]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.