1 25 package org.ofbiz.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 40 public class TestEvent { 41 42 public static final String module = TestEvent.class.getName(); 43 44 public static String test(HttpServletRequest request, HttpServletResponse response) { 45 request.setAttribute("MESSAGE", "Test Event Ran Fine."); 46 Debug.log("Test Event Ran Fine.", module); 47 return "success"; 48 } 49 50 public static String httpClientTest(HttpServletRequest request, HttpServletResponse response) { 51 try { 52 HttpClient http = new HttpClient("http://www.ofbiz.org/cgi-bin/http_test.pl"); 53 54 http.setHeader("Cookie", "name=value,value=name"); 55 http.setHeader("User-Agent", "Mozilla/4.0"); 56 http.setParameter("testId", "testing"); 57 Debug.log(http.post(), module); 58 } catch (Exception e) { 59 Debug.log(e, "HttpClientException Caught.", module); 60 } 61 return "success"; 62 } 63 } 64 | Popular Tags |