当前位置: 首页>>代码示例>>Java>>正文


Java BuiltInServerOptions类代码示例

本文整理汇总了Java中org.jetbrains.builtInWebServer.BuiltInServerOptions的典型用法代码示例。如果您正苦于以下问题:Java BuiltInServerOptions类的具体用法?Java BuiltInServerOptions怎么用?Java BuiltInServerOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BuiltInServerOptions类属于org.jetbrains.builtInWebServer包,在下文中一共展示了BuiltInServerOptions类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOAuthRedirectUrl

import org.jetbrains.builtInWebServer.BuiltInServerOptions; //导入依赖的package包/类
@NotNull
public static String getOAuthRedirectUrl() {
  int port = BuiltInServerManager.getInstance().getPort();

  // according to https://confluence.jetbrains.com/display/IDEADEV/Remote+communication
  int defaultPort = BuiltInServerOptions.getInstance().builtInServerPort;
  if (port >= defaultPort && port < (defaultPort + 20)) {
    return "http://localhost:" + port + "/api/" + EduStepicNames.OAUTH_SERVICE_NAME;
  }

  return EduStepicNames.EXTERNAL_REDIRECT_URL;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:13,代码来源:EduStepicConnector.java

示例2: isOnBuiltInWebServerByAuthority

import org.jetbrains.builtInWebServer.BuiltInServerOptions; //导入依赖的package包/类
public static boolean isOnBuiltInWebServerByAuthority(@Nonnull String authority) {
  int portIndex = authority.indexOf(':');
  if (portIndex < 0 || portIndex == authority.length() - 1) {
    return false;
  }

  int port = StringUtil.parseInt(authority.substring(portIndex + 1), -1);
  if (port == -1) {
    return false;
  }

  BuiltInServerOptions options = BuiltInServerOptions.getInstance();
  int idePort = BuiltInServerManager.getInstance().getPort();
  if (options.builtInServerPort != port && idePort != port) {
    return false;
  }

  String host = authority.substring(0, portIndex);
  if (NetUtils.isLocalhost(host)) {
    return true;
  }

  try {
    InetAddress inetAddress = InetAddress.getByName(host);
    return inetAddress.isLoopbackAddress() ||
           inetAddress.isAnyLocalAddress() ||
           (options.builtInServerAvailableExternally && idePort != port && NetworkInterface.getByInetAddress(inetAddress) != null);
  }
  catch (IOException e) {
    return false;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:33,代码来源:BuiltInServerManagerImpl.java

示例3: getExternalDocInfoForElement

import org.jetbrains.builtInWebServer.BuiltInServerOptions; //导入依赖的package包/类
@Override
@Nullable
 public String getExternalDocInfoForElement(@NotNull String docURL, final PsiElement element) throws Exception {
  String externalDoc = null;
  myElement = element;
  String builtInServer = "http://localhost:" + BuiltInServerOptions.getInstance().getEffectiveBuiltInServerPort() + "/" + myProject.getName() + "/";
  if (docURL.startsWith(builtInServer)) {
    int refPosition = docURL.lastIndexOf('#');
    VirtualFile file = WebServerPathToFileManager.getInstance(myProject).findVirtualFile(
      docURL.substring(builtInServer.length(), refPosition < builtInServer.length() ? docURL.length() : refPosition)
    );
    if (file != null) {
      InputStreamReader reader = new InputStreamReader(file.getInputStream(), CharsetToolkit.UTF8_CHARSET);
      StringBuilder result = new StringBuilder();
      try {
        doBuildFromStream(docURL, reader, result);
      }
      finally {
        reader.close();
      }

      externalDoc = correctDocText(docURL, result);
    }
  }

  if (externalDoc == null) {
    externalDoc = super.getExternalDocInfoForElement(docURL, element);
  }

  if (externalDoc == null) {
    return null;
  }

  if (element instanceof PsiMethod) {
    final String className = ApplicationManager.getApplication().runReadAction(
      new NullableComputable<String>() {
        @Override
        @Nullable
        public String compute() {
          PsiClass aClass = ((PsiMethod)element).getContainingClass();
          return aClass == null ? null : aClass.getQualifiedName();
        }
      }
    );
    Matcher matcher = ourMethodHeading.matcher(externalDoc);
    StringBuilder buffer = new StringBuilder("<h3>");
    DocumentationManager.createHyperlink(buffer, className, className, false);
    return matcher.replaceFirst(buffer.append("</h3>").toString());
  }
  return externalDoc;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:JavaDocExternalFilter.java


注:本文中的org.jetbrains.builtInWebServer.BuiltInServerOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。