Class AdviceContext

java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.json.resource.AdviceContext
All Implemented Interfaces:
org.forgerock.services.context.Context

public class AdviceContext extends org.forgerock.services.context.AbstractContext
A Context containing information which should be returned to the user in some appropriate form to the user. For example, it could be contained within the body of the response or otherwise added to the headers returned.
Since:
2.4.0
  • Field Summary

    Fields inherited from class org.forgerock.services.context.AbstractContext

    data
  • Constructor Summary

    Constructors
    Constructor
    Description
    AdviceContext(JsonValue savedContext, ClassLoader classLoader)
    Restore from JSON representation.
    AdviceContext(org.forgerock.services.context.Context parent, Collection<String> restrictedAdviceNames)
    Creates a new AdviceContext with the provided parent.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the advices contained within this context.
    void
    putAdvice(String adviceName, String... advices)
    Adds advice to the context, which can be retrieved and later returned to the user.

    Methods inherited from class org.forgerock.services.context.AbstractContext

    as, asContext, containsContext, containsContext, get, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AdviceContext

      public AdviceContext(org.forgerock.services.context.Context parent, Collection<String> restrictedAdviceNames)
      Creates a new AdviceContext with the provided parent.
      Parameters:
      parent - The parent context.
      restrictedAdviceNames - The restricted advice names.
    • AdviceContext

      public AdviceContext(JsonValue savedContext, ClassLoader classLoader)
      Restore from JSON representation.
      Parameters:
      savedContext - The JSON representation from which this context's attributes should be parsed.
      classLoader - The ClassLoader which can properly resolve the persisted class-name.
  • Method Details

    • getAdvices

      public Map<String,List<String>> getAdvices()
      Returns the advices contained within this context.
      Returns:
      the advices contained within this context.
    • putAdvice

      public void putAdvice(String adviceName, String... advices)
      Adds advice to the context, which can be retrieved and later returned to the user.
      Parameters:
      adviceName - Name of the advice to return to the user. Not null.
      advices - Human-readable advice to return to the user. Not null.