KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > faces > systest1 > ContextAction


1 /*
2  * Copyright 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Id: ContextAction.java 54934 2004-10-16 17:07:50Z germuska $
17  */

18
19 package org.apache.struts.faces.systest1;
20
21 import java.util.Locale JavaDoc;
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import javax.servlet.http.HttpServletResponse JavaDoc;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 import org.apache.struts.action.Action;
29 import org.apache.struts.action.ActionForm;
30 import org.apache.struts.action.ActionForward;
31 import org.apache.struts.action.ActionMapping;
32 import org.apache.struts.action.ActionError;
33 import org.apache.struts.action.ActionErrors;
34
35
36 /**
37  * <p>Action to render properties from ExternalContext and the corresponding
38  * request and application context objects.</p>
39  */

40
41 public class ContextAction extends Action {
42
43
44     private static final Log log = LogFactory.getLog(ContextAction.class);
45
46
47     private String JavaDoc authType = null;
48     private String JavaDoc contextPath = null;
49     private Locale JavaDoc locale = null;
50     private String JavaDoc pathInfo = null;
51     private String JavaDoc remoteUser = null;
52     private String JavaDoc servletPath = null;
53
54
55     public String JavaDoc getAuthType() { return (this.authType); }
56     public String JavaDoc getContextPath() { return (this.contextPath); }
57     public Locale JavaDoc getLocale() { return (this.locale); }
58     public String JavaDoc getPathInfo() { return (this.pathInfo); }
59     public String JavaDoc getRemoteUser() { return (this.remoteUser); }
60     public String JavaDoc getServletPath() { return (this.servletPath); }
61
62
63     /**
64      * <p>Process an attempted logon.</p>
65      */

66     public ActionForward execute(ActionMapping mapping,
67                                  ActionForm form,
68                                  HttpServletRequest JavaDoc request,
69                                  HttpServletResponse JavaDoc response)
70         throws Exception JavaDoc {
71
72         this.authType = request.getAuthType();
73         this.contextPath = request.getContextPath();
74         this.locale = request.getLocale();
75         this.pathInfo = request.getPathInfo();
76         this.remoteUser = request.getRemoteUser();
77         this.servletPath = request.getServletPath();
78
79         request.setAttribute("contextAction", this);
80         return (mapping.findForward("context1"));
81
82     }
83
84
85 }
86
Popular Tags