| | |
| | | * @param out
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "convertLink", method = RequestMethod.POST)
|
| | | public void convertLink(String url, PrintWriter out) throws Exception {
|
| | | @RequestMapping(value = "convertLink")
|
| | | public void convertLink(String callback, String url, PrintWriter out) {
|
| | |
|
| | | String shortLink = org.yeshi.utils.HttpUtil.getShortLink(url);
|
| | | if (StringUtil.isNullOrEmpty(url)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("转链数据不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | String shortLink = org.yeshi.utils.HttpUtil.getShortLink(url);
|
| | |
|
| | | JSONObject jsonData = new JSONObject();
|
| | | jsonData.put("url", url);
|
| | | jsonData.put("shortLink", shortLink);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(jsonData));
|
| | |
|
| | | JSONObject jsonData = new JSONObject();
|
| | | jsonData.put("url", url);
|
| | | jsonData.put("shortLink", shortLink);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonData));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("转换失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|