org.apache.struts2.components

## Class ServletUrlRenderer

- java.lang.Object
- - org.apache.struts2.components.ServletUrlRenderer

- All Implemented Interfaces:
    UrlRenderer

      public class ServletUrlRenderer
      extends Object
      implements UrlRenderer

  Implementation of the `UrlRenderer` interface that creates URLs suitable in a servlet environment.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServletUrlRenderer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beforeRenderUrl(UrlProvider urlComponent)` Preprocessing step
    `protected void` | `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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ServletUrlRenderer

          public ServletUrlRenderer()

  - ### Method Detail

    - #### setActionMapper

          public void setActionMapper(ActionMapper mapper)

      Specified by:
        `setActionMapper` in interface `UrlRenderer`

    - #### setUrlHelper

          public void setUrlHelper(UrlHelper urlHelper)

    - #### setQueryStringParser

          public void setQueryStringParser(QueryStringParser queryStringParser)

    - #### renderUrl

          public void renderUrl(Writer writer,
                                UrlProvider urlComponent)

      Render a URL.
      Specified by:
        `renderUrl` in interface `UrlRenderer`
      Parameters:
        `writer` - A writer that the implementation can use to write the result to.
        `urlComponent` - The `UrlProvider` component that "owns" this renderer.

    - #### renderFormUrl

          public void renderFormUrl(Form formComponent)

      Render a Form URL.
      Specified by:
        `renderFormUrl` in interface `UrlRenderer`
      Parameters:
        `formComponent` - The `Form` component that "owns" this renderer.

    - #### beforeRenderUrl

          public void beforeRenderUrl(UrlProvider urlComponent)

      Description copied from interface: `UrlRenderer`
      Preprocessing step
      Specified by:
        `beforeRenderUrl` in interface `UrlRenderer`
      Parameters:
        `urlComponent` - The `UrlProvider` component that "owns" this renderer.

    - #### mergeRequestParameters

          protected void 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 parameters
        `contextParameters` - request parameters

Copyright © 2000–2023 Apache Software Foundation. All rights reserved.