Search in sources :

Example 11 with SystemInfo

use of org.hisp.dhis.system.SystemInfo in project dhis2-core by dhis2.

the class CharResponseWrapper method doFilter.

@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
    if (req != null && req instanceof HttpServletRequest && res != null && res instanceof HttpServletResponse) {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) res;
        PrintWriter writer = response.getWriter();
        CharResponseWrapper responseWrapper = new CharResponseWrapper(response);
        chain.doFilter(request, responseWrapper);
        responseWrapper.setContentType("text/cache-manifest");
        SystemInfo systemInfo = systemService.getSystemInfo();
        writer.print(responseWrapper.toString());
        writer.println("# DHIS2 " + systemInfo.getVersion() + " r" + systemInfo.getRevision());
        writer.println("# User: " + currentUserService.getCurrentUsername());
        writer.println("# User UI Language: " + localeManager.getCurrentLocale());
        writer.println("# User DB Language: " + userSettingService.getUserSetting(UserSettingKey.DB_LOCALE));
        writer.println("# Calendar: " + systemInfo.getCalendar());
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) SystemInfo(org.hisp.dhis.system.SystemInfo) HttpServletResponse(javax.servlet.http.HttpServletResponse) PrintWriter(java.io.PrintWriter)

Aggregations

SystemInfo (org.hisp.dhis.system.SystemInfo)11 ByteArrayInputStream (java.io.ByteArrayInputStream)5 DhisSpringTest (org.hisp.dhis.DhisSpringTest)5 IntegrationTest (org.hisp.dhis.IntegrationTest)5 Test (org.junit.Test)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 PrintWriter (java.io.PrintWriter)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ServletContext (javax.servlet.ServletContext)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 IdentifiableObject (org.hisp.dhis.common.IdentifiableObject)1 ComplexNode (org.hisp.dhis.node.types.ComplexNode)1