j-calais라는 API에서 결과를 얻은 다음 웹 페이지에 결과를 넣어 클라이언트의 모든 코드를 작성하지만 컴파일이 제대로되지 않습니다. 왜 몰라? 도와주세요. 다음과 같은 소스 코드 :GWT 클라이언트가 "throws Exception"문제를 일으키는 원인이 됨
이 명백한 오류가 발생하지이지만, 덕분에 ..... 성공적으로 많은 컴파일 될 캔트 :
공공 무효는 onModuleLoad을() { // 주식 데이터에 대한 테이블을 만듭니다 . stocksFlexTable.setText (0, 0, "Type"); stocksFlexTable.setText (0, 1, "Name");
// Assemble Add Stock panel.
addPanel.add(newSymbolTextBox);
addPanel.add(addStockButton);
// Assemble Main panel.
mainPanel.add(stocksFlexTable);
mainPanel.add(addPanel);
mainPanel.add(lastUpdatedLabel);
// Associate the Main panel with the HTML host page.
RootPanel.get("stockList").add(mainPanel);
// Move cursor focus to the input box.
newSymbolTextBox.setFocus(true);
// 추가 버튼에서 마우스 이벤트를 수신합니다. addStockButton.addClickHandler (새 경우 clickHandler() { 공공 무효 온 클릭 (ClickEvent 이벤트)는 {
try {
addStock();
} catch (Exception e) {
e.printStackTrace();
}
}
});
// Listen for keyboard events in the input box.
newSymbolTextBox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if (event.getCharCode() == KeyCodes.KEY_ENTER) {
try {
addStock();
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
private void addStock() throws Exception {
final String url_s = newSymbolTextBox.getText().toUpperCase().trim();
newSymbolTextBox.setFocus(true);
newSymbolTextBox.setText("");
int row = stocksFlexTable.getRowCount();
CalaisClient client = new CalaisRestClient("ysw5rx69jkvdnzqf6sgjduqj");
System.out.print("read success...\n");
URL url = new URL(url_s);
CalaisResponse response = client.analyze(url);
for (CalaisObject entity : response.getEntities()) {
System.out.println(entity.getField("_type") + ":"
+ entity.getField("name"));
stocks.add(entity.getField("_type"));
stocksFlexTable.setText(row, 0, entity.getField("_type"));
stocksFlexTable.setText(row, 1, entity.getField("name"));
}
for (CalaisObject topic : response.getTopics()) {
System.out.println(topic.getField("categoryName"));
}
}
}
가 발생하지 않습니다. –