Class BaseMapServlet

  • Direct Known Subclasses:
    MapPrinterServlet

    public abstract class BaseMapServlet
    extends java.lang.Object
    Base class for MapPrinter servlets (deals with the configuration loading).
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseMapServlet()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.lang.String cleanUpName​(java.lang.String original)
      Remove commas and whitespace from a string.
      protected static void error​(javax.servlet.http.HttpServletResponse httpServletResponse, java.lang.String message, org.springframework.http.HttpStatus code)
      Send an error to the client with a message.
      protected void error​(javax.servlet.http.HttpServletResponse httpServletResponse, java.lang.Throwable e)
      Send an error to the client with an exception.
      static java.lang.String findReplacement​(java.lang.String variableName, java.util.Date date)
      Update a variable name with a date if the variable is detected as being a date.
      protected java.lang.StringBuilder getBaseUrl​(javax.servlet.http.HttpServletRequest httpServletRequest)
      Returns the base URL of the print servlet.
      protected void setCache​(javax.servlet.http.HttpServletResponse response)
      Enable caching of the response.
      void setCacheDuration​(int cacheDurationInSeconds)
      Set the cache duration for the queries that can be cached.
      protected static void setNoCache​(javax.servlet.http.HttpServletResponse response)
      Disable caching of the response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseMapServlet

        public BaseMapServlet()
    • Method Detail

      • cleanUpName

        protected static java.lang.String cleanUpName​(java.lang.String original)
        Remove commas and whitespace from a string.
        Parameters:
        original - the starting string.
      • findReplacement

        public static java.lang.String findReplacement​(java.lang.String variableName,
                                                       java.util.Date date)
        Update a variable name with a date if the variable is detected as being a date.
        Parameters:
        variableName - the variable name.
        date - the date to replace the value with if the variable is a date variable.
      • error

        protected static void error​(javax.servlet.http.HttpServletResponse httpServletResponse,
                                    java.lang.String message,
                                    org.springframework.http.HttpStatus code)
        Send an error to the client with a message.
        Parameters:
        httpServletResponse - the response to send the error to.
        message - the message to send
        code - the error code
      • setNoCache

        protected static void setNoCache​(javax.servlet.http.HttpServletResponse response)
        Disable caching of the response.
        Parameters:
        response - the response
      • error

        protected final void error​(javax.servlet.http.HttpServletResponse httpServletResponse,
                                   java.lang.Throwable e)
        Send an error to the client with an exception.
        Parameters:
        httpServletResponse - the http response to send the error to
        e - the error that occurred
      • getBaseUrl

        protected final java.lang.StringBuilder getBaseUrl​(javax.servlet.http.HttpServletRequest httpServletRequest)
        Returns the base URL of the print servlet.
        Parameters:
        httpServletRequest - the request
      • setCacheDuration

        public final void setCacheDuration​(int cacheDurationInSeconds)
        Set the cache duration for the queries that can be cached.
        Parameters:
        cacheDurationInSeconds - the duration
      • setCache

        protected void setCache​(javax.servlet.http.HttpServletResponse response)
        Enable caching of the response.
        Parameters:
        response - the response