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


Java StaplerResponse.sendError方法代码示例

本文整理汇总了Java中org.kohsuke.stapler.StaplerResponse.sendError方法的典型用法代码示例。如果您正苦于以下问题:Java StaplerResponse.sendError方法的具体用法?Java StaplerResponse.sendError怎么用?Java StaplerResponse.sendError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kohsuke.stapler.StaplerResponse的用法示例。


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

示例1: doSourceFile

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
 * Binds {@link SourceFile}s into URL.
 */
public void doSourceFile(StaplerRequest req, StaplerResponse rsp) throws IOException {
    String name = req.getRestOfPath().substring(1); // Remove leading /
    for (SourceFile sf : getSourceFiles())
        if (sf.name.equals(name)) {
            sf.doIndex(rsp);
            return;
        }
    rsp.sendError(rsp.SC_NOT_FOUND);
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:13,代码来源:UISample.java

示例2: doContainer

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
 * Gets a container {@link Fingerprint} page.
 * @param req Stapler request
 * @param rsp Stapler response
 * @param id Container ID. Method supports full 64-char IDs only.
 * @throws IOException Request processing error
 * @throws ServletException Servlet error
 */
public void doContainer(StaplerRequest req, StaplerResponse rsp, 
        @QueryParameter(required = true) String id) 
        throws IOException, ServletException {  
    checkPermission(Jenkins.READ);
    Jenkins j = Jenkins.getInstance();
    if (j == null) {
        rsp.sendError(500, "Jenkins is not ready");
        return;
    }
    
    String fingerPrintHash = DockerTraceabilityHelper.getContainerHash(id);
    rsp.sendRedirect2(j.getRootUrl()+"fingerprint/"+fingerPrintHash);
}
 
开发者ID:jenkinsci,项目名称:docker-traceability-plugin,代码行数:22,代码来源:DockerTraceabilityRootAction.java

示例3: doImage

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
 * Gets an image {@link Fingerprint} page.
 * @param req Stapler request
 * @param rsp Stapler response
 * @param id Image ID. Method supports full 64-char IDs only.
 * @throws IOException  Request processing error
 * @throws ServletException Servlet error
 */
public void doImage(StaplerRequest req, StaplerResponse rsp, 
        @QueryParameter(required = true) String id) 
        throws IOException, ServletException {  
    checkPermission(Jenkins.READ);
    Jenkins j = Jenkins.getInstance();
    if (j == null) {
        rsp.sendError(500, "Jenkins is not ready");
        return;
    }
    
    String fingerPrintHash = DockerTraceabilityHelper.getImageHash(id);
    rsp.sendRedirect2(j.getRootUrl()+"fingerprint/"+fingerPrintHash);
}
 
开发者ID:jenkinsci,项目名称:docker-traceability-plugin,代码行数:22,代码来源:DockerTraceabilityRootAction.java

示例4: doBrowse

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doBrowse(StaplerRequest request, StaplerResponse response) throws IOException
{
    String requestedPath = FauxPasUtils.pathByRemovingLeadingSlash(request.getRestOfPath());
    if (requestedPath == null)
        response.sendError(404);

    if (!APPROVED_REPORT_REQUEST_PATTERN.matcher(requestedPath).matches())
    {
        System.err.println("Someone is requesting unapproved content: " + requestedPath);
        response.sendError(404);
        return;
    }
    
    FilePath reportsPath = new FilePath(build.getRootDir());
    FilePath requestedFilePath = new FilePath(reportsPath, FauxPasUtils.pathByRemovingLeadingSlash(requestedPath));
    
    try
    {
        if (!requestedFilePath.exists())
        {
            System.err.println("Unable to locate report: " + request.getRestOfPath());
            response.sendError(404);
            return;
        }
        response.serveFile(request, requestedFilePath.toURI().toURL());
    }
    catch(Exception e)
    {
        System.err.println("FAILED TO SERVE FILE: " + request.getRestOfPath() + " -> " + e.getLocalizedMessage());
        response.sendError(500);
    }
}
 
开发者ID:FauxPasApp,项目名称:fauxpas-jenkins-plugin,代码行数:33,代码来源:FauxPasBuildAction.java

示例5: doLaunchSlaveAgent

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
@Override
public void doLaunchSlaveAgent(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    rsp.sendError(SC_NOT_FOUND);
}
 
开发者ID:jenkinsci,项目名称:deployer-framework-plugin,代码行数:5,代码来源:DeployNowComputer.java


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