View Javadoc

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;
19  
20  import javax.servlet.http.HttpServlet;
21  import javax.servlet.http.HttpServletResponse;
22  import javax.servlet.http.HttpServletRequest;
23  import javax.servlet.http.HttpSession;
24  import javax.servlet.RequestDispatcher;
25  import javax.servlet.ServletException;
26  
27  /***
28   * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
29   */
30  public class ExternalAppScopedAttributeTestCompanionServlet extends HttpServlet {
31  
32      public void doGet(HttpServletRequest req, HttpServletResponse res)
33      throws ServletException, IOException {
34  
35          HttpSession session = req.getSession();
36          String val = (String)
37              session.getAttribute(ExternalAppScopedAttributeTest.INT_KEY);
38  
39          if(ExternalAppScopedAttributeTest.VALUE.equals(val)) {
40              req.setAttribute("passed", new Boolean(true));
41  
42              session.setAttribute(
43                  ExternalAppScopedAttributeTest.EXT_KEY,
44                  ExternalAppScopedAttributeTest.VALUE
45              );
46          }
47  
48          RequestDispatcher dis = req.getRequestDispatcher("/jsp/external_app_scoped_test_ext.jsp");
49          dis.forward(req, res);
50  
51      }
52  }