Class Turbine

    • Constructor Detail

    • Method Detail

      • configure

        protected void configure​(ServletConfig config,
                                 ServletContext context)
                          throws Exception
        Read the master configuration file in, configure logging and start up any early services.
        Parameters:
        config - The Servlet Configuration supplied by the container
        context - The Servlet Context supplied by the container
        Throws:
        Exception - A problem occurred while reading the configuration or performing early startup
      • configureApplication

        protected Path configureApplication​(ServletConfig config,
                                            ServletContext context)
                                     throws IOException,
                                            org.apache.commons.configuration2.ex.ConfigurationException
        Checks configuraton style, resolves the location of the configuration and loads it to internal Configuration object (configuration). Allows reading from a CombinedConfigurationBuilder xml configuration file.
        Parameters:
        config - the Servlet Configuration
        context - Servlet Context
        Returns:
        The resolved Configuration Path
        Throws:
        IOException - if configuration path not found
        org.apache.commons.configuration2.ex.ConfigurationException - if failed to configure
      • findInitParameter

        protected String findInitParameter​(ServletContext context,
                                           ServletConfig config,
                                           String name,
                                           String defaultValue)
        Finds the specified servlet configuration/initialization parameter, looking first for a servlet-specific parameter, then for a global parameter, and using the provided default if not found.
        Parameters:
        context - the servlet context
        config - configuration object
        name - name of parameter
        defaultValue - of the parameter
        Returns:
        String value of the parameter
      • init

        public void init​(PipelineData data)
        Initializes the services which need PipelineData to initialize themselves (post startup).
        Parameters:
        data - The first GET request.
      • getConfiguration

        public static org.apache.commons.configuration2.Configuration getConfiguration()
        Return the current configuration with all keys included
        Returns:
        a Configuration Object
      • getServerName

        public static String getServerName()
        Return the server name.
        Returns:
        String server name
      • getServerScheme

        public static String getServerScheme()
        Return the server scheme.
        Returns:
        String server scheme
      • getServerPort

        public static String getServerPort()
        Return the server port.
        Returns:
        String server port
      • getScriptName

        public static String getScriptName()
        Get the script name. This is the initial script name. Actually this is probably not needed any more. I'll check. jvz.
        Returns:
        String initial script name.
      • getContextPath

        public static String getContextPath()
        Return the context path.
        Returns:
        String context path
      • getDefaultServerData

        public static ServerData getDefaultServerData()
        Return all the Turbine Servlet information (Server Name, Port, Scheme in a ServerData structure. This is generated from the values set when initializing the Turbine and may not be correct if you're running in a clustered structure. You can provide default values in your configuration for cases where access is requied before your application is first accessed by a user. This might be used if you need a DataURI and have no RunData object handy.
        Returns:
        An initialized ServerData object
      • setTurbineServletConfig

        public static void setTurbineServletConfig​(ServletConfig config)
        Set the servlet config for this turbine webapp.
        Parameters:
        config - New servlet config
      • setTurbineServletContext

        public static void setTurbineServletContext​(ServletContext context)
        Set the servlet context for this turbine webapp.
        Parameters:
        context - New servlet context.
      • handleException

        protected void handleException​(PipelineData pipelineData,
                                       HttpServletResponse res,
                                       Throwable t)
        This method is about making sure that we catch and display errors to the screen in one fashion or another. What happens is that it will attempt to show the error using your user defined Error Screen. If that fails, then it will resort to just displaying the error and logging it all over the place including the servlet engine log file, the Turbine log file and on the screen.
        Parameters:
        pipelineData - A Turbine PipelineData object.
        res - Servlet response.
        t - The exception to report.
      • saveServletInfo

        public static void saveServletInfo​(PipelineData data)
        Save some information about this servlet so that it can be utilized by object instances that do not have direct access to PipelineData.
        Parameters:
        data - Turbine request data
      • configureLogging

        protected void configureLogging​(Path logConf)
                                 throws IOException
        Checks Log4j 2 Context, loads log4File, if configured and configuration is not already located.
        Parameters:
        logConf - Configuration file path
        Throws:
        IOException - if path not found
      • setApplicationRoot

        public static void setApplicationRoot​(String val)
        Set the application root for the webapp.
        Parameters:
        val - New app root.
      • getApplicationRoot

        public static String getApplicationRoot()
        Get the application root for this Turbine webapp.
        Returns:
        String applicationRoot
      • getApplicationRootAsFile

        public static File getApplicationRootAsFile()
        Get the application root for this Turbine webapp as a file object.
        Returns:
        File applicationRootFile
      • getRealPath

        public static String getRealPath​(String path)
        Used to get the real path of configuration and resource information. This can be used by an app being developed in a standard CVS layout.
        Parameters:
        path - path translated to the application root
        Returns:
        the real path