本文整理匯總了Java中com.mashape.unirest.http.exceptions.UnirestException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java UnirestException.printStackTrace方法的具體用法?Java UnirestException.printStackTrace怎麽用?Java UnirestException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.mashape.unirest.http.exceptions.UnirestException
的用法示例。
在下文中一共展示了UnirestException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mediaBookSubmit
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
@PostMapping("/result_book")
public String mediaBookSubmit(@ModelAttribute Media media, Model model, HttpServletRequest request ) {
//System.out.println(media.getISBN());
LinkedList<BookInfo> a = null;
String maxResult= media.getMaxResult();
if (maxResult.equals("")) maxResult="10";
if (media.getTitle().trim().equals("") && media.getISBN().trim().equals("")) return "media_book";
else if (media.getTitle().equals("") && media.getISBN().length()!=13) return "media_book";
try {
a = APIOperations.bookGetInfo(media.getTitle().trim(), media.getISBN().trim(), maxResult, media.getOrderBy());
} catch (UnirestException e) {
e.printStackTrace();
return String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR);
}
RabbitSend.sendMediaRequest(media.getTitle(),"Book",request);
if (a.size()==0) return "no_result";
model.addAttribute("mediaList", a);
return "result_book";
}
示例2: mediaGameSubmit
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
@PostMapping("/result_game")
public String mediaGameSubmit(@ModelAttribute Media media, Model model, HttpServletRequest request ) {
LinkedList<GameInfo> a = null;
String maxResult= media.getMaxResult();
if(media.getTitle().equals("")) return "media_game";
if (maxResult.equals("")) maxResult="10";
try {
a = APIOperations.gameGetInfo(media.getTitle(),maxResult,media.getOrderBy());
} catch (UnirestException e) {
e.printStackTrace();
return String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR);
}
RabbitSend.sendMediaRequest(media.getTitle(),"Game",request);
if (a.size()==0) return "no_result";
model.addAttribute("mediaList", a);
return "result_game";
}
示例3: deleteTransform
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONObject deleteTransform(int transformID) {
JSONObject transform = new JSONObject();
try {
transform =
Unirest.delete(MessageFormat.format("http://{0}:{1}/deployment/{2}/model/{3}", host, port, deploymentID, transformID))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.asJson()
.getBody().getObject();
} catch (UnirestException e) {
e.printStackTrace();
}
return transform;
}
示例4: mediaFilmSubmit
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
@PostMapping("/result_film")
public String mediaFilmSubmit(@ModelAttribute Media media, Model model, HttpServletRequest request ) {
LinkedList<FilmInfo> a = null;
String maxResult= media.getMaxResult();
if(media.getTitle().equals("")) return "media_film";
if (maxResult.equals("")) maxResult="10";
String languagecode=media.getLanguage();
if (languagecode.length()!=2) languagecode="";
try {
a = APIOperations.filmGetInfo(media.getTitle(), maxResult,languagecode,media.getYear(),media.getOrderBy());
} catch (UnirestException e) {
e.printStackTrace();
return String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR);
}
RabbitSend.sendMediaRequest(media.getTitle(),"Film",request);
if (a.size()==0) return "no_result";
model.addAttribute("mediaList", a);
return "result_film";
}
示例5: getModelFromRemote
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
private Model getModelFromRemote(String graphQlQuery) {
ObjectMapper mapper = new ObjectMapper();
ObjectNode bodyParam = mapper.createObjectNode();
// bodyParam.set("operationName", null);
// bodyParam.set("variables", null);
bodyParam.put("query", graphQlQuery);
Model model = ModelFactory.createDefaultModel();
try {
HttpResponse<InputStream> response = Unirest.post(url)
.header("Accept", "application/rdf+xml")
.body(bodyParam.toString())
.asBinary();
model.read(response.getBody(), "RDF/XML");
} catch (UnirestException e) {
e.printStackTrace();
}
return model;
}
示例6: setKNNState
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONObject setKNNState(int knnID, String state) {
JSONObject knn = new JSONObject();
try {
knn =
Unirest.delete(MessageFormat.format("http://{0}:{1}/deployment/{2}/model/{3}/state", host, port, deploymentID, knnID))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.body(new JSONObject()
.put("name", state)
.toString())
.asJson()
.getBody().getObject();
} catch (UnirestException e) {
e.printStackTrace();
}
return knn;
}
示例7: deleteModel
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONObject deleteModel(int modelID) {
JSONObject model = new JSONObject();
try {
model =
Unirest.delete(MessageFormat.format("http://{0}:{1}/deployment/{2}/model/{3}", host, port, deploymentID, modelID))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.asJson()
.getBody().getObject();
} catch (UnirestException e) {
e.printStackTrace();
}
return model;
}
示例8: triggerJob
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
private synchronized void triggerJob() {
try {
logger.log(Level.INFO,"Starting Jenkins job: " + JOB_NAME);
String result = null;
switch(getJobType()) {
case Parametrized:
result = Unirest.post(JENKINS_URL + "/job/" + JOB_NAME + "/build").basicAuth(USER, API_TOKEN)
.field("json", getJSON())
.asBinary().getStatusText();
break;
case Normal:
result = Unirest.post(JENKINS_URL + "/job/" + JOB_NAME + "/build").basicAuth(USER, API_TOKEN)
.asBinary().getStatusText();
break;
}
logger.log(Level.INFO,"Done. Job '" + JOB_NAME + "' status: " + result);
} catch (UnirestException e) {
e.printStackTrace();
}
}
示例9: setTransformState
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONObject setTransformState(int transformID, String state) {
JSONObject transform = new JSONObject();
try {
transform =
Unirest.delete(MessageFormat.format("http://{0}:{1}/deployment/{2}/model/{3}/state", host, port, deploymentID, transformID))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.body(new JSONObject()
.put("name", state)
.toString())
.asJson()
.getBody().getObject();
} catch (UnirestException e) {
e.printStackTrace();
}
return transform;
}
示例10: getDeploymentById
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONObject getDeploymentById(int id) {
JSONObject deployment = new JSONObject();
try {
deployment =
Unirest.get(MessageFormat.format("http://{0}:{1}/deployment/{2}", host, port, id))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.asJson()
.getBody().getObject();
} catch (UnirestException e) {
e.printStackTrace();
}
return deployment;
}
示例11: addTransform
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONObject addTransform(String name, String fileLocation, int scale, String uri) {
JSONObject transform = new JSONObject();
try {
List<String> uriList = new ArrayList<String>();
uriList.add(uri);
transform =
Unirest.post(MessageFormat.format("http://{0}:{1}/deployment/{2}/model", host, port, deploymentID))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.body(new JSONObject()
.put("name", name)
.put("modelType", "transform")
.put("fileLocation", fileLocation)
.put("scale", scale)
.put("uri", uriList)
.toString())
.asJson()
.getBody().getObject();
} catch (UnirestException e) {
e.printStackTrace();
}
return transform;
}
示例12: getModelsForDeployment
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONArray getModelsForDeployment(int id) {
JSONArray allModelsOfDeployment = new JSONArray();
try {
allModelsOfDeployment =
Unirest.get(MessageFormat.format("http://{0}:{1}/deployment/{2}/models", host, port, id))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.asJson()
.getBody().getArray();
} catch (UnirestException e) {
e.printStackTrace();
}
return allModelsOfDeployment;
}
示例13: finish
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
@Override
public void finish() {
String title = (String) super.getResponses().get(0);
if(title.length() > 400) {
super.sendMessage("Error: Title length cannot be greater than 400 characters");
super.exit();
}
boolean multi = (boolean) super.getResponses().get(1);
String[] options = super.getResponses().subList(2, super.getResponses().size())
.toArray(new String[super.getResponses().size() - 2]);
if(options.length < 2 || options.length > 30) {
super.sendMessage("Error: You must have between 2 and 30 options (inclusive)");
super.exit();
}
StrawpollObject poll = new StrawpollObject(title, multi, options);
try {
super.sendMessage("http://www.strawpoll.me/" + poll.createPoll());
} catch (UnirestException e) {
super.sendMessage("Sorry, something went wrong creating your Strawpoll - Might be over my limits!");
e.printStackTrace();
}
super.exit();
}
示例14: addKNN
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public JSONObject addKNN(String name, String fileLocation, int scale, String uri) {
JSONObject knn = new JSONObject();
try {
List<String> uriList = new ArrayList<String>();
uriList.add(uri);
knn =
Unirest.post(MessageFormat.format("http://{0}:{1}/deployment/{2}/model", host, port, deploymentID))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.body(new JSONObject()
.put("name", name)
.put("modelType", "knn")
.put("fileLocation", fileLocation)
.put("scale", scale)
.put("uri", uriList)
.toString())
.asJson()
.getBody().getObject();
} catch (UnirestException e) {
e.printStackTrace();
}
return knn;
}
示例15: updateGraphTest
import com.mashape.unirest.http.exceptions.UnirestException; //導入方法依賴的package包/類
public static void updateGraphTest() {
//System.out.println(jsonObj.toString());
try {
HttpResponse<JsonNode> response = Unirest.post(url + "?operation=updateGraph")
.header("content-type", "application/json")
.header("cache-control", "no-cache")
.body("{\"an\":{\"520248\":{\"id\":520248,\"label\":\"artist\"}}}")
.asJson();
System.out.println(response.getBody());
} catch(UnirestException e) {
e.printStackTrace();
}
}