Class AIConfigurationServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class AIConfigurationServlet
    extends org.apache.sling.api.servlets.SlingSafeMethodsServlet
    AIConfigurationServlet provides access to AI configurations.

    This servlet is responsible for determining which AI services are allowed for a given content path and editor URL. It serves as an entry point for clients to understand the restrictions and permissions associated with AI services in the Composum platform.

    Endpoint

    GET /bin/cpm/ai/config

    Parameters

    • contentPath (suffix): The path of the content being edited or viewed.
    • editorUrl (query parameter): The URL of the editor in the browser.

    Response

    Returns a JSON object with a key "allowedServices" that contains a list of AI services that are allowed for the given content path and editor URL. For example:

     {
         "allowedServices": {"sidepanel": true, "create": true}
     }
     

    Usage

    This servlet can be used by frontend components to dynamically adjust the availability of AI features based on the configurations set in the backend. For instance, if a certain content path is restricted from using the AI side panel, the frontend can make a call to this servlet to check the allowed services and hide the side panel accordingly.

    See Also:
    AIConfigurationService, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String PARAM_EDITORURL
      Parameter that gives the editor URL to check the permissions for.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doGet​(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)  
      • Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet

        doGeneric, doHead, doOptions, doTrace, getAllowedRequestMethods, getServletInfo, handleMethodNotImplemented, mayService, service, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
    • Field Detail

      • PARAM_EDITORURL

        public static final String PARAM_EDITORURL
        Parameter that gives the editor URL to check the permissions for.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AIConfigurationServlet

        public AIConfigurationServlet()
    • Method Detail

      • doGet

        protected void doGet​(org.apache.sling.api.SlingHttpServletRequest request,
                             org.apache.sling.api.SlingHttpServletResponse response)
                      throws IOException
        Overrides:
        doGet in class org.apache.sling.api.servlets.SlingSafeMethodsServlet
        Throws:
        IOException