List of usage examples for org.apache.commons.httpclient NameValuePair setValue
public void setValue(String value)
From source file:mesquite.tol.lib.BaseHttpRequestMaker.java
public static boolean postToServer(String s, String URI, StringBuffer response) { HttpClient client = new HttpClient(); PostMethod method = new PostMethod(URI); method.addParameter("OS", StringEscapeUtils .escapeHtml(System.getProperty("os.name") + "\t" + System.getProperty("os.version"))); method.addParameter("JVM", StringEscapeUtils .escapeHtml(System.getProperty("java.version") + "\t" + System.getProperty("java.vendor"))); NameValuePair post = new NameValuePair(); post.setName("post"); post.setValue(StringEscapeUtils.escapeHtml(s)); method.addParameter(post);// w w w. j a v a 2s. com method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); return executeMethod(client, method, response); }
From source file:net.sourceforge.jwbf.actions.mw.util.PostModifyContent.java
/** * /*from w w w .j a v a 2s. c om*/ * @param a the * @param tab internal value set * @param login a */ public PostModifyContent(final ContentAccessable a, final Hashtable<String, String> tab, LoginData login) { String uS = ""; try { uS = "/index.php?title=" + URLEncoder.encode(a.getLabel(), MediaWikiBot.CHARSET) + "&action=submit"; } catch (UnsupportedEncodingException e) { e.printStackTrace(); } NameValuePair action = new NameValuePair("wpSave", "Save"); NameValuePair wpStarttime = new NameValuePair("wpStarttime", tab.get("wpStarttime")); NameValuePair wpEditToken = new NameValuePair("wpEditToken", tab.get("wpEditToken")); NameValuePair wpEdittime = new NameValuePair("wpEdittime", tab.get("wpEdittime")); NameValuePair wpTextbox = new NameValuePair("wpTextbox1", a.getText()); String editSummaryText = a.getEditSummary(); if (editSummaryText != null && editSummaryText.length() > 200) { editSummaryText = editSummaryText.substring(0, 200); } NameValuePair wpSummary = new NameValuePair("wpSummary", editSummaryText); NameValuePair wpMinoredit = new NameValuePair(); if (a.isMinorEdit()) { wpMinoredit.setValue("1"); wpMinoredit.setName("wpMinoredit"); } LOG.info("WRITE: " + a.getLabel()); PostMethod pm = new PostMethod(uS); pm.getParams().setContentCharset(MediaWikiBot.CHARSET); pm.setRequestBody(new NameValuePair[] { action, wpStarttime, wpEditToken, wpEdittime, wpTextbox, wpSummary, wpMinoredit }); msgs.add(pm); }
From source file:com.griddynamics.jagger.coordinator.http.client.ExchangeClient.java
private String exchangeData(String url, Serializable obj) throws IOException { PostMethod method = new PostMethod(urlBase + url); NameValuePair pair = new NameValuePair(); pair.setName(MESSAGE);/*from ww w . ja v a2 s. c o m*/ pair.setValue(SerializationUtils.toString(obj)); method.setQueryString(new NameValuePair[] { pair }); try { int returnCode = httpClient.executeMethod(method); log.debug("Exchange response code {}", returnCode); return method.getResponseBodyAsString(); } finally { try { method.releaseConnection(); } catch (Throwable e) { log.error("Cannot release connection", e); } } }
From source file:com.funambol.json.dao.JsonDAOImpl.java
public JsonResponse removeAllItems(String token, long since) throws HttpException, IOException { String request = Utility.getUrl(jsonServerUrl, resourceType, REMOVE_ITEM_URL); if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: start removeAllItems"); }//from www.j a va2 s.c o m DeleteMethod remove = new DeleteMethod(request); if (since != 0) { NameValuePair nvp_since = new NameValuePair(); nvp_since.setName("since"); nvp_since.setValue("" + since); NameValuePair[] nvp = { nvp_since }; remove.setQueryString(nvp); } if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: removeAllItem request:" + request); } remove.setRequestHeader(Utility.TOKEN_HEADER_NAME, token); int statusCode = 0; String responseBody = null; try { statusCode = httpClient.executeMethod(remove); responseBody = remove.getResponseBodyAsString(); } finally { remove.releaseConnection(); } if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: deleteAllItem response " + responseBody); } JsonResponse response = new JsonResponse(statusCode, responseBody); return response; }
From source file:com.funambol.json.dao.JsonDAOImpl.java
public JsonResponse removeItem(String token, String id, long since) throws HttpException, IOException { String request = Utility.getUrl(jsonServerUrl, resourceType, REMOVE_ITEM_URL) + Utility.URL_SEP + id; if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: start removeItem with id:" + id + "and since=" + since); }//from ww w.j a v a 2s . c o m DeleteMethod remove = new DeleteMethod(request); if (since != 0) { NameValuePair nvp_since = new NameValuePair(); nvp_since.setName("since"); nvp_since.setValue("" + since); NameValuePair[] nvp = { nvp_since }; remove.setQueryString(nvp); } if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: removeItem request:" + request); } remove.setRequestHeader(Utility.TOKEN_HEADER_NAME, token); int statusCode = 0; String responseBody = null; try { statusCode = httpClient.executeMethod(remove); responseBody = remove.getResponseBodyAsString(); } finally { remove.releaseConnection(); } if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: deleteItem response " + responseBody); log.trace("JsonDAOImpl: item with id:" + id + " removed"); } JsonResponse response = new JsonResponse(statusCode, responseBody); return response; }
From source file:com.funambol.json.dao.JsonDAOImpl.java
public JsonResponse addItem(String token, String jsonObject, long since) throws HttpException, IOException { String request = Utility.getUrl(jsonServerUrl, resourceType, ADD_ITEM_URL); if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: start addItem; since=" + since); }/*from ww w .j ava 2 s . com*/ PostMethod post = new PostMethod(request); post.setRequestHeader(Utility.TOKEN_HEADER_NAME, token); post.setRequestEntity(new StringRequestEntity(jsonObject)); if (since != 0) { NameValuePair nvp_since = new NameValuePair(); nvp_since.setName("since"); nvp_since.setValue("" + since); NameValuePair[] nvp = { nvp_since }; post.setQueryString(nvp); } if (log.isTraceEnabled()) { log.trace("addItem Request: " + request); } if (Configuration.getConfiguration().isDebugMode()) { if (log.isTraceEnabled()) { log.trace("JSON to add " + jsonObject); } } int statusCode = 0; String responseBody = null; try { statusCode = httpClient.executeMethod(post); responseBody = post.getResponseBodyAsString(); } finally { post.releaseConnection(); } if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: statusCode " + statusCode + "; added item" + responseBody); log.trace("JsonDAOImpl: item added"); } JsonResponse response = new JsonResponse(statusCode, responseBody); return response; }
From source file:com.funambol.json.dao.JsonDAOImpl.java
public JsonResponse updateItem(String token, String id, String jsonObject, long since) throws HttpException, IOException { String request = Utility.getUrl(jsonServerUrl, resourceType, UPDATE_ITEM_URL) + Utility.URL_SEP + id; if (log.isTraceEnabled()) { log.trace(//from ww w . j a v a 2 s . c o m "JsonDAOImpl: start updateItem with id:" + id + " and since=" + since + " sessionid:" + token); } PutMethod put = new PutMethod(request); put.setRequestHeader(Utility.TOKEN_HEADER_NAME, token); put.setRequestEntity(new StringRequestEntity(jsonObject)); if (since != 0) { NameValuePair nvp_since = new NameValuePair(); nvp_since.setName("since"); nvp_since.setValue("" + since); NameValuePair[] nvp = { nvp_since }; put.setQueryString(nvp); } if (log.isTraceEnabled()) { log.trace("updateItem Request: " + request); } if (Configuration.getConfiguration().isDebugMode()) { if (log.isTraceEnabled()) { log.trace("JSON to update " + jsonObject); } } int statusCode = 0; String responseBody = null; try { statusCode = httpClient.executeMethod(put); responseBody = put.getResponseBodyAsString(); } finally { put.releaseConnection(); } if (log.isTraceEnabled()) { log.trace("JsonDAOImpl: item with id:" + id + " updated; response " + responseBody); } JsonResponse response = new JsonResponse(statusCode, responseBody); return response; }
From source file:com.funambol.json.api.dao.FunambolJSONApiDAO.java
/** * *//*from ww w. ja va2 s . c o m*/ protected String sendGetRequest(String REQUEST, long since, long until) throws IOOperationException { String response = null; GetMethod method = null; try { if (log.isTraceEnabled()) { log.trace("\nREQUEST:" + REQUEST); } method = new GetMethod(REQUEST); HttpClient httpClient = new HttpClient(); if (since != 0 && until != 0) { NameValuePair nvp_since = new NameValuePair(); nvp_since.setName("since"); nvp_since.setValue("" + since); NameValuePair nvp_until = new NameValuePair(); nvp_until.setName("until"); nvp_until.setValue("" + until); NameValuePair[] nvp = { nvp_since, nvp_until }; method.setQueryString(nvp); } if (this.sessionid != null) { method.setRequestHeader("Authorization", this.sessionid); } printMethodParams(method); printHeaderFields(method.getRequestHeaders(), "REQUEST"); int code = httpClient.executeMethod(method); response = method.getResponseBodyAsString(); if (log.isTraceEnabled()) { log.trace("RESPONSE code: " + code); } printHeaderFields(method.getResponseHeaders(), "RESPONSE"); } catch (Exception e) { throw new IOOperationException("Error GET Request ", e); } finally { if (method != null) { method.releaseConnection(); } } return response; }
From source file:org.apache.wookie.proxy.ProxyClient.java
/** * Processes the parameters passed through to the request, * removing the parameters used by the proxy itself * @return/*from w ww . j av a 2 s . c o m*/ */ private void filterParameters(Map<Object, Object> umap) { Map<Object, Object> map = new HashMap<Object, Object>(umap); map.remove("instanceid_key"); map.remove("url"); ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); for (Object key : map.keySet().toArray()) { for (String value : (String[]) map.get(key)) { NameValuePair param = new NameValuePair(); param.setName((String) key); param.setValue(value); params.add(param); } } parameters = params.toArray(new NameValuePair[params.size()]); }
From source file:org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient.java
private NameValuePair[] getPairsForExisting(TaskData model, IProgressMonitor monitor) throws CoreException { boolean groupSecurityEnabled = false; Map<String, NameValuePair> fields = new HashMap<String, NameValuePair>(); fields.put(KEY_FORM_NAME, new NameValuePair(KEY_FORM_NAME, VAL_PROCESS_BUG)); // go through all of the attributes and add them to the bug post Collection<TaskAttribute> attributes = model.getRoot().getAttributes().values(); Iterator<TaskAttribute> itr = attributes.iterator(); boolean tokenFound = false; boolean tokenRequired = false; BugzillaVersion bugzillaVersion = null; if (repositoryConfiguration != null) { bugzillaVersion = repositoryConfiguration.getInstallVersion(); } else {/* w ww.j av a 2s .c o m*/ bugzillaVersion = BugzillaVersion.MIN_VERSION; } while (itr.hasNext()) { TaskAttribute a = itr.next(); if (a == null) { continue; } else { String id = a.getId(); if (id.equalsIgnoreCase(BugzillaAttribute.TOKEN.getKey())) { tokenFound = true; } else if (id.equals(BugzillaAttribute.QA_CONTACT.getKey()) || id.equals(BugzillaAttribute.ASSIGNED_TO.getKey())) { cleanIfShortLogin(a); } else if (id.equals(BugzillaAttribute.REPORTER.getKey()) || id.equals(BugzillaAttribute.CC.getKey()) || id.equals(BugzillaAttribute.REMOVECC.getKey()) || id.equals(BugzillaAttribute.CREATION_TS.getKey()) || id.equals(BugzillaAttribute.BUG_STATUS.getKey()) || id.equals(BugzillaAttribute.VOTES.getKey())) { continue; } else if (id.equals(BugzillaAttribute.NEW_COMMENT.getKey())) { if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_2_18) == 0) { a.setValue(formatTextToLineWrap(a.getValue(), true)); } } else if (id.equals(BugzillaAttribute.GROUP.getKey()) && a.getValue().length() > 0) { groupSecurityEnabled = true; } if (a.getMetaData().getType() != null && a.getMetaData().getType().equals(TaskAttribute.TYPE_MULTI_SELECT)) { List<String> values = a.getValues(); int i = 0; for (String string : values) { fields.put(id + i++, new NameValuePair(id, string != null ? string : "")); //$NON-NLS-1$ } } else if (id != null && id.compareTo("") != 0) { //$NON-NLS-1$ String value = a.getValue(); if (id.equals(BugzillaAttribute.DELTA_TS.getKey())) { if (bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_4_7) < 0 || (bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_5) >= 0) && bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_6) < 0) { value = stripTimeZone(value); } } if (id.startsWith(BugzillaAttribute.KIND_FLAG_TYPE) && repositoryConfiguration != null) { List<BugzillaFlag> flags = repositoryConfiguration.getFlags(); TaskAttribute requestee = a.getAttribute("requestee"); //$NON-NLS-1$ a = a.getAttribute("state"); //$NON-NLS-1$ value = a.getValue(); if (value.equals(" ") || value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ continue; } String flagname = a.getMetaData().getLabel(); BugzillaFlag theFlag = null; for (BugzillaFlag bugzillaFlag : flags) { if (flagname.equals(bugzillaFlag.getName()) && bugzillaFlag.getType().equals("bug")) { //$NON-NLS-1$ theFlag = bugzillaFlag; break; } } if (theFlag != null) { int flagTypeNumber = theFlag.getFlagId(); id = "flag_type-" + flagTypeNumber; //$NON-NLS-1$ value = a.getValue(); if (value.equals("?") && requestee != null) { //$NON-NLS-1$ fields.put("requestee_type-" + flagTypeNumber, new NameValuePair("requestee_type-" //$NON-NLS-1$ //$NON-NLS-2$ + flagTypeNumber, requestee.getValue() != null ? requestee.getValue() : "")); //$NON-NLS-1$ } } } else if (id.startsWith(BugzillaAttribute.KIND_FLAG)) { TaskAttribute flagnumber = a.getAttribute("number"); //$NON-NLS-1$ TaskAttribute requestee = a.getAttribute("requestee"); //$NON-NLS-1$ a = a.getAttribute("state"); //$NON-NLS-1$ id = "flag-" + flagnumber.getValue(); //$NON-NLS-1$ value = a.getValue(); if (value.equals(" ") || value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ value = "X"; //$NON-NLS-1$ } if (value.equals("?") && requestee != null) { //$NON-NLS-1$ fields.put("requestee-" + flagnumber.getValue(), new NameValuePair("requestee-" //$NON-NLS-1$//$NON-NLS-2$ + flagnumber.getValue(), requestee.getValue() != null ? requestee.getValue() : "")); //$NON-NLS-1$ } } else if (id.startsWith(TaskAttribute.PREFIX_COMMENT)) { String valueID = a.getValue(); TaskAttribute definedIsPrivate = a .getAttribute(IBugzillaConstants.BUGZILLA_PREFIX_DEFINED_ISPRIVATE + valueID); TaskAttribute isPrivate = a .getAttribute(IBugzillaConstants.BUGZILLA_PREFIX_ISPRIVATE + valueID); if (definedIsPrivate != null && isPrivate != null) { fields.put(definedIsPrivate.getId(), new NameValuePair(definedIsPrivate.getId(), definedIsPrivate.getValue() != null ? definedIsPrivate.getValue() : "")); //$NON-NLS-1$ fields.put(isPrivate.getId(), new NameValuePair(isPrivate.getId(), isPrivate.getValue() != null ? isPrivate.getValue() : "")); //$NON-NLS-1$ } // Don't post comments ("task.common.comment-") continue; } else if (id.compareTo(BugzillaAttribute.LONG_DESC.getKey()) == 0) { TaskAttribute idAttribute = a.getAttribute("id"); //$NON-NLS-1$ if (idAttribute != null) { String valueID = idAttribute.getValue(); TaskAttribute definedIsPrivate = a .getAttribute(IBugzillaConstants.BUGZILLA_PREFIX_DEFINED_ISPRIVATE + valueID); TaskAttribute isPrivate = a .getAttribute(IBugzillaConstants.BUGZILLA_PREFIX_ISPRIVATE + valueID); if (definedIsPrivate != null && isPrivate != null) { fields.put(definedIsPrivate.getId(), new NameValuePair(definedIsPrivate.getId(), definedIsPrivate.getValue() != null ? definedIsPrivate.getValue() : "")); //$NON-NLS-1$ fields.put(isPrivate.getId(), new NameValuePair(isPrivate.getId(), isPrivate.getValue() != null ? isPrivate.getValue() : "")); //$NON-NLS-1$ } } } else if (id.startsWith("task.common.")) { //$NON-NLS-1$ // Don't post any remaining non-bugzilla specific attributes continue; } if (id.equals(BugzillaAttribute.DELTA_TS.getKey())) { value = BugzillaUtil.removeTimezone(value); } fields.put(id, new NameValuePair(id, value != null ? value : "")); //$NON-NLS-1$ } } } // when posting the bug id is encoded in a hidden field named 'id' TaskAttribute attributeBugId = model.getRoot().getAttribute(BugzillaAttribute.BUG_ID.getKey()); if (attributeBugId != null) { fields.put(KEY_ID, new NameValuePair(KEY_ID, attributeBugId.getValue())); } // add the operation to the bug post if (bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_2) < 0) { TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION); if (attributeOperation == null) { fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE)); } else { TaskAttribute originalOperation = model.getRoot() .getAttribute(TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue()); if (originalOperation == null) { // Work around for bug#241012 fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE)); } else { String inputAttributeId = originalOperation.getMetaData() .getValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID); if (inputAttributeId == null || inputAttributeId.equals("")) { //$NON-NLS-1$ String sel = attributeOperation.getValue(); fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, sel)); } else { fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, attributeOperation.getValue())); TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot() .getAttribute(inputAttributeId); if (inputAttribute != null) { if (inputAttribute.getOptions().size() > 0) { String sel = inputAttribute.getValue(); String knob = inputAttribute.getId(); if (knob.equals(BugzillaOperation.resolve.getInputId()) || knob.equals(BugzillaOperation.close_with_resolution.getInputId())) { knob = BugzillaAttribute.RESOLUTION.getKey(); } fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel))); } else { String sel = inputAttribute.getValue(); String knob = attributeOperation.getValue(); if (knob.equals(BugzillaOperation.reassign.toString())) { knob = BugzillaAttribute.ASSIGNED_TO.getKey(); } fields.put(knob, new NameValuePair(knob, sel)); } } } } if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) { fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue())); } else if (attributeOperation != null && attributeOperation.getValue().equals(BugzillaOperation.duplicate.toString())) { // fix for bug#198677 fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, "")); //$NON-NLS-1$ } } } else { // A token is required for bugzilla 3.2.1 and newer tokenRequired = bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_2) > 0; String fieldName = BugzillaAttribute.BUG_STATUS.getKey(); TaskAttribute attributeStatus = model.getRoot().getMappedAttribute(TaskAttribute.STATUS); TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION); if (attributeOperation == null) { fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue())); } else { TaskAttribute originalOperation = model.getRoot() .getAttribute(TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue()); if (originalOperation == null) { // Work around for bug#241012 fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue())); } else { String inputAttributeId = originalOperation.getMetaData() .getValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID); String selOp = attributeOperation.getValue().toUpperCase(); if (selOp.equals("NONE")) { //$NON-NLS-1$ selOp = attributeStatus.getValue(); } if (selOp.equals("ACCEPT")) { //$NON-NLS-1$ selOp = "ASSIGNED"; //$NON-NLS-1$ } if (selOp.equals("RESOLVE")) { //$NON-NLS-1$ selOp = "RESOLVED"; //$NON-NLS-1$ } if (selOp.equals("VERIFY")) { //$NON-NLS-1$ selOp = "VERIFIED"; //$NON-NLS-1$ } if (selOp.equals("CLOSE")) { //$NON-NLS-1$ selOp = "CLOSED"; //$NON-NLS-1$ } if (selOp.equals("REOPEN")) { //$NON-NLS-1$ selOp = "REOPENED"; //$NON-NLS-1$ } if (selOp.equals("MARKNEW")) { //$NON-NLS-1$ selOp = "NEW"; //$NON-NLS-1$ } if (selOp.equals("DUPLICATE")) { //$NON-NLS-1$ if (repositoryConfiguration != null) { selOp = repositoryConfiguration.getDuplicateStatus(); } else { selOp = "RESOLVED"; //$NON-NLS-1$ } String knob = BugzillaAttribute.RESOLUTION.getKey(); fields.put(knob, new NameValuePair(knob, "DUPLICATE")); //$NON-NLS-1$ } fields.put(fieldName, new NameValuePair(fieldName, selOp)); if (inputAttributeId != null && !inputAttributeId.equals("")) { //$NON-NLS-1$ TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot() .getAttribute(inputAttributeId); if (inputAttribute != null) { if (inputAttribute.getOptions().size() > 0) { String sel = inputAttribute.getValue(); String knob = inputAttribute.getId(); if (knob.equals(BugzillaOperation.resolve.getInputId())) { knob = BugzillaAttribute.RESOLUTION.getKey(); } fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel))); } else { String sel = inputAttribute.getValue(); String knob = attributeOperation.getValue(); if (knob.equals(BugzillaOperation.duplicate.toString())) { knob = inputAttributeId; } if (knob.equals(BugzillaOperation.reassign.toString())) { knob = BugzillaAttribute.ASSIGNED_TO.getKey(); } fields.put(knob, new NameValuePair(knob, sel)); } } } } } if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) { fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue())); } } if (model.getRoot().getMappedAttribute(BugzillaAttribute.SHORT_DESC.getKey()) != null) { fields.put(KEY_SHORT_DESC, new NameValuePair(KEY_SHORT_DESC, model.getRoot().getMappedAttribute(BugzillaAttribute.SHORT_DESC.getKey()).getValue())); } TaskAttribute attributeRemoveCC = model.getRoot().getMappedAttribute(BugzillaAttribute.REMOVECC.getKey()); if (attributeRemoveCC != null) { List<String> removeCC = attributeRemoveCC.getValues(); if (removeCC != null && removeCC.size() > 0) { String[] s = new String[removeCC.size()]; fields.put(KEY_CC, new NameValuePair(KEY_CC, toCommaSeparatedList(removeCC.toArray(s)))); fields.put(BugzillaAttribute.REMOVECC.getKey(), new NameValuePair(BugzillaAttribute.REMOVECC.getKey(), VAL_TRUE)); } } // check for security token (required for successful submit on Bugzilla 3.2.1 and greater but not in xml until Bugzilla 3.2.3 bug#263318) if (groupSecurityEnabled || (!tokenFound && tokenRequired)) { // get security and token if exists from html and include in post HtmlInformation htmlInfo = getHtmlOnlyInformation(model, monitor); if (groupSecurityEnabled) { for (String key : htmlInfo.getGroups().keySet()) { fields.put(key, new NameValuePair(key, htmlInfo.getGroups().get(key))); } } if (htmlInfo.getToken() != null && htmlInfo.getToken().length() > 0 && tokenRequired) { NameValuePair tokenPair = fields.get(BugzillaAttribute.TOKEN.getKey()); if (tokenPair != null) { tokenPair.setValue(htmlInfo.getToken()); } else { fields.put(BugzillaAttribute.TOKEN.getKey(), new NameValuePair(BugzillaAttribute.TOKEN.getKey(), htmlInfo.getToken())); } } } return fields.values().toArray(new NameValuePair[fields.size()]); }