<%-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --%> <%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %> <%@ page import="org.apache.wiki.*" %> <%@ page import="org.apache.wiki.auth.AuthenticationManager" %> <%@ page import="org.apache.wiki.preferences.Preferences" %> <%@ page import="org.apache.wiki.ui.Installer" %> <%@ page import="org.apache.log4j.*" %> <%@ page import="java.util.ResourceBundle" %> <%@ page import="java.text.MessageFormat" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%! Logger log = Logger.getLogger("JSPWiki"); %> <% WikiEngine wiki = WikiEngine.getInstance( getServletConfig() ); // Create wiki context and check for authorization WikiContext wikiContext = wiki.createContext( request, WikiContext.INSTALL ); if(!wiki.getAuthorizationManager().hasAccess( wikiContext, response )) return; Installer installer = new Installer( request, config ); WikiSession wikiSession = wikiContext.getWikiSession(); // Parse the existing properties installer.parseProperties(); boolean validated = false; String password = null; ResourceBundle rb = Preferences.getBundle( wikiContext, "CoreResources" ); // If user hit "submit" button, validate and install them if( request.getParameter("submit") != null ) { validated = installer.validateProperties(); if ( validated ) { installer.saveProperties(); password = installer.createAdministrator(); if ( password != null ) { Object[] args = { Installer.ADMIN_ID, password, Installer.ADMIN_GROUP }; wikiSession.addMessage( Installer.INSTALL_INFO, MessageFormat.format( rb.getString( "install.jsp.install.msg.rnd.pwd" ), args ) ); } } } if ( !installer.adminExists() ) { wikiSession.addMessage( Installer.INSTALL_WARNING, rb.getString( "install.jsp.install.msg.admin.notexists" ) ); } // Make this HTTP response non-cached, and never-expiring response.addHeader("Pragma", "no-cache"); response.setHeader( "Expires", "-1" ); response.setHeader("Cache-Control", "no-cache" ); response.setContentType("text/html; charset=UTF-8"); %> <fmt:message key="install.jsp.title" />






<% if( validated ) { if ( password != null ) { %>

<% } } else { %>

<% } %>





<%=installer.getPropertiesPath()%>
" />

<% if( validated ) { %>

<%=installer.getProperties()%>
<% } %>