nyla.solutions.global.net.http.HttpText Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nyla.solutions.global Show documentation
Show all versions of nyla.solutions.global Show documentation
Nyla Solutions Global Java API provides support for basic application
utilities (application configuration, data encryption, debugger and text
processing).
The newest version!
package nyla.solutions.global.net.http;
import java.util.HashMap;
import java.util.Map;
import nyla.solutions.global.data.Textable;
import nyla.solutions.global.exception.SystemException;
import nyla.solutions.global.util.Config;
import nyla.solutions.global.util.Debugger;
/**
* Text implementation to retrieve HTTP text results
* @author Gregory Green
*
*/
public class HttpText implements Textable
{
/**
* The text results from an HTML GET or POST
*/
public String getText()
{
try
{
HTTP http = new HttpUnit();
if("POST".equalsIgnoreCase(method))
{
return http.post(this.url, parameters).toString();
}
else
{
return http.get(url, parameters).toString();
//return http.get(url);
}
}
catch (Exception e)
{
throw new SystemException(Debugger.stackTrace(e));
}
}//---------------------------------------------
/**
* @return the url
*/
public String getUrl()
{
return url;
}
/**
* @param url the url to set
*/
public void setUrl(String url)
{
this.url = url;
}
/**
* @return the parameters
*/
public Map