List of usage examples for org.apache.commons.httpclient.methods PostMethod addParameter
public void addParameter(String paramString1, String paramString2) throws IllegalArgumentException
From source file:fr.msch.wissl.server.TServer.java
protected String login(String username, String password) throws IOException { HttpClient c = new HttpClient(); PostMethod m = new PostMethod(URL + "login"); m.addParameter("username", username); m.addParameter("password", password); c.executeMethod(m);/*from ww w . j a va 2 s. c om*/ String ret = m.getResponseBodyAsString(); return ret; }
From source file:com.liferay.mail.util.FuseMailHook.java
public void deleteUser(long companyId, long userId) { try {/*from w w w. j a va 2 s . c o m*/ String mailUserId = getMailUserId(companyId, userId); PostMethod method = getPostMethod(); method.addParameter("request", "terminate"); method.addParameter("user", mailUserId); executeMethod(method); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.mail.util.FuseMailHook.java
public void updatePassword(long companyId, long userId, String password) { try {/*from w w w . j ava2 s . c o m*/ String mailUserId = getMailUserId(companyId, userId); PostMethod method = getPostMethod(); method.addParameter("request", "modify"); method.addParameter("user", mailUserId); method.addParameter("password", password); executeMethod(method); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.mail.util.FuseMailHook.java
public void deleteEmailAddress(long companyId, long userId) { try {/* w ww .j a v a2 s .c om*/ User user = UserLocalServiceUtil.getUserById(userId); String mailUserId = getMailUserId(companyId, userId); PostMethod method = getPostMethod(); method.addParameter("request", "removealias"); method.addParameter("user", mailUserId); method.addParameter("alias", user.getEmailAddress()); executeMethod(method); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.mail.util.FuseMailHook.java
public void updateEmailAddress(long companyId, long userId, String emailAddress) { try {/*w w w . j ava 2 s . co m*/ deleteEmailAddress(companyId, userId); String mailUserId = getMailUserId(companyId, userId); PostMethod method = getPostMethod(); method.addParameter("request", "modify"); method.addParameter("user", mailUserId); method.addParameter("alias[0]", emailAddress); executeMethod(method); } catch (Exception e) { _log.error(e, e); } }
From source file:com.groupon.jenkins.dotci.notifiers.HipchatNotifier.java
@Override public boolean notify(DynamicBuild build, BuildListener listener) { List rooms = getRooms();//from w w w .j a v a2s.co m listener.getLogger().println("sending hipchat notifications"); for (Object roomId : rooms) { HttpClient client = getHttpClient(); String url = "https://api.hipchat.com/v1/rooms/message?auth_token=" + getHipchatConfig().getToken(); PostMethod post = new PostMethod(url); String urlMsg = " (<a href='" + build.getFullUrl() + "'>Open</a>)"; try { post.addParameter("from", "CI"); post.addParameter("room_id", roomId.toString()); post.addParameter("message", getNotificationMessage(build, listener) + " " + urlMsg); post.addParameter("color", getColor(build, listener)); post.addParameter("notify", shouldNotify(getColor(build, listener))); post.getParams().setContentCharset("UTF-8"); client.executeMethod(post); } catch (Exception e) { listener.getLogger() .print("Failed to send hipchat notifications. Check Jenkins logs for exceptions."); LOGGER.log(Level.WARNING, "Error posting to HipChat", e); } finally { post.releaseConnection(); } } return true; }
From source file:fr.msch.wissl.server.TServer.java
protected String addUser(String username, String password, String auth, String sessionId) throws IOException { HttpClient c = new HttpClient(); PostMethod m = new PostMethod(URL + "user/add"); m.addParameter("username", username); m.addParameter("password", password); m.addParameter("auth", auth); if (sessionId != null) { m.addRequestHeader("sessionId", sessionId); }/* w w w. j ava2s.c o m*/ c.executeMethod(m); String ret = m.getResponseBodyAsString(); return ret; }
From source file:com.liferay.mail.util.FuseMailHook.java
public void addUser(long companyId, long userId, String password, String firstName, String middleName, String lastName, String emailAddress) { try {// ww w . j a v a 2 s . c o m String mailUserId = getMailUserId(companyId, userId); PostMethod method = getPostMethod(); method.addParameter("request", "order"); method.addParameter("user", mailUserId); method.addParameter("password", password); method.addParameter("first_name", firstName); method.addParameter("last_name", lastName); method.addParameter("account_type", _ACCOUNT_TYPE); method.addParameter("group_parent", _GROUP_PARENT); method.addParameter("alias[0]", emailAddress); executeMethod(method); } catch (Exception e) { _log.error(e, e); } }
From source file:hk.hku.cecid.corvus.http.HttpSenderUnitTest.java
/** Test whether the HTTP sender able to send the HTTP header with POST parameter to our monitor successfully. */ public void testSendWithParameter() throws Exception { this.target = new HttpSender(this.testClassLogger, new KVPairData(0)) { public HttpMethod onCreateRequest() throws Exception { PostMethod method = new PostMethod("http://localhost:1999"); method.addParameter("testparamName", "testparamValue"); return method; }/* w w w . j av a 2s . co m*/ }; this.assertSend(); }
From source file:it.unibz.instasearch.ui.ReportErrorDialog.java
/** * @throws IOException //from w w w . j a v a 2 s. co m * @throws HttpException * */ private void reportError() throws HttpException, IOException { HttpClient httpClient = new HttpClient(); PostMethod postMethod = new PostMethod(InstaSearchPlugin.getErrorReportURL()); postMethod.addParameter("subj", message); postMethod.addParameter("attn", "Exception"); postMethod.addParameter("notes", getStatusContent(status)); postMethod.addParameter("visitor", "InstaSearch Plugin " + InstaSearchPlugin.getVersion()); httpClient.executeMethod(postMethod); postMethod.releaseConnection(); }