com.jfinal.core.JFinal.getContextPath()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(238)

本文整理了Java中com.jfinal.core.JFinal.getContextPath()方法的一些代码示例,展示了JFinal.getContextPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFinal.getContextPath()方法的具体详情如下:
包路径:com.jfinal.core.JFinal
类名称:JFinal
方法名:getContextPath

JFinal.getContextPath介绍

暂无

代码示例

代码示例来源:origin: jfinal/jfinal

static String getContxtPath() {
  String cp = JFinal.me().getContextPath();
  return ("".equals(cp) || "/".equals(cp)) ? null : cp;
}

代码示例来源:origin: JpressProjects/jpress

public String getUrl() {
  return JFinal.me().getContextPath() + url;
}

代码示例来源:origin: JpressProjects/jpress

@Override
public String getAvatar() {
  String avatar = super.getAvatar();
  if (avatar != null && avatar.toLowerCase().startsWith("http")) {
    return avatar;
  }
  return JFinal.me().getContextPath() +
      (StrUtils.isNotBlank(avatar) ? avatar : DEFAULT_AVATAR);
}

代码示例来源:origin: JpressProjects/jpress

public String getDetailUrl() {
  return JFinal.me().getContextPath() + "/admin/user/detail/" + getId();
}

代码示例来源:origin: JpressProjects/jpress

@Override
protected String getUrl(int pageNumber) {
  HttpServletRequest request = JbootRequestContext.getRequest();
  String url = request.getRequestURI();
  String contextPath = JFinal.me().getContextPath();
  if (pageNumber == 1 && firstGotoIndex) {
    return contextPath + "/";
  }
  // 如果当前页面是首页的话
  // 需要改变url的值,因为 上一页或下一页是通过当前的url解析出来的
  if (url.equals(contextPath + "/")) {
    url = contextPath + "/article/category/index"
        + JPressOptions.getAppUrlSuffix();
  }
  return Kits.doReplacePageNumber(url, pageNumber);
}

代码示例来源:origin: JpressProjects/jpress

public String getUrl() {
  switch (getType()) {
    case TYPE_CATEGORY:
      return JFinal.me().getContextPath() + "/article/category/" + getSlug() + JPressOptions.getAppUrlSuffix();
    case TYPE_TAG:
      return JFinal.me().getContextPath() + "/article/tag/" + getSlug() + JPressOptions.getAppUrlSuffix();
  }
  return "";
}

代码示例来源:origin: JpressProjects/jpress

public String getUrl() {
  if (StrUtils.isBlank(getSlug())) {
    return JFinal.me().getContextPath() + "/" + getId() + JPressOptions.getAppUrlSuffix();
  } else {
    return JFinal.me().getContextPath() + "/" + getSlug() + JPressOptions.getAppUrlSuffix();
  }
}

代码示例来源:origin: JpressProjects/jpress

public String getUrl() {
  String link = getLinkTo();
  if (StrUtils.isNotBlank(link)) {
    return link;
  }
  if (StrUtils.isBlank(getSlug())) {
    return JFinal.me().getContextPath() + "/article/" + getId() + JPressOptions.getAppUrlSuffix();
  } else {
    return JFinal.me().getContextPath() + "/article/" + getSlug() + JPressOptions.getAppUrlSuffix();
  }
}

代码示例来源:origin: JpressProjects/jpress

public void index() {
  String gotoUrl = getPara("goto");
  String uid = EncryptCookieUtils.get(this, JPressConsts.COOKIE_UID);
  //说明当前用户已经登录
  if (StrUtils.isNotBlank(uid)) {
    redirect(StrUtils.urlDecode(gotoUrl));
    return;
  }
  String appId = JPressOptions.get(JPressConsts.OPTION_WECHAT_APPID);
  if (StrUtils.isBlank(appId)) {
    renderText("管理员的微信APPID配置错误,请联系管理在后台 -> 微信 -> 基础设置 配置正确的APPID。");
    return;
  }
  String domain = JPressOptions.get(JPressConsts.OPTION_WEB_DOMAIN);
  if (StrUtils.isBlank(domain)) {
    domain = getRequest().getScheme() + "://" + getRequest().getServerName();
  }
  if (StrUtils.isNotBlank(JFinal.me().getContextPath())) {
    domain = domain + JFinal.me().getContextPath();
  }
  //这个url是微信执行完毕之后跳转回来的url
  //也是下方的这个 action
  String redirecturi = domain + "/wechat/authorization/back?goto=" + gotoUrl;
  String wechatUrl = AUTHORIZE_URL.replace("{appid}", appId).replace("{redirecturi}", redirecturi);
  redirect(wechatUrl);
}

代码示例来源:origin: JpressProjects/jpress

map.put("fileName", attachment.getTitle());
  map.put("uploaded", 1);
  map.put("url", JFinal.me().getContextPath() + attachment.getPath());
  renderJson(map);
} else {

代码示例来源:origin: com.jfinal/jfinal

static String getContxtPath() {
  String cp = JFinal.me().getContextPath();
  return ("".equals(cp) || "/".equals(cp)) ? null : cp;
}

代码示例来源:origin: com.github.sogyf/goja-jfinal

static String getContxtPath() {
  String cp = JFinal.me().getContextPath();
  return ("".equals(cp) || "/".equals(cp)) ? null : cp;
}

代码示例来源:origin: 94fzb/zrlog

private void insertFirstArticle(Connection connect) throws SQLException {
  String insetLog = "INSERT INTO `log`(`logId`,`canComment`,`keywords`,`alias`,`typeId`,`userId`,`title`,`content`,`plain_content`,`markdown`,`digest`,`releaseTime`,`last_update_date`,`rubbish`,`privacy`) VALUES (1,?,?,?,1,1,?,?,?,?,?,?,?,?,?)";
  PreparedStatement ps = connect.prepareStatement(insetLog);
  ps.setBoolean(1, true);
  String markdown = IOUtil.getStringInputStream(InstallService.class.getResourceAsStream("/init-blog/" + I18nUtil.getCurrentLocale() + ".md"));
  markdown = markdown.replace("${basePath}", JFinal.me().getContextPath());
  String content = renderMd(markdown);
  ps.setString(2, I18nUtil.getStringFromRes("defaultType"));
  ps.setString(3, "hello-world");
  ps.setString(4, I18nUtil.getStringFromRes("helloWorld"));
  ps.setString(5, content);
  ps.setString(6, new ArticleService().getPlainSearchText(content));
  ps.setString(7, markdown);
  ps.setString(8, ParseUtil.autoDigest(content, Constants.getAutoDigestLength()));
  ps.setObject(9, new java.util.Date());
  ps.setObject(10, new java.util.Date());
  ps.setBoolean(11, false);
  ps.setBoolean(12, false);
  ps.executeUpdate();
  ps.close();
}

代码示例来源:origin: 94fzb/zrlog

thumbnailFile = new File(PathKit.getWebRootPath() + path);
} else {
  bytes = IOUtil.getByteByInputStream(new FileInputStream(PathKit.getWebRootPath() + url.replace(JFinal.me().getContextPath(), "")));
  path = url.substring(0, url.indexOf('.')) + "_thumbnail" + url.substring(path.indexOf('.'));
  thumbnailFile = new File(PathKit.getWebRootPath() + path);
    return url;
  return new UploadService().getCloudUrl(JFinal.me().getContextPath(), path, thumbnailFile.getPath(), null).getUrl() + "?h=" + height + "&w=" + width;

相关文章