KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portalImpl > portlet > test > ExternalAppScopedAttributeTestCompanionServlet


1 /*
2  * Copyright 2003,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 package org.apache.pluto.portalImpl.portlet.test;
17
18 import java.io.IOException JavaDoc;
19
20 import javax.servlet.RequestDispatcher JavaDoc;
21 import javax.servlet.ServletException JavaDoc;
22 import javax.servlet.http.HttpServlet JavaDoc;
23 import javax.servlet.http.HttpServletRequest JavaDoc;
24 import javax.servlet.http.HttpServletResponse JavaDoc;
25 import javax.servlet.http.HttpSession JavaDoc;
26
27 /**
28  * @author <a HREF="ddewolf@apache.org">David H. DeWolf</a>
29  */

30 public class ExternalAppScopedAttributeTestCompanionServlet extends HttpServlet JavaDoc {
31
32     public void doGet(HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res)
33     throws ServletException JavaDoc, IOException JavaDoc {
34
35         HttpSession JavaDoc session = req.getSession();
36         String JavaDoc val = (String JavaDoc)
37             session.getAttribute(ExternalAppScopedAttributeTest.INT_KEY);
38
39         if(ExternalAppScopedAttributeTest.VALUE.equals(val)) {
40             req.setAttribute("passed", new Boolean JavaDoc(true));
41
42             session.setAttribute(
43                 ExternalAppScopedAttributeTest.EXT_KEY,
44                 ExternalAppScopedAttributeTest.VALUE
45             );
46         }
47
48         RequestDispatcher JavaDoc dis = req.getRequestDispatcher("/jsp/external_app_scoped_test_ext.jsp");
49         dis.forward(req, res);
50
51     }
52 }
53
Popular Tags