@@ -0,0 +1,2108 @@
+/*%0A * Copyright 2006 The Apache Software Foundation%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.nutch.webapp.controller;%0A%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.ServletContext;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport org.apache.nutch.webapp.common.Preferences;%0Aimport org.apache.nutch.webapp.common.ServiceLocator;%0Aimport org.apache.struts.tiles.ComponentContext;%0A%0A/**%0A * Simple controller for preferences page%0A */%0Apublic class PreferencesController extends NutchController %7B%0A%0A  public void nutchPerform(ComponentContext tileContext,%0A      HttpServletRequest request, HttpServletResponse response,%0A      ServletContext servletContext) throws ServletException, IOException %7B%0A%0A    ServiceLocator locator = getServiceLocator(request);%0A%0A    if (tileContext.getAttribute(%22action%22).equals(%22save%22)) %7B%0A      LOG.info(%22save%22);%0A      Preferences p=Preferences.parse(request.getQueryString(),%22&%22, %22=%22);%0A      LOG.info(%22setting cookie%22);%0A      Preferences.setPreferencesCookie(request,response,p);%0A      LOG.info(%22setting attribute%22);%0A      request.setAttribute(%22preferences%22, p);%0A    %7D else %7B%0A      LOG.info(%22view%22);%0A      request.setAttribute(%22preferences%22, locator.getPreferences());%0A    %7D%0A    %0A    // add List languages  (defined in tles-defs)%0A    request.setAttribute(%22languages%22, tileContext.getAttribute(%22languages%22));%0A%0A    // add List hitsPerPages (defined in tles-defs)%0A    request.setAttribute(%22hitsPerPage%22, tileContext.getAttribute(%22hitsPerPage%22));%0A    %0A  %7D%0A%7D%0A

add simple preferences page