org.apache.struts2.views.util

## Class DefaultUrlHelper

- java.lang.Object
- - org.apache.struts2.views.util.DefaultUrlHelper

- All Implemented Interfaces:
    UrlHelper

      public class DefaultUrlHelper
      extends Object
      implements UrlHelper

  Default implementation of UrlHelper

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `HTTP_PROTOCOL`
    `static String` | `HTTPS_PROTOCOL`

    - ### Fields inherited from interface org.apache.struts2.views.util.UrlHelper

      `AMP, DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultUrlHelper()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `buildParametersString(Map<String,Object> params, StringBuilder link, String paramSeparator)`
    `void` | `buildParametersString(Map<String,Object> params, StringBuilder link, String paramSeparator, boolean encode)`
    `String` | `buildUrl(String action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String,Object> params)`
    `String` | `buildUrl(String action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String,Object> params, String scheme, boolean includeContext, boolean encodeResult)`
    `String` | `buildUrl(String action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String,Object> params, String scheme, boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort)`
    `String` | `buildUrl(String action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String,Object> params, String urlScheme, boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort, boolean escapeAmp)`
    `String` | `decode(String input)` Decodes the URL using `URLDecoderUtil.decode(String, String)` with the encoding specified in the configuration.
    `String` | `decode(String input, boolean isQueryString)` Decodes the URL using `URLDecoderUtil.decode(String, String, boolean)` with the encoding specified in the configuration.
    `String` | `encode(String input)` Encodes the URL using `URLEncoder.encode(java.lang.String)` with the encoding specified in the configuration.
    `protected boolean` | `isValidScheme(String scheme)`
    `Map<String,Object>` | `parseQueryString(String queryString, boolean forceValueArray)`
    `void` | `setEncoding(String encoding)`
    `void` | `setHttpPort(String httpPort)`
    `void` | `setHttpsPort(String httpsPort)`

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

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

- - ### Field Detail

    - #### HTTP_PROTOCOL

          public static final String HTTP_PROTOCOL

      See Also:
        Constant Field Values

    - #### HTTPS_PROTOCOL

          public static final String HTTPS_PROTOCOL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DefaultUrlHelper

          public DefaultUrlHelper()

  - ### Method Detail

    - #### setEncoding

          public void setEncoding(String encoding)

    - #### setHttpPort

          public void setHttpPort(String httpPort)

    - #### setHttpsPort

          public void setHttpsPort(String httpsPort)

    - #### buildUrl

          public String buildUrl(String action,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response,
                        Map<String,Object> params)

      Specified by:
        `buildUrl` in interface `UrlHelper`

    - #### buildUrl

          public String buildUrl(String action,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response,
                        Map<String,Object> params,
                        String scheme,
                        boolean includeContext,
                        boolean encodeResult)

      Specified by:
        `buildUrl` in interface `UrlHelper`

    - #### buildUrl

          public String buildUrl(String action,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response,
                        Map<String,Object> params,
                        String scheme,
                        boolean includeContext,
                        boolean encodeResult,
                        boolean forceAddSchemeHostAndPort)

      Specified by:
        `buildUrl` in interface `UrlHelper`

    - #### buildUrl

          public String buildUrl(String action,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response,
                        Map<String,Object> params,
                        String urlScheme,
                        boolean includeContext,
                        boolean encodeResult,
                        boolean forceAddSchemeHostAndPort,
                        boolean escapeAmp)

      Specified by:
        `buildUrl` in interface `UrlHelper`

    - #### buildParametersString

          public void buildParametersString(Map<String,Object> params,
                                   StringBuilder link,
                                   String paramSeparator)

      Specified by:
        `buildParametersString` in interface `UrlHelper`

    - #### buildParametersString

          public void buildParametersString(Map<String,Object> params,
                                   StringBuilder link,
                                   String paramSeparator,
                                   boolean encode)

    - #### isValidScheme

          protected boolean isValidScheme(String scheme)

    - #### encode

          public String encode(String input)

      Encodes the URL using `URLEncoder.encode(java.lang.String)` with the encoding specified in the configuration.
      Parameters:
        `input` - the input to encode
      Returns:
        the encoded string

    - #### decode

          public String decode(String input)

      Decodes the URL using `URLDecoderUtil.decode(String, String)` with the encoding specified in the configuration.
      Parameters:
        `input` - the input to decode
      Returns:
        the encoded string

    - #### decode

          public String decode(String input,
                      boolean isQueryString)

      Decodes the URL using `URLDecoderUtil.decode(String, String, boolean)` with the encoding specified in the configuration.
      Parameters:
        `input` - the input to decode
        `isQueryString` - whether input is a query string. If `true` other decoding rules apply.
      Returns:
        the encoded string

    - #### parseQueryString

          public Map<String,Object> parseQueryString(String queryString,
                                            boolean forceValueArray)

      Specified by:
        `parseQueryString` in interface `UrlHelper`

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