| // Copyright 2004 The Apache Software Foundation |
| // |
| // Licensed 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. |
| |
| package org.apache.tapestry.engine; |
| |
| import java.io.IOException; |
| |
| import javax.servlet.ServletException; |
| |
| import org.apache.tapestry.IComponent; |
| import org.apache.tapestry.IRequestCycle; |
| import org.apache.tapestry.Tapestry; |
| import org.apache.tapestry.request.ResponseOutputStream; |
| |
| /** |
| * Restarts the Tapestry application. This is normally reserved for dealing with |
| * catastrophic failures of the application. Discards the {@link javax.servlet.http.HttpSession}, if any, |
| * and redirects to the Tapestry application servlet URL (invoking the {@link HomeService}). |
| * |
| * @author Howard Lewis Ship |
| * @version $Id$ |
| * @since 1.0.9 |
| * |
| **/ |
| |
| public class RestartService extends AbstractService |
| { |
| |
| public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters) |
| { |
| if (Tapestry.size(parameters) != 0) |
| throw new IllegalArgumentException( |
| Tapestry.format("service-no-parameters", Tapestry.RESTART_SERVICE)); |
| |
| return constructLink(cycle, Tapestry.RESTART_SERVICE, null, null, true); |
| } |
| |
| public void service( |
| IEngineServiceView engine, |
| IRequestCycle cycle, |
| ResponseOutputStream output) |
| throws ServletException, IOException |
| { |
| engine.restart(cycle); |
| } |
| |
| public String getName() |
| { |
| return Tapestry.RESTART_SERVICE; |
| } |
| |
| } |