• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WebUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onOpen

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
/**
 * This method will be invoked when an connection has been received and not haven't yet be suspended. Note that
 * the connection will be suspended AFTER the method has been invoked when used with {@link org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor}
 *
 * @param resource an {@link AtmosphereResource}
 * @throws IOException
 */
public void onOpen(AtmosphereResource resource) throws IOException {
    final SUser currentUser = SessionUser.getUser(resource.getRequest());
    if (currentUser == null) {
        LOG.error("Websocket Open request with unknown user. Request: " + WebUtil.getRequestDump(resource.getRequest()));
        return;
    }

    LOG.debug("WebSocket connection is opened by " + currentUser.getUsername() + ". Connection UUID: " + resource.uuid());

    // Store connection
    AtmosphereResourceSessionFactory.getDefault().getSession(resource).setAttribute(USER_ID, currentUser.getId());
    Queue<AtmosphereResource> resources = myResources.get(currentUser.getId());
    if (resources == null){
        resources = new ConcurrentLinkedQueue<AtmosphereResource>();
        myResources.put(currentUser.getId(), resources);
    }

    resources.add(resource);
    resource.suspend();
}
 
开发者ID:dtretyakov,项目名称:teamcity-tray-notifier,代码行数:28,代码来源:NotificationHandler.java


示例2: doHandle

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
@Override
protected ModelAndView doHandle(@NotNull final HttpServletRequest request,
                                @NotNull final HttpServletResponse response) throws Exception {


  String requestedResource = WebUtil.getPathFromUrl(WebUtil.getOriginalPathWithoutContext(request))
          .replace(pagesContentUrlBase, "");

  try {
    String requestedResourceBasePath = getResourceBaseFolder();
    File file = getRequestedFile(requestedResource, requestedResourceBasePath);
    boolean legal = isLegalPath(file, new File(requestedResourceBasePath));
    if (!legal) {
      throw new IllegalArgumentException("Requested resource doesn't exist under the resource base folder.");
    }
    response.setContentType(WebUtil.getMimeType(request, file.getName()));
    writeResourceContent(request, response, file);
  } catch (Exception e) {
    LOG.warn("Failed to retrieve file. Error: " + e.getMessage(), e);
    response.setContentType("text/plain");
    response.getWriter().write("ERROR: Content for Widgets plugin was not found. " +
            "Requested resource: " + requestedResource + ", error: " + e.getMessage());
  }
  return null;
}
 
开发者ID:JetBrains,项目名称:TeamCity.WidgetsPlugin,代码行数:26,代码来源:BasePageContentController.java


示例3: doHandle

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
@Override
protected ModelAndView doHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws Exception {
  String buildIdParam = request.getParameter("buildId");
  String path = request.getParameter("file");
  String torrentPath = path + TorrentUtil.TORRENT_FILE_SUFFIX;

  File torrentFile = null;
  long buildId = Long.parseLong(buildIdParam);
  SBuild build = myBuildsManager.findBuildInstanceById(buildId);
  if (build != null) {
    torrentFile = myTorrentsManager.getTorrentFile(build, torrentPath);
    if (!torrentFile.isFile()) {
      torrentFile = null;
    }
  }

  if (torrentFile == null) {
    response.sendError(HttpServletResponse.SC_NOT_FOUND);
  } else {
    response.setContentType(WebUtil.getMimeType(request, torrentFile.getName()));
    // force set content-disposition to attachment
    WebUtil.setContentDisposition(request, response, torrentFile.getName(), false);
    ServletOutputStream output = response.getOutputStream();
    FileInputStream fis = null;
    try {
      fis = new FileInputStream(torrentFile);
      StreamUtil.copyStreamContent(fis, output);
    } finally {
      FileUtil.close(fis);
      output.close();
    }
  }

  return null;
}
 
开发者ID:JetBrains,项目名称:teamcity-torrent-plugin,代码行数:36,代码来源:DownloadTorrentController.java


示例4: isAvailable

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
public boolean isAvailable(@NotNull HttpServletRequest request) {
  return "/profile.html".equals(WebUtil.getPathWithoutContext(request)) ||
      getPluginName().equals(request.getParameter("notificatorType"));
}
 
开发者ID:dancing-elf,项目名称:teamcity-telegram-plugin,代码行数:5,代码来源:UserTelegramSettingsExtension.java


示例5: fillModel

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
@Override
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
  super.fillModel(model, request);
  model.put("actualServerUrl", WebUtil.getRootUrl(request));
  model.put("appUrl", SymbolsConstants.APP_SYMBOLS);
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:7,代码来源:SymbolServerSettingsTab.java


示例6: isAvailable

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
@Override
public boolean isAvailable(@NotNull final HttpServletRequest request) {
  return super.isAvailable(request) && WebUtil.getPathWithoutContext(request).startsWith("/viewLog.html");
}
 
开发者ID:JetBrains,项目名称:build-chain-export,代码行数:5,代码来源:BuildResultsExtension.java


示例7: isAvailable

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
@Override
public boolean isAvailable(@NotNull final HttpServletRequest request) {
  return super.isAvailable(request) && WebUtil.getPathWithoutContext(request).startsWith("/viewType.html");
}
 
开发者ID:JetBrains,项目名称:build-chain-export,代码行数:5,代码来源:BuildTypeExtension.java


示例8: isAvailable

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
@Override
public boolean isAvailable(@NotNull HttpServletRequest request) {
  return "/profile.html".equals(WebUtil.getPathWithoutContext(request)) || getPluginName().equals(request.getParameter("notificatorType"));
}
 
开发者ID:JetBrains,项目名称:tc-vso-rooms,代码行数:5,代码来源:VSONotifierMySettingsPageExtension.java


示例9: isAvailable

import jetbrains.buildServer.web.util.WebUtil; //导入依赖的package包/类
@Override
public boolean isAvailable(@NotNull final HttpServletRequest request) {
    return WebUtil.getPathWithoutAuthenticationType(request).startsWith("/overview.html");
}
 
开发者ID:JetBrains,项目名称:teamcity-maven-archetypes,代码行数:5,代码来源:PageExtension.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PointMatch类代码示例发布时间:2022-05-23
下一篇:
Java ImageToAwt类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap