1<%@ page import="org.apache.log4j.*" %>
2<%@ page import="com.ecyrd.jspwiki.*" %>
3<%@ page import="com.ecyrd.jspwiki.tags.WikiTagBase" %>
4<%@ page errorPage="/Error.jsp" %>
5<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
6<%!
7    /**
8     * This page contains the logic for finding and including
9       the correct login form, which is usually loaded from
10       the template directory's LoginContent.jsp page.
11       It should not be requested directly by users. If
12       container-managed authentication is in force, the container
13       will prevent direct access to it.
14     */
15    Logger log = Logger.getLogger("JSPWiki");
16
17%>
18<%
19    WikiEngine wiki = WikiEngine.getInstance( getServletConfig() );
20    // Retrieve the Login page context, then go and find the login form
21
22    WikiContext wikiContext = (WikiContext) pageContext.getAttribute( WikiTagBase.ATTR_CONTEXT, PageContext.REQUEST_SCOPE );
23
24    // If no context, it means we're using container auth.  So, create one anyway
25    if( wikiContext == null )
26    {
27        wikiContext = wiki.createContext( request, WikiContext.LOGIN );
28        pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
29                                  wikiContext,
30                                  PageContext.REQUEST_SCOPE );
31    }
32
33    response.setContentType("text/html; charset="+wiki.getContentEncoding() );
34    String contentPage = wiki.getTemplateManager().findJSP( pageContext,
35                                                            wikiContext.getTemplate(),
36                                                            "ViewTemplate.jsp" );
37
38    log.debug("Login template content is: " + contentPage);
39
40%><wiki:Include page="<%=contentPage%>" />