Class URLHelper


  • public class URLHelper
    extends Object
    • Method Detail

      • contextPart

        public static String contextPart​(javax.servlet.http.HttpServletRequest req)
      • contextPart

        public static String contextPart​(javax.servlet.http.HttpServletRequest req,
                                         ValueParameters params)
      • previewUrlFor

        public static String previewUrlFor​(String baseUrl,
                                           String language,
                                           Projekt projekt,
                                           ValueParameters params,
                                           FormVersion formVersion,
                                           Vorgang formRecord,
                                           FRQSession frqsession,
                                           String optionalSessionID)
        Parameters:
        baseUrl - Base URL to the formcycle server.
        language - Language for the form.
        projekt - Project with the form to display.
        params - Value parameters from the form request.
        formVersion - Form version to display.
        formRecord - Optional form record for which to display the form. May be null when opening the form for the first time.
        frqsession - Current form request session, if any.
        optionalSessionID - (optional) Session-ID to encode as url parameter
        Returns:
        The form/preview URL for the given project and form version.
      • provideUrlFor

        public static String provideUrlFor​(javax.servlet.http.HttpServletRequest request,
                                           FormVersion formVersion)
      • appointmentIcalServlet

        public static String appointmentIcalServlet​(String baseUrl,
                                                    ValueParameters params,
                                                    AppointmentTemplate template)
        Parameters:
        baseUrl - Context path of the web application.
        params - Additional URL parameters.
        template - Template for which to generate the URL.
        Returns:
        The full URL for the appointment iCal servlet, such as http://localhost:8080/xima-formcycle/appointment/ical/11cab23a-a36a-416b-bd5b-ae9d0003a30f/15504ad9-5287-4739-9e6c-fad66f67203e
      • formRequestCopyFor

        public static String formRequestCopyFor​(Projekt p,
                                                javax.servlet.http.HttpServletRequest request,
                                                ValueParameters params)
      • formRequestCopyFor

        public static String formRequestCopyFor​(String baseUrl,
                                                Projekt p,
                                                ValueParameters params,
                                                FormVersion formVersion,
                                                Vorgang v)
        Builds a URL to the form copy servlet with a given process id of the process to copy
        Parameters:
        baseUrl - the context path of the application
        p - the project to which the process is assigned. The projekt id is part of the URL. Must not be null
        params - additional URL parameters. Can be null.
        formVersion - if set the form of a given form version will be used. Id the param is null the currently active form version will be used
        v - the process that data will be put put to the new form. Must not be null
        Returns:
        the url
        Since:
        5.0.9
      • formRequestFor

        public static String formRequestFor​(Projekt p,
                                            javax.servlet.http.HttpServletRequest request,
                                            ValueParameters params)
      • forwardRequestFor

        public static String forwardRequestFor​(Projekt p,
                                               javax.servlet.http.HttpServletRequest request,
                                               ValueParameters params)
      • getInviteLink

        @Nullable
        public static String getInviteLink​(String baseUrl,
                                           DirectClientAuthorization authorization)
        Returns the invitation link for the given client authorization.
        Parameters:
        baseUrl - to use when producing the invitation link.
        authorization - to produce invitation link for.
        Returns:
        the invitation link for the given client authorization or null if no invitation link can be produces for the client authorization.
      • getClientResourceUrl

        public static String getClientResourceUrl​(MandantRessource res,
                                                  boolean noCache)
      • getProjectResourceUrl

        public static String getProjectResourceUrl​(ProjektRessource res,
                                                   boolean noCache)
      • getAuthCallbackBaseUrl

        public static String getAuthCallbackBaseUrl​(String baseUrl)
      • buildFinalCallbackUrl

        public static String buildFinalCallbackUrl​(javax.servlet.http.HttpServletRequest request,
                                                   FRQSession session)
      • buildFinalCallbackUrl

        public static String buildFinalCallbackUrl​(javax.servlet.http.HttpServletRequest request,
                                                   FRQSession session,
                                                   boolean relative)
      • getAuthCallbackDefaultBaseURL

        public static String getAuthCallbackDefaultBaseURL​(javax.servlet.http.HttpServletRequest request,
                                                           Projekt project)
      • getBaseUrl

        public static String getBaseUrl​(javax.servlet.http.HttpServletRequest request,
                                        Mandant client,
                                        FrontendServer fs,
                                        boolean useUrlBase)
      • getBaseUrl

        public static String getBaseUrl​(javax.servlet.http.HttpServletRequest request,
                                        Mandant client)
      • getBaseUrl

        @Deprecated
        public static String getBaseUrl​(javax.servlet.http.HttpServletRequest request)
        Deprecated.
        Use one of the other overloads of getBaseUrl that let you specify the client, frontend server, or form request context.
        Parameters:
        request - Request that was made to the server
        Returns:
        The base URL for the request.
      • getFullRequestUrl

        public static String getFullRequestUrl​(javax.servlet.http.HttpServletRequest request)
        Parameters:
        request - The current HTTP servlet request.
        Returns:
        The full request URL, including all query parameters. For AJAX or external request an absolute URL is returned. Otherwise, a relative URL without the host and protocol is returned.
      • getRelativeFullRequestUrl

        public static String getRelativeFullRequestUrl​(javax.servlet.http.HttpServletRequest request)
        Parameters:
        request - The current HTTP servlet request.
        Returns:
        The full request URL, including all query parameters. This is a relative URL without the host and protocol.
      • getAbsoluteFullRequestUrl

        public static String getAbsoluteFullRequestUrl​(javax.servlet.http.HttpServletRequest request)
        Parameters:
        request - The current HTTP servlet request.
        Returns:
        The full request URL, including all query parameters. This is an absolute URL with the host and protocol is returned.
      • getAbsoluteBaseUrl

        public static String getAbsoluteBaseUrl​(javax.servlet.http.HttpServletRequest request,
                                                Mandant client)
      • getAbsoluteBaseUrl

        public static String getAbsoluteBaseUrl​(javax.servlet.http.HttpServletRequest request,
                                                Mandant client,
                                                FrontendServer fs,
                                                boolean useUrlBase)
      • resolveFormThemeByContext

        public static FormThemeReference resolveFormThemeByContext​(IFormRequestContext requestContext,
                                                                   Textbaustein textTemplate)
        Resolves the form theme to use for the given form version. Uses the theme specified by the URL parameter "xfc-rp-theme" if set, otherwise uses the default theme from the requested form version. Always returns null if the given text template does not support form themes.
        Parameters:
        requestContext - The form request context with the URL parameters.
        textTemplate - Text template whose content is to be written to the HTTP response.
        Returns:
        The resolved form theme, null if no theme could be resolved.
      • resolveFormThemeByContext

        public static FormThemeReference resolveFormThemeByContext​(IFormRequestContext requestContext,
                                                                   boolean allowFormTheme)
        Resolves the form theme to use for the given form version. Uses the theme specified by the URL parameter "xfc-rp-theme" if set, otherwise uses the default theme from the requested form version. Always returns null if the given text template does not support form themes.
        Parameters:
        requestContext - The form request context with the URL parameters.
        allowFormTheme - Whether a custom form theme is allowed to be used.
        Returns:
        The resolved form theme, null if no theme could be resolved.
      • resolveFormThemeByContext

        public static FormThemeReference resolveFormThemeByContext​(javax.servlet.http.HttpServletRequest request,
                                                                   FormVersion formVersion,
                                                                   Textbaustein textTemplate)
        Resolves the form theme to use for the given form version. Uses the theme specified by the URL parameter "xfc-rp-theme" if set, otherwise uses the default theme from the requested form version. Always returns null if the given text template does not support form themes.
        Parameters:
        request - The HTTP request that was made.
        formVersion - The form version that was requested.
        textTemplate - Text template whose content is to be written to the HTTP response.
        Returns:
        The resolved form theme, null if no theme could be resolved.
      • resolveFormThemeByContext

        public static FormThemeReference resolveFormThemeByContext​(javax.servlet.http.HttpServletRequest request,
                                                                   FormVersion formVersion,
                                                                   boolean allowFormTheme)
        Resolves the form theme to use for the given form version. Uses the theme specified by the URL parameter "xfc-rp-theme" if set, otherwise uses the default theme from the requested form version. Always returns null if the given text template does not support form themes.
        Parameters:
        request - The HTTP request that was made.
        formVersion - The form version that was requested.
        allowFormTheme - Whether a custom form theme is allowed to be used.
        Returns:
        The resolved form theme, null if no theme could be resolved.
      • resolveFormThemeByParam

        public static FormThemeReference resolveFormThemeByParam​(FormVersion formVersion,
                                                                 String requestedThemeParam,
                                                                 boolean allowFormTheme)
        Resolves the form theme to use for the given form version. Uses the theme specified by the URL parameter "xfc-rp-theme" if set, otherwise uses the default theme from the requested form version. Always returns null if the given text template does not support form themes.
        Parameters:
        formVersion - The form version that was requested.
        requestedThemeParam - The value of the xfc-rp-theme parameter.
        allowFormTheme - Whether a custom form theme is allowed to be used.
        Returns:
        The resolved form theme, null if no theme could be resolved.
      • getAbsoluteBaseUrl

        @Deprecated
        public static String getAbsoluteBaseUrl​(javax.servlet.http.HttpServletRequest request)
        Deprecated.
        Use one of the other overloads of getAbsoluteBaseUrl that let you specify the client, frontend server, or form request context.
        Parameters:
        request - Request that was made to the server
        Returns:
        The absolute base URL for the request.
      • isExternalOrAjaxRequest

        public static boolean isExternalOrAjaxRequest​(javax.servlet.http.HttpServletRequest request)
      • getAuthCallbackBaseUrl

        @Deprecated
        public static String getAuthCallbackBaseUrl​(IFormAuthContext authCtx)
        Deprecated.
        Won't be available in version 8.0.0 anymore.