gpt4 book ai didi

org.netbeans.modules.web.common.api.WebUtils.urlToString()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 21:11:05 28 4
gpt4 key购买 nike

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

WebUtils.urlToString介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

@Override
public FileObject fromServer(int projectContext, URL serverURL) {
  String query = serverURL.getQuery();
  // #219339 - strip down query and/or fragment:
  serverURL = WebUtils.stringToUrl(WebUtils.urlToString(serverURL, true));
  if (serverURL == null) {
    return null;
  }
  init();
  if (projectRootURL == null || webDocumentRoot == null) {
    return null;
  }
  WebBrowser browser = getWebBrowser();
  if (browser != null) {
    serverURL = browser.fromBrowserURL(getWebProject(), serverURL);
  }
  String u = WebUtils.urlToString(serverURL);
  if (u.startsWith(projectRootURL)) {
    String name = u.substring(projectRootURL.length());
    if (name.isEmpty()) {
      // name is empty - try to map server URL to one of the welcome files:
      return getExistingWelcomeFile();
    } else {
      // use servlet mappings to map server URL to a project file:
      return convertServerURLToProjectFile(name, query);
    }
  }
  return null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

@Override
public FileObject fromServer(int projectContext, URL serverURL) {
  serverURL = WebUtils.stringToUrl(WebUtils.urlToString(serverURL, true));
  if (serverURL == null) {
    return null;
      return null;
    String u = WebUtils.urlToString(serverURL);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

@Override
public FileObject fromServer(int projectContext, URL serverURL) {
  // #219339 - strip down query and/or fragment:
  serverURL = WebUtils.stringToUrl(WebUtils.urlToString(serverURL, true));
  if (serverURL == null) {
    return null;
  }
  initProjectUrl();
  if (projectRootUrl == null) {
    return null;
  }
  FileObject webRoot = project.getWebRootDirectory();
  if (webRoot == null) {
    return null;
  }
  WebBrowser browser = getWebBrowser();
  if (browser != null) {
    serverURL = browser.fromBrowserURL(project, serverURL);
  }
  String url = CommandUtils.urlToString(serverURL, true);
  if (url.startsWith(projectRootUrl)) {
    return webRoot.getFileObject(url.substring(projectRootUrl.length()));
  }
  return null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

private void browseFile(BrowserSupport bs, FileObject fo, String fragment) {
    URL url;
    if (FileUtil.isParentOf(project.getSiteRootFolder(), fo)) {
      url = ServerURLMapping.toServer(project, fo);
      if (fragment.length() > 0) {
        url = WebUtils.stringToUrl(WebUtils.urlToString(url)+fragment);
      }
      bs.load(url, fo);
    } else {
      url = fo.toURL();
      WebBrowser wb = project.getProjectWebBrowser();
      WebBrowserFeatures features = new WebBrowserFeatures(false, false, false, false, false, false);
      wb.createNewBrowserPane(features).showURL(url);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

@Override
public void showURL(URL applicationRootURL, URL urlToOpenInBrowser, FileObject context) {
  projectRootURL = applicationRootURL == null ? null : WebUtils.urlToString(applicationRootURL);
  if (projectRootURL != null && !projectRootURL.contains(".") && !projectRootURL.endsWith("/")) {
    projectRootURL += "/";
  }
  if (project.getProjectDirectory().equals(context) && webProject != null) {
    // this is scenario of EAR project executing its Web Project; use
    // Web Project as context instead of EAR here:
    context = webProject.getProjectDirectory();
  }
  // let browser update URL if necessary:
  WebBrowser browser = getWebBrowser();
  if (browser != null) {
    urlToOpenInBrowser = browser.toBrowserURL(getWebProject(), context, urlToOpenInBrowser);
    browserUsageLogger.log(projectType, browser.getId(), browser.getBrowserFamily().name());
  } else {
    WebBrowser wb = BrowserUISupport.getDefaultBrowserChoice(true);
    browserUsageLogger.log(projectType, wb.getId(), wb.getBrowserFamily().name());
  }
  BrowserSupport bs = getBrowserSupport();
  if (bs != null) {
    bs.load(urlToOpenInBrowser, context);
  } else {
    HtmlBrowser.URLDisplayer.getDefault().showURL(urlToOpenInBrowser);
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com