Package org.apache.struts2.components
Class ServletUrlRenderer
java.lang.Object
org.apache.struts2.components.ServletUrlRenderer
- All Implemented Interfaces:
UrlRenderer
Implementation of the
UrlRenderer
interface that creates URLs suitable in a servlet environment.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeRenderUrl
(UrlProvider urlComponent) Preprocessing stepprotected QueryStringParser.Result
mergeRequestParameters
(String value, Map<String, Object> parameters, Map<String, ?> contextParameters) Merge request parameters into current parameters.void
renderFormUrl
(Form formComponent) Render a Form URL.void
renderUrl
(Writer writer, UrlProvider urlComponent) Render a URL.void
setActionMapper
(ActionMapper mapper) void
setQueryStringParser
(QueryStringParser queryStringParser) void
setUrlHelper
(UrlHelper urlHelper)
-
Constructor Details
-
ServletUrlRenderer
public ServletUrlRenderer()
-
-
Method Details
-
setActionMapper
- Specified by:
setActionMapper
in interfaceUrlRenderer
-
setUrlHelper
-
setQueryStringParser
-
renderUrl
Render a URL.- Specified by:
renderUrl
in interfaceUrlRenderer
- Parameters:
writer
- A writer that the implementation can use to write the result to.urlComponent
- TheUrlProvider
component that "owns" this renderer.
-
renderFormUrl
Render a Form URL.- Specified by:
renderFormUrl
in interfaceUrlRenderer
- Parameters:
formComponent
- TheForm
component that "owns" this renderer.
-
beforeRenderUrl
Description copied from interface:UrlRenderer
Preprocessing step- Specified by:
beforeRenderUrl
in interfaceUrlRenderer
- Parameters:
urlComponent
- TheUrlProvider
component that "owns" this renderer.
-
mergeRequestParameters
protected QueryStringParser.Result mergeRequestParameters(String value, Map<String, Object> parameters, Map<String, ?> contextParameters) Merge request parameters into current parameters. If a parameter is already present, than the request parameter in the current request and value attribute will not override its value.The priority is as follows:-
- parameter from the current request (least priority)
- parameter form the value attribute (more priority)
- parameter from the param tag (most priority)
- Parameters:
value
- the value attribute (URL to be generated by this component)parameters
- component parameterscontextParameters
- request parameters- Returns:
QueryStringParser.Result
of value's ?query-string or empty()
-