本文整理汇总了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;未经允许,请勿转载。 |
请发表评论