org.kohsuke.stapler.StaplerRequest.getPathInfo()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(77)

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

StaplerRequest.getPathInfo介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

@Override
public boolean onGetterTrigger(Function f, StaplerRequest req, StaplerResponse rsp, Object node, String expression) {
  LOGGER.log(Level.WARNING, LOG_MESSAGE, new Object[]{
      req.getPathInfo(),
      f.getSignature()
  });
  return false;
}

代码示例来源:origin: jenkinsci/jenkins

@Override 
public boolean onDoActionTrigger(Function f, StaplerRequest req, StaplerResponse rsp, Object node) {
  LOGGER.log(Level.WARNING, LOG_MESSAGE, new Object[]{
      req.getPathInfo(),
      f.getSignature()
  });
  return false;
}

代码示例来源:origin: jenkinsci/jenkins

@Override
  public boolean onFieldTrigger(FieldRef f, StaplerRequest req, StaplerResponse staplerResponse, Object node, String expression) {
    LOGGER.log(Level.WARNING, LOG_MESSAGE, new Object[]{
        req.getPathInfo(),
        f.getSignature()
    });
    return false;
  }
}

代码示例来源:origin: jenkinsci/envinject-plugin

@SuppressWarnings("unused")
public void doExport(@Nonnull StaplerRequest request, @Nonnull StaplerResponse response) throws IOException {
  String path = request.getPathInfo();
  if (path != null) {
    doExportWithPath(path, request, response);
    return;
  }
  doExportHeaders(request, response);
}

代码示例来源:origin: com.marvelution.jira.plugins/jenkins-jira-plugin

public void doDynamic(StaplerRequest request, StaplerResponse response) throws Exception {
  if (hasPermission(Hudson.getInstance(), Hudson.ADMINISTER)) {
    String path = request.getPathInfo();
    Matcher matcher = PATTERN.matcher(path);
    LOGGER.info(path);

代码示例来源:origin: jenkinsci/tfs-plugin

void dispatch(final StaplerRequest request, final StaplerResponse rsp, final String body) {
  final String pathInfo = request.getPathInfo();
  final String eventName = pathInfoToEventName(pathInfo);
  try {
    final JSONObject response = innerDispatch(body, eventName, HOOK_EVENT_FACTORIES_BY_NAME);
    rsp.setStatus(SC_OK);
    rsp.setContentType(MediaType.APPLICATION_JSON_UTF_8);
    final PrintWriter w = rsp.getWriter();
    final String responseJsonString = response.toString();
    w.print(responseJsonString);
    w.println();
  }
  catch (final IllegalArgumentException e) {
    LOGGER.log(Level.WARNING, "IllegalArgumentException", e);
    EndpointHelper.error(SC_BAD_REQUEST, e);
  }
  catch (final Exception e) {
    final String template = "Error while performing reaction to '%s' event.";
    final String message = String.format(template, eventName);
    LOGGER.log(Level.SEVERE, message, e);
    EndpointHelper.error(SC_INTERNAL_SERVER_ERROR, e);
  }
}

代码示例来源:origin: jenkinsci/tfs-plugin

private JSONObject innerDispatch(final StaplerRequest req, final StaplerResponse rsp, final TimeDuration delay) throws IOException, ServletException {
  commandName = null;
  jobName = null;
  final String pathInfo = req.getPathInfo();
  if (!decodeCommandAndJobNames(pathInfo)) {
    if (commandName == null) {
      throw new IllegalArgumentException("Command not provided");
    }
    if (jobName == null) {
      throw new IllegalArgumentException("Job name not provided after command");
    }
  }
  if (!COMMAND_FACTORIES_BY_NAME.containsKey(commandName)) {
    throw new IllegalArgumentException("Command not implemented");
  }
  final Job job = getJob(jobName, req);
  final ParameterizedJobMixIn.ParameterizedJob jobMixin = (ParameterizedJobMixIn.ParameterizedJob) job;
  checkPermission(job, jobMixin, req, rsp);
  final TimeDuration actualDelay =
      delay == null ? new TimeDuration(jobMixin.getQuietPeriod()) : delay;
  final AbstractCommand.Factory factory = COMMAND_FACTORIES_BY_NAME.get(commandName);
  final AbstractCommand command = factory.create();
  final JSONObject response;
  final JSONObject formData = req.getSubmittedForm();
  final ObjectMapper mapper = EndpointHelper.MAPPER;
  final TeamBuildPayload teamBuildPayload = mapper.convertValue(formData, TeamBuildPayload.class);
  final BuildableItem buildable = (BuildableItem) job;
  response = command.perform(job, buildable, req, formData, mapper, teamBuildPayload, actualDelay);
  return response;
}

代码示例来源:origin: com.marvelution.jira.plugins/jenkins-jira-plugin

public void doDynamic(StaplerRequest request, StaplerResponse response) throws Exception {
  ApplicationLinkStore store = ApplicationLinkStore.getStore();
  String pathInfo = request.getPathInfo();
  String rest = pathInfo.substring(pathInfo.indexOf(ACTION) + ACTION.length());
  String appId = StringUtils.stripEnd(StringUtils.stripStart(rest, "/"), "/");
  if (hasPermission(Hudson.getInstance(), Hudson.ADMINISTER)) {
    if ("PUT".equals(request.getMethod())) {
      try {
        ApplicationLink applicationLink = XStreamUtils.getEntityFromRequest(request.getInputStream(),
            ApplicationLink.class);
        LOGGER.info("Adding Application Link [" + appId + "] to " + applicationLink.getName() + " at " +
            applicationLink.getRpcUrl());
        store.add(appId, applicationLink);
        response.setStatus(HttpServletResponse.SC_CREATED);
      } catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Failed to add ApplicationLink for " + appId, e);
        response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to add ApplicationLink for " + appId);
      }
    } else if ("DELETE".equals(request.getMethod())) {
      LOGGER.info("Deleting Application Link with ID " + appId);
      store.remove(appId);
      response.setStatus(HttpServletResponse.SC_OK);
    } else {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unsupported operation!");
    }
  } else {
    response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
  }
}

代码示例来源:origin: com.marvelution.jira.plugins/jenkins-jira-plugin

public void doDynamic(StaplerRequest request, StaplerResponse response) throws Exception {
  String pathInfo = StringUtils.stripEnd(request.getPathInfo(), "/");
  String jobName = pathInfo.substring(pathInfo.lastIndexOf("/") + 1);
  final String encoding = request.getCharacterEncoding();

相关文章

微信公众号

最新文章

更多

StaplerRequest类方法