2
* $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/actions/ViewDefinitionsAction.java,v 1.10 2004/03/14 06:23:46 sraeburn Exp $
4
* $Date: 2004/03/14 06:23:46 $
6
* Copyright 1999-2004 The Apache Software Foundation.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
12
* http://www.apache.org/licenses/LICENSE-2.0
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
22
package org.apache.struts.tiles.actions;
24
import java.io.PrintWriter;
26
import javax.servlet.ServletContext;
27
import javax.servlet.http.HttpServletRequest;
28
import javax.servlet.http.HttpServletResponse;
30
import org.apache.struts.action.Action;
31
import org.apache.struts.action.ActionForm;
32
import org.apache.struts.action.ActionForward;
33
import org.apache.struts.action.ActionMapping;
34
import org.apache.struts.tiles.DefinitionsFactory;
35
import org.apache.struts.tiles.TilesUtil;
40
* <p>An <strong>Action</strong> that writes the
41
* definitions of the Tiles factory.
42
* Useful to check what is effectivly loaded in a
46
public class ViewDefinitionsAction extends Action {
49
* Process the specified HTTP request, and create the corresponding HTTP
50
* response (or forward to another web component that will create it),
51
* with provision for handling exceptions thrown by the business logic.
53
* @param mapping The ActionMapping used to select this instance
54
* @param form The optional ActionForm bean for this request (if any)
55
* @param request The HTTP request we are processing
56
* @param response The HTTP response we are creating
58
* @exception Exception if the application business logic throws
62
public ActionForward execute(ActionMapping mapping,
64
HttpServletRequest request,
65
HttpServletResponse response)
68
response.setContentType("text/plain");
69
PrintWriter writer = response.getWriter();
72
ServletContext context = getServlet().getServletContext();
73
DefinitionsFactory factory = TilesUtil.getDefinitionsFactory(request, context );
74
writer.println( factory.toString() );
75
} catch (Exception e) {
76
writer.println("FAIL - " + e.toString());
77
getServlet().log("ReloadAction", e);