List of usage examples for org.apache.commons.httpclient.methods PostMethod addParameter
public void addParameter(String paramString1, String paramString2) throws IllegalArgumentException
From source file:com.jaspersoft.jasperserver.war.common.HeartbeatCustomDSInfo.java
public void contributeToHttpCall(PostMethod post) { post.addParameter("customDSClass[]", getServiceClass() == null ? "" : getServiceClass()); post.addParameter("customDSCount[]", String.valueOf(getCount())); }
From source file:com.jaspersoft.jasperserver.war.common.HeartbeatDatabaseInfo.java
public void contributeToHttpCall(PostMethod post) { post.addParameter("repoDbName[]", getDatabaseName() == null ? "" : getDatabaseName()); post.addParameter("repoDbVersion[]", getDatabaseVersion() == null ? "" : getDatabaseVersion()); post.addParameter("repoDbCount[]", String.valueOf(getCount())); }
From source file:eu.europeana.sip.licensing.network.LicenseServiceImpl.java
@Override public License requestLicense(Answers answers) throws IOException { LOG.info(String.format("Sending request to server%n%s", answers.toXML())); PostMethod postMethod = new PostMethod(CC_ISSUE); postMethod.addParameter("answers", answers.toXML()); int result = httpClient.executeMethod(postMethod); XStream xStream = new XStream(new DomDriver()); // todo: do we need a domdriver? xStream.setClassLoader(CustomClassLoader.getInstance()); xStream.processAnnotations(License.class); LOG.info(String.format("Got response from server : %d %n%s", result, postMethod.getResponseBodyAsString())); return (License) xStream.fromXML(postMethod.getResponseBodyAsString()); }
From source file:com.autofrog.pandabot.client.PandoraBot.java
public PandorabotResult ask(String custId, String what) throws Exception { PostMethod post = new PostMethod(botAddr); post.addParameter("botid", botId); post.addParameter("custid", custId); post.addParameter("input", what); int rc = client.executeMethod(post); System.out.println(post.getResponseBodyAsString()); PandorabotResult result = (PandorabotResult) u.unmarshal(post.getResponseBodyAsStream()); return result; }
From source file:edu.umd.cs.eclipse.courseProjectManager.TurninProjectAction.java
static void addParameter(PostMethod post, String name, Properties properties) { String property = properties.getProperty(name); if (property != null) post.addParameter(name, property); }
From source file:net.sourceforge.jcctray.model.CCNet.java
protected void configureMethod(HttpMethod method, DashBoardProject project) { PostMethod post = (PostMethod) method; post.addParameter("forcebuild", "true"); post.addParameter("forceBuildServer", "local"); post.addParameter("ForceBuild", "Force"); post.addParameter("forceBuildProject", project.getName()); }
From source file:eu.seaclouds.platform.planner.optimizerTest.discovererOutput.DiscovererOutputTest.java
@Test(enabled = false) public void testPresenceHeartbeat() { log.info("=== TEST for RETRIEVING DATA FROM DISCOVERER STARTED ==="); String url = null;//from w ww . j a va2 s . c o m HttpClient client = new HttpClient(); PostMethod method = new PostMethod(url); method.addParameter("oid", "2775488370683472268"); executeAndCheck(client, method); log.info("=== TEST for RETRIEVING DATA FROM DISCOVERER FINISEHD ==="); }
From source file:es.carebear.rightmanagement.client.user.GetUserAttributes.java
public String[] getAttributes(String authName, String target) throws BadRequestException, InternalServerErrorException, IOException, UnauthorizedException, UnknownResponseException { PostMethod postMethod = new PostMethod(baseUri + "/client/users/" + target); postMethod.addParameter("authName", authName); int responseCode = httpClient.executeMethod(postMethod); System.err.println(responseCode); switch (responseCode) { case HttpStatus.SC_ACCEPTED: String response = XMLHelper.fromStreamToXML(postMethod.getResponseBodyAsStream()); AttributeContainer lc = XMLHelper.fromXML(response, AttributeContainer.class); return lc.toArray(); case HttpStatus.SC_BAD_REQUEST: throw new BadRequestException(); case HttpStatus.SC_UNAUTHORIZED: throw new UnauthorizedException(); default://from w ww . j av a 2 s . c o m throw new UnknownResponseException((new Integer(responseCode)).toString()); } }
From source file:es.carebear.rightmanagement.client.admin.DeleteUser.java
public void deleteUser(String userName, String authName) throws IOException, IllegalArgumentException, InternalServerErrorException, BadRequestException, UnauthorizedException, UnknownResponseException { PostMethod postMethod = new PostMethod(baseUri + "/client/users/delete/" + userName); postMethod.addParameter("authName", authName); int responseCode = httpClient.executeMethod(postMethod); switch (responseCode) { case HttpStatus.SC_OK: break;// www . j av a2 s. c om case HttpStatus.SC_INTERNAL_SERVER_ERROR: throw new InternalServerErrorException(); case HttpStatus.SC_UNAUTHORIZED: throw new UnauthorizedException(); case HttpStatus.SC_BAD_REQUEST: throw new BadRequestException(); default: throw new UnknownResponseException((new Integer(responseCode)).toString()); } }
From source file:es.carebear.rightmanagement.client.user.RegisterUser.java
public User register(String username, String password) throws BadRequestException, InternalServerErrorException, IOException, UnauthorizedException, UnknownResponseException { PostMethod postMethod = new PostMethod(baseUri + "/client/users/register/" + username); postMethod.addParameter("password", password); int responseCode = httpClient.executeMethod(postMethod); switch (responseCode) { case HttpStatus.SC_CREATED: String response = postMethod.getResponseBodyAsString(); return XMLHelper.fromXML(response, User.class); case HttpStatus.SC_BAD_REQUEST: throw new BadRequestException(); case HttpStatus.SC_INTERNAL_SERVER_ERROR: throw new InternalServerErrorException(); default://from w ww . j a v a 2s .c o m throw new UnknownResponseException((new Integer(responseCode)).toString()); } }