Class |
|
---|---|
Component |
|
Dynamo can pass arguments in a URL without using query arguments. Instead of using query arguments, these URL arguments are passed as part of the pathInfo
, and are identified by a starting semicolon (;
) character. For example:
/pages/x.jsp;jsessionid=3324123;dynargs=aafsdf?color=blue
This URL contains two URL arguments: jsessionid
, with a value of 3324123
, and dynargs
, with a value of aafsdf
. URL arguments are appended to the pathInfo
before the query arguments, and can use one of two possible forms. In the first form, each argument starts with a semicolon, and the argument is a name=value pair, in this form:
/mypage.jsp;arg1=val1;arg2=val2...
In the second form, each argument starts with a semicolon, and the argument name is surrounded by dollar signs, in this form:
/mypage.jsp;$arg1$val1;$arg2$val2...
Notice how these arguments are different from the query argument, which in the previous example is color
with a value of blue
.
The reason that URL arguments are sometimes used is because there are certain instances where query arguments are replaced by the browser. Most notably, an image submit button on a form replaces the query arguments with the coordinates of the click that causes the form to be submitted. In instances where you absolutely must preserve the argument, you cannot use the query string to pass the argument.
Of course, after these arguments are added to the URL, they must be removed before further processing can continue. URLArgumentServlet
modifies the pathInfo
and requestURI
to remove the URL arguments. This pipeline servlet also adds a new attribute factory that returns the extracted URL arguments as a Dictionary
. Because an attribute factory is used, that Dictionary
is not computed until the first time the attribute is accessed. The name of the attribute is specified at URLArgumentPipeline.ATTRIBUTE_NAME
.
So, given the previous example, the modified requestURI
looks like this:
/pages/x.jsp?color=blue
the modified pathInfo
looks like this:
/pages/x.jsp
and the Dictionary
attribute looks like this:
"jsessionid" = "3324123"
"dynargs" = "aafsdf"