Class BaseURI

    • Constructor Detail

      • BaseURI

        public BaseURI()
        Empty C'tor. Uses Turbine.getDefaultServerData().
      • BaseURI

        public BaseURI​(RunData runData)
        Constructor with a RunData object
        Parameters:
        runData - A RunData object
      • BaseURI

        public BaseURI​(RunData runData,
                       boolean redirect)
        Constructor, set explicit redirection
        Parameters:
        runData - A RunData object
        redirect - True if redirection allowed.
      • BaseURI

        public BaseURI​(ServerData serverData)
        Constructor with a ServerData object
        Parameters:
        serverData - A ServerData object
      • BaseURI

        public BaseURI​(ServerData serverData,
                       boolean redirect)
        Constructor, set explicit redirection
        Parameters:
        serverData - A ServerData object
        redirect - True if redirection allowed.
    • Method Detail

      • setRedirect

        public void setRedirect​(boolean redirect)
        Set the redirect Flag
        Parameters:
        redirect - The new value of the redirect flag.
      • isRedirect

        public boolean isRedirect()
        Returns the current value of the Redirect flag
        Returns:
        True if Redirect is allowed
      • getScriptName

        public String getScriptName()
        Gets the script name (/servlets/Turbine).
        Specified by:
        getScriptName in interface URI
        Returns:
        A String with the script name.
      • setScriptName

        public void setScriptName​(String scriptName)
        Sets the script name (/servlets/Turbine).
        Parameters:
        scriptName - A String with the script name.
      • setContextPath

        public void setContextPath​(String contextPath)
        Sets the context path.
        Parameters:
        contextPath - A String with the context path
      • setServerName

        public void setServerName​(String serverName)
        Sets the server name.
        Parameters:
        serverName - A String with the server name.
      • getServerPort

        public int getServerPort()
        Gets the server port.
        Specified by:
        getServerPort in interface URI
        Returns:
        A String with the server port.
      • setServerPort

        public void setServerPort​(int serverPort)
        Sets the server port.
        Parameters:
        serverPort - An int with the port.
      • setSecure

        public void setSecure()
        Method to specify that a URI should use SSL. The default port is used.
      • setSecure

        public void setSecure​(int port)
        Method to specify that a URI should use SSL. Whether or not it does is determined from Turbine.properties. If use.ssl in the Turbine.properties is set to false, then http is used in any case. (Default of use.ssl is true).
        Parameters:
        port - An int with the port number.
      • setServerScheme

        public void setServerScheme​(String serverScheme)
        Sets the scheme (HTTP or HTTPS).
        Parameters:
        serverScheme - A String with the scheme.
      • setReference

        public void setReference​(String reference)
        Sets a reference anchor (#ref).
        Parameters:
        reference - A String containing the reference.
      • getReference

        public String getReference()
        Returns the current reference anchor.
        Specified by:
        getReference in interface URI
        Returns:
        A String containing the reference.
      • hasReference

        public boolean hasReference()
        Does this URI contain an anchor? (#ref)
        Returns:
        True if this URI contains an anchor.
      • setResponse

        protected void setResponse​(HttpServletResponse response)
        Set a Response Object to use when creating the response string.
        Parameters:
        response - the servlet response
      • getResponse

        protected HttpServletResponse getResponse()
        Returns the Response Object from the Servlet Container.
        Returns:
        The Servlet Response object or null
      • getContextAndScript

        protected void getContextAndScript​(StringBuilder sb)
        Append the Context Path and Script Name to the passed String Buffer.

        This is a convenience method to be used in the Link output routines of derived classes to easily append the correct path.

        Parameters:
        sb - The StringBuilder to store context path and script name.
      • getSchemeAndPort

        protected void getSchemeAndPort​(StringBuilder sb)
        Appends Scheme, Server and optionally the port to the supplied String Buffer.

        This is a convenience method to be used in the Link output routines of derived classes to easily append the correct server scheme.

        Parameters:
        sb - The StringBuilder to store the scheme and port information.
      • encodeResponse

        protected String encodeResponse​(String uri)
        Encodes a Response Uri according to the Servlet Container. This might add a Java session identifier or do redirection. The resulting String can be used in a page or template.
        Parameters:
        uri - The Uri to encode
        Returns:
        An Uri encoded by the container.