@Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
            IOException {
        // TODO(msavy): look at user profile and/or token also. Might need to use ThreadLocal?
        Messages.setLocale(request.getLocale());
        try {
            Map<String, String> strings = Messages.i18n.all();
            // Externally defined strings
            strings.putAll(Messages.i18n.get("External"));

            response.getOutputStream().write("window.APIMAN_TRANSLATION_DATA = ".getBytes(StandardCharsets.UTF_8)); //$NON-NLS-1$ //$NON-NLS-2$
            JsonFactory f = new JsonFactory();
            JsonGenerator g = f.createGenerator(response.getOutputStream(), JsonEncoding.UTF8);
            g.useDefaultPrettyPrinter();

            // Write string data here.
            g.writeStartObject();
            for (Entry<String, String> entry : strings.entrySet()) {
                g.writeStringField(entry.getKey(), entry.getValue());
            }
            g.writeEndObject();

            g.flush();
            response.getOutputStream().write(";".getBytes(StandardCharsets.UTF_8)); //$NON-NLS-1$ //$NON-NLS-2$
            g.close();
        } catch (Exception e) {
            throw new ServletException(e);
        } finally {
            Messages.clearLocale();
        }
    }
@see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
manager/ui/war/src/main/java/io/apiman/manager/ui/server/servlets/TranslationServlet.java