org.apache.myfaces.trinidad.util

## Class URLEncoderFactory

- java.lang.Object
- - org.apache.myfaces.trinidad.util.URLEncoderFactory

-     public class URLEncoderFactory
      extends Object

  This is a factory for the URLEncoder. The URL encoder is a convenience class that handles URL encoding in a container independant fashion. The Portlet bridge spec and later JSF specifications have tried to make URL encoding more specific, but these technologies do not always address the needs of Trinidad URL encoding in all circumstances. This method aims to do just that.

  This factory can both create URLEncoders as well as keep track of an encoder on a per-request basis. Additionally, custom URLEncoders can be added manually via the `setURLEncoder(org.apache.myfaces.trinidad.util.URLEncoder)` method.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `URLEncoderFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static URLEncoderFactory` | `getFactory()` Returns the current URLEncoderFactory.
    `URLEncoder` | `getURLEncoder()` Returns the current URLEncoder if it has been set.
    `URLEncoder` | `getURLEncoder(javax.faces.context.ExternalContext ec)` Returns a URLEncoder if one has been set.
    `void` | `setURLEncoder(URLEncoder encoder)`

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

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

- - ### Constructor Detail

    - #### URLEncoderFactory

          public URLEncoderFactory()

  - ### Method Detail

    - #### getFactory

          public static URLEncoderFactory getFactory()

      Returns the current URLEncoderFactory.
      Returns:
        a URLEncoder factory

    - #### getURLEncoder

          public URLEncoder getURLEncoder()

      Returns the current URLEncoder if it has been set. If it has not been set it creates a new URLEncoder, sets it to the current thread, and returns its value.
      Returns:
        the currently set URL encoder.
      Throws:
        `IllegalStateException` - if no controller has been set and FacesContext is currently unavailble.

    - #### getURLEncoder

          public URLEncoder getURLEncoder(javax.faces.context.ExternalContext ec)

      Returns a URLEncoder if one has been set. If it has not been set, it creates a new URLEncoder using the provided ExternalContext.
      Returns:
        a URLEncoder for the given request
      Throws:
        `IllegalStateException` - if no controller has been set and the ExternalContext object is null

    - #### setURLEncoder

          public void setURLEncoder(URLEncoder encoder)

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.