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

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `buildParametersString(Map<String,Object> params, StringBuilder link, String paramSeparator)` Deprecated. since Struts 6.1.0, use `QueryStringBuilder` instead
    `void` | `buildParametersString(Map<String,Object> params, StringBuilder link, String paramSeparator, boolean encode)` Deprecated. since Struts 6.1.0, use `buildParametersString(Map, StringBuilder, String)`
    `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)` Deprecated. since 6.1.0, use `UrlDecoder` directly, use `Inject` to inject a proper instance
    `String` | `decode(String input, boolean isQueryString)` Deprecated. since 6.1.0, use `UrlDecoder` directly, use `Inject` to inject a proper instance
    `String` | `encode(String input)` Deprecated. since 6.1.0, use `UrlEncoder` directly, use `Inject` to inject a proper instance
    `protected boolean` | `isValidScheme(String scheme)`
    `Map<String,Object>` | `parseQueryString(String queryString, boolean forceValueArray)` Deprecated. since 6.1.0, use `QueryStringParser` directly, use `Inject` to inject a proper instance
    `void` | `setDecoder(UrlDecoder decoder)`
    `void` | `setEncoder(UrlEncoder encoder)`
    `void` | `setHttpPort(String httpPort)`
    `void` | `setHttpsPort(String httpsPort)`
    `void` | `setQueryStringBuilder(QueryStringBuilder builder)`
    `void` | `setQueryStringParser(QueryStringParser queryStringParser)`

    - ### 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

    - #### setHttpPort

          public void setHttpPort(String httpPort)

    - #### setHttpsPort

          public void setHttpsPort(String httpsPort)

    - #### setEncoder

          public void setEncoder(UrlEncoder encoder)

    - #### setDecoder

          public void setDecoder(UrlDecoder decoder)

    - #### setQueryStringBuilder

          public void setQueryStringBuilder(QueryStringBuilder builder)

    - #### setQueryStringParser

          public void setQueryStringParser(QueryStringParser queryStringParser)

    - #### 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

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

      Deprecated. since Struts 6.1.0, use `QueryStringBuilder` instead
      Builds parameters assigned to url - a query string
      Specified by:
        `buildParametersString` in interface `UrlHelper`
      Parameters:
        `params` - a set of params to assign
        `link` - a based url
        `paramSeparator` - separator used

    - #### buildParametersString

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

      Deprecated. since Struts 6.1.0, use `buildParametersString(Map, StringBuilder, String)`
      Builds parameters assigned to url - a query string
      Parameters:
        `params` - a set of params to assign
        `link` - a based url
        `paramSeparator` - separator used
        `encode` - if true, parameters will be encoded - ignored

    - #### isValidScheme

          protected boolean isValidScheme(String scheme)

    - #### encode

          @Deprecated
          public String encode(String input)

      Deprecated. since 6.1.0, use `UrlEncoder` directly, use `Inject` to inject a proper instance
      Encodes the URL using `UrlEncoder.encode(java.lang.String, java.lang.String)` with the encoding specified in the configuration.
      Parameters:
        `input` - the input to encode
      Returns:
        the encoded string

    - #### decode

          @Deprecated
          public String decode(String input)

      Deprecated. since 6.1.0, use `UrlDecoder` directly, use `Inject` to inject a proper instance
      Decodes the URL using `UrlDecoder.decode(String, boolean)` with the encoding specified in the configuration.
      Parameters:
        `input` - the input to decode
      Returns:
        the encoded string

    - #### decode

          @Deprecated
          public String decode(String input,
                                           boolean isQueryString)

      Deprecated. since 6.1.0, use `UrlDecoder` directly, use `Inject` to inject a proper instance
      Decodes the URL using `UrlDecoder.decode(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

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

      Deprecated. since 6.1.0, use `QueryStringParser` directly, use `Inject` to inject a proper instance
      Specified by:
        `parseQueryString` in interface `UrlHelper`

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