List of usage examples for java.lang String toString
public String toString()
From source file:org.owasp.webgoat.plugin.CrossSiteScriptingLesson6b.java
@RequestMapping(method = RequestMethod.POST) public @ResponseBody AttackResult completed(@RequestParam String userid_6b, HttpServletRequest request) throws IOException { if (userid_6b.toString().equals(getPassword())) { return trackProgress(AttackResult.success()); } else {/*from w w w . j a v a 2 s. c o m*/ return trackProgress(AttackResult.failed("You are close, try again")); } }
From source file:com.blackducksoftware.integration.hub.detect.util.executable.Executable.java
private List<String> createProcessBuilderArguments() { // ProcessBuilder can only be called with a List<java.lang.String> so do any needed conversion final List<String> processBuilderArguments = new ArrayList<>(); processBuilderArguments.add(executablePath.toString()); for (final String arg : executableArguments) { processBuilderArguments.add(arg.toString()); }//from w w w. j av a 2 s. co m return processBuilderArguments; }
From source file:org.ubicompforall.BusTUC.Queries.Browser.java
public static ArrayList<BusDeparture> specificRequestForStopServer(int k_RealTimeId) { int realTimeId = k_RealTimeId; String html_string = null; HttpGet m_get = new HttpGet(); ArrayList<BusDeparture> test = null; if (m_client == null) { m_client = new DefaultHttpClient(); }/*from w ww. jav a2 s . c om*/ if (httpF == null) { httpF = new HttpFormat(); } try { m_get.setURI(new URI("http://busstjener.idi.ntnu.no/MultiBRISserver/RealTime?bID=" + realTimeId + "&key=SoapMacTavish")); System.out.println("SENDING REQUEST " + realTimeId); HttpResponse m_response = m_client.execute(m_get); System.out.println("RESPONSE RECEIVED"); // Request html_string = httpF.requestServer(m_response); // Will fail if server is busy or down Log.v("html_string", "Returned html: " + html_string); test = parseRealTimeDataForStopServer(html_string.toString()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return test; }
From source file:com.opengsn.services.cloudmanager.messages.CloudManagerListener.java
@Override public void onMessage(Message msg) { String messageStr = new String(msg.getBody()); try {// w w w . j a v a 2 s . c o m logger.debug("Cloud Manager Get Request Message: " + messageStr.toString()); // TODO ResponseMessage ret = this.man.executeCommand( // ((ActionRequestMessage)engineMessage).getRequest() ); msg.getMessageProperties().getCorrelationId(); msg.getMessageProperties().getReplyTo(); // ret.setMessageID(engineMessage.getMessageID()); } catch (AmqpException e) { e.printStackTrace(); } }
From source file:com.opengsn.services.networkmanager.messages.NetworkManagerListener.java
@Override public void onMessage(Message msg) { String messageStr = new String(msg.getBody()); try {//from w w w . jav a 2 s .c o m logger.debug("Network Manager Get Request Message: " + messageStr.toString()); // TODO ResponseMessage ret = this.man.executeCommand( // ((ActionRequestMessage)engineMessage).getRequest() ); msg.getMessageProperties().getCorrelationId(); msg.getMessageProperties().getReplyTo(); // ret.setMessageID(engineMessage.getMessageID()); } catch (AmqpException e) { e.printStackTrace(); } }
From source file:com.opengsn.controller.manager.ControllerMessageListener.java
@Override public void onMessage(Message msg) { String messageStr = new String(msg.getBody()); try {/*from w ww .ja v a 2 s . c o m*/ logger.debug("Facility Manager Get Request Message: " + messageStr.toString()); // TODO ResponseMessage ret = this.man.executeCommand( // ((ActionRequestMessage)engineMessage).getRequest() ); msg.getMessageProperties().getCorrelationId(); msg.getMessageProperties().getReplyTo(); // ret.setMessageID(engineMessage.getMessageID()); } catch (AmqpException e) { e.printStackTrace(); } }
From source file:com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.java
/** * <p/>/*w w w .ja va 2 s. co m*/ * Sets a non-null, non-empty-string, UIComponent property to the * corresponding DOM Element * <p/> * * @param uiComponent the source of the attribute value * @param targetElement the DOM Element that will receive the * attribute * @param attrNameInComponent the property name in the UIComponent object * @param attrNameInDom the attribute name in the DOM Element */ public static void renderAttribute(UIComponent uiComponent, Element targetElement, String attrNameInComponent, String attrNameInDom) { Object attrValue = uiComponent.getAttributes().get(attrNameInComponent); if (attrValue != null && !attrValue.equals("")) { if (attrValue.toString().equalsIgnoreCase("true") || attrValue.toString().equalsIgnoreCase("false")) { boolean trueValue = new Boolean(attrValue.toString()).booleanValue(); if (!trueValue) { targetElement.removeAttribute(attrNameInDom.toString()); return; } } targetElement.setAttribute(attrNameInDom.toString(), attrValue.toString()); } }
From source file:eu.planets_project.tb.impl.serialization.ExperimentFileCache.java
/** * // w ww.j a v a 2 s. c om * @return * @throws IOException */ public File createTempFile() throws IOException { // Create a temporary file, and ensure it will get cleaned up on exit: String exname = UUID.randomUUID().toString(); File tmp = File.createTempFile(exname.toString(), expExt, cachedir); tmp.deleteOnExit(); log.info("Created temp file: " + tmp); return tmp; }
From source file:edu.jhu.cvrg.waveform.utility.WebServiceUtility.java
private static void extractParameter(Map<String, ?> map, OMFactory omFactory, OMNamespace omNamespace, OMElement omWebService) {/*w w w . ja v a2 s . c o m*/ for (String key : map.keySet()) { log.info(" ** WebServiceUtility.extractParameter key: " + key + " value:" + map.get(key)); if (map.get(key) != null) { if (key.endsWith("List") | key.endsWith("list") | map.get(key) instanceof Map) { OMElement omList = omFactory.createOMElement(key, omNamespace); @SuppressWarnings("unchecked") Map<String, Object> listMap = (Map<String, Object>) map.get(key); extractParameter(listMap, omFactory, omNamespace, omList); omWebService.addChild(omList); } else { addOMEChild(key.toString(), map.get(key).toString(), omWebService); } } } }
From source file:mupomat.utility.LongLatService.java
public void getLongitudeLatitude(String address) { try {//from w ww. j a va 2s . c o m StringBuilder urlBuilder = new StringBuilder(GEOCODE_REQUEST_URL); if (StringUtils.isNotBlank(address)) { urlBuilder.append("&address=").append(URLEncoder.encode(address, "UTF-8")); } final GetMethod getMethod = new GetMethod(urlBuilder.toString()); try { httpClient.executeMethod(getMethod); Reader reader = new InputStreamReader(getMethod.getResponseBodyAsStream(), getMethod.getResponseCharSet()); int data = reader.read(); char[] buffer = new char[1024]; Writer writer = new StringWriter(); while ((data = reader.read(buffer)) != -1) { writer.write(buffer, 0, data); } String result = writer.toString(); System.out.println(result.toString()); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader("<" + writer.toString().trim())); Document doc = db.parse(is); strLatitude = getXpathValue(doc, "//GeocodeResponse/result/geometry/location/lat/text()"); System.out.println("Latitude:" + strLatitude); strLongtitude = getXpathValue(doc, "//GeocodeResponse/result/geometry/location/lng/text()"); System.out.println("Longitude:" + strLongtitude); } finally { getMethod.releaseConnection(); } } catch (Exception e) { e.printStackTrace(); } }