KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > base > secureApp > ServletGoBack


1 /*
2  ************************************************************************************
3  * Copyright (C) 2001-2006 Openbravo S.L.
4  * Licensed under the Apache Software License version 2.0
5  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6  * Unless required by applicable law or agreed to in writing, software distributed
7  * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8  * CONDITIONS OF ANY KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations under the License.
10  ************************************************************************************
11 */

12 package org.openbravo.base.secureApp;
13
14 //import org.openbravo.xmlEngine.Report;
15
import org.openbravo.base.*;
16
17 import java.io.*;
18 import javax.servlet.*;
19 import javax.servlet.http.*;
20
21
22
23 public class ServletGoBack extends HttpBaseServlet {
24   String JavaDoc strServletPorDefecto;
25
26   public class Variables extends VariablesHistory {
27
28     public Variables(HttpServletRequest request) {
29       super(request);
30       String JavaDoc sufix = getCurrentHistoryIndex();
31       removeSessionValue("reqHistory.servlet" + sufix);
32       removeSessionValue("reqHistory.path" + sufix);
33       removeSessionValue("reqHistory.command" + sufix);
34       downCurrentHistoryIndex();
35     }
36   }
37
38   public void init (ServletConfig config) {
39     super.init(config);
40     strServletPorDefecto = config.getServletContext().getInitParameter("DefaultServlet");
41   }
42
43   public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException {
44     log4j.info("start doPost");
45     Variables vars = new Variables(req);
46     String JavaDoc strUrl = strDireccion + vars.getCurrentServletPath(strServletPorDefecto) + "?Command=" + vars.getCurrentServletCommand();
47     res.sendRedirect(res.encodeRedirectURL(strUrl));
48   }
49
50   public String JavaDoc getServletInfo() {
51     return "Servlet that receives and redirects go back requests, using history information registered in the httpSession";
52   } // end of getServletInfo() method
53
}
54
Popular Tags