You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2021/11/15 14:23:57 UTC

[jspwiki] 07/14: Fix login when using `CookieAuthenticationLoginModule`, http response was being written after being committed

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit d24863b8bc03084314a08acca9da0ee5b8fd9d23
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Mon Nov 15 14:32:26 2021 +0100

    Fix login when using `CookieAuthenticationLoginModule`, http response was being written after being committed
---
 jspwiki-war/src/main/webapp/LoginForm.jsp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/jspwiki-war/src/main/webapp/LoginForm.jsp b/jspwiki-war/src/main/webapp/LoginForm.jsp
index 88efb97..ad07070 100644
--- a/jspwiki-war/src/main/webapp/LoginForm.jsp
+++ b/jspwiki-war/src/main/webapp/LoginForm.jsp
@@ -47,10 +47,12 @@
         wikiContext = Wiki.context().create( wiki, request, ContextEnum.WIKI_LOGIN.getRequestContext() );
         pageContext.setAttribute( Context.ATTR_CONTEXT, wikiContext, PageContext.REQUEST_SCOPE );
     }
-    
-    response.setContentType("text/html; charset="+wiki.getContentEncoding() );
+
+    if( !response.isCommitted() ) {
+        response.setContentType( "text/html; charset=" + wiki.getContentEncoding() );
+    }
     String contentPage = wiki.getManager( TemplateManager.class ).findJSP( pageContext, wikiContext.getTemplate(), "ViewTemplate.jsp" );
                                                             
-    log.debug("Login template content is: " + contentPage);
+    log.debug( "Login template content is: {}", contentPage );
     
 %><wiki:Include page="<%=contentPage%>" />
\ No newline at end of file