Class WebUtilInternal


  • public class WebUtilInternal
    extends Object
    Author:
    Yegor.Yarko Date: 22/03/2019
    • Constructor Detail

      • WebUtilInternal

        public WebUtilInternal()
    • Method Detail

      • getLocalRootUrl

        @NotNull
        public static String getLocalRootUrl​(@NotNull
                                             javax.servlet.http.HttpServletRequest request)
        Best guess of the root server URL which can be used on the machine where the server runs to contact the server web endpoint (the same one as used by the original request)
      • getWriter

        @NotNull
        public static Writer getWriter​(@NotNull
                                       javax.servlet.http.HttpServletResponse response)
                                throws IOException

        Returns the Writer of the response with the UTF-8 encoding.

        This method is trying to use the ServletResponse.getOutputStream() if possible that is preferred comparing with the ServletResponse.getWriter(), because the PrintWriter returned by it silently eats all IOException.

        Throws:
        IOException
        Since:
        2022.1