KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > wstore > ProductServlet


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.wstore;
15
16 import javax.servlet.*;
17 import javax.servlet.http.*;
18 import java.io.*;
19 import java.util.*;
20 import java.math.*;
21
22 import org.apache.log4j.Logger;
23
24 import org.compiere.www.*;
25 import org.compiere.model.*;
26 import org.compiere.util.*;
27
28 /**
29  * Web Product Serach
30  *
31  * @author Jorg Janke
32  * @version $Id: ProductServlet.java,v 1.2 2003/07/16 19:12:12 jjanke Exp $
33  */

34 public class ProductServlet extends HttpServlet
35 {
36     /** Logging */
37     private Logger log = Logger.getLogger(getClass());
38
39     /**
40      * Initialize global variables
41      * @param config servlet configuration
42      * @throws ServletException
43      */

44     public void init(ServletConfig config) throws ServletException
45     {
46         super.init(config);
47         if (!WEnv.initWeb(config))
48             throw new ServletException("ProductServlet.init");
49     } // init
50

51     /**
52      * Get Servlet information
53      * @return Info
54      */

55     public String JavaDoc getServletInfo()
56     {
57         return "Compiere Product Serach Servlet";
58     } // getServletInfo
59

60     /**
61      * Clean up resources
62      */

63     public void destroy()
64     {
65         log.info("destroy");
66     } // destroy
67

68     /*************************************************************************/
69
70     /**
71      * Process the HTTP Post request.
72      *
73      * @param request request
74      * @param response response
75      * @throws ServletException
76      * @throws IOException
77      */

78     public void doPost(HttpServletRequest request, HttpServletResponse response)
79         throws ServletException, IOException
80     {
81         log.info("doPost from " + request.getRemoteHost() + " - " + request.getRemoteAddr());
82         Properties ctx = JSPEnv.getCtx(request);
83         HttpSession session = request.getSession(true);
84         session.removeAttribute(JSPEnv.HDR_MESSAGE);
85         WEnv.dump(session);
86         WEnv.dump(request);
87
88         // Web User
89
WebUser wu = (WebUser)session.getAttribute(WebUser.NAME);
90         if (wu == null)
91         {
92         }
93
94         // Search
95
String JavaDoc searchString = request.getParameter("searchString");
96
97
98
99
100         String JavaDoc url = "index.jsp";
101         log.info ("doPost - Forward to " + url);
102         RequestDispatcher dispatcher = getServletContext ().getRequestDispatcher (url);
103         dispatcher.forward (request, response);
104     } // doPost
105

106
107
108     /**
109      * Process the initial HTTP Get request.
110      * Reads the Parameter Amt and optional C_Invoice_ID
111      *
112      * @param request request
113      * @param response response
114      * @throws ServletException
115      * @throws IOException
116      */

117     public void doGet(HttpServletRequest request, HttpServletResponse response)
118         throws ServletException, IOException
119     {
120         log.info("doGet from " + request.getRemoteHost() + " - " + request.getRemoteAddr());
121         doPost (request, response);
122     } // doGet
123

124 } // ProductServlet
125
Popular Tags