01: /*
02: * $Id: TestEvent.java,v 1.2 2003/09/14 05:36:47 jonesde Exp $
03: *
04: * Copyright (c) 2001-2003 The Open For Business Project - www.ofbiz.org
05: *
06: * Permission is hereby granted, free of charge, to any person obtaining a
07: * copy of this software and associated documentation files (the "Software"),
08: * to deal in the Software without restriction, including without limitation
09: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10: * and/or sell copies of the Software, and to permit persons to whom the
11: * Software is furnished to do so, subject to the following conditions:
12: *
13: * The above copyright notice and this permission notice shall be included
14: * in all copies or substantial portions of the Software.
15: *
16: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21: * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22: * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23: *
24: */
25: package org.ofbiz.content.webapp.event;
26:
27: import javax.servlet.http.HttpServletRequest;
28: import javax.servlet.http.HttpServletResponse;
29:
30: import org.ofbiz.base.util.Debug;
31: import org.ofbiz.base.util.HttpClient;
32:
33: /**
34: * Test Events
35: *
36: * @author <a href="mailto:jaz@ofbiz.org">Andy Zeneski</a>
37: * @version $Revision: 1.2 $
38: * @since 2.0
39: */
40: public class TestEvent {
41:
42: public static final String module = TestEvent.class.getName();
43:
44: public static String test(HttpServletRequest request,
45: HttpServletResponse response) {
46: request.setAttribute("MESSAGE", "Test Event Ran Fine.");
47: Debug.log("Test Event Ran Fine.", module);
48: return "success";
49: }
50:
51: public static String httpClientTest(HttpServletRequest request,
52: HttpServletResponse response) {
53: try {
54: HttpClient http = new HttpClient(
55: "http://www.ofbiz.org/cgi-bin/http_test.pl");
56:
57: http.setHeader("Cookie", "name=value,value=name");
58: http.setHeader("User-Agent", "Mozilla/4.0");
59: http.setParameter("testId", "testing");
60: Debug.log(http.post(), module);
61: } catch (Exception e) {
62: Debug.log(e, "HttpClientException Caught.", module);
63: }
64: return "success";
65: }
66: }
|