com.atlassian.sal.api.net.Request.setFiles()方法的使用及代码示例

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

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

Request.setFiles介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module

@Override
public JerseyRequest setFiles(List<RequestFilePart> files) {
  delegateRequest.setFiles(files);
  return this;
}

代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core

public ApplicationLinkRequest setFiles(List<RequestFilePart> files)
{
  return setDelegate(request.setFiles(files));
}

代码示例来源:origin: com.atlassian.applinks/applinks-common

public ApplicationLinkRequest setFiles(List<RequestFilePart> files) {
  return setDelegate(request.setFiles(files));
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

@Test(expected = NullPointerException.class)
public void testNullSetFiles() throws Exception {
  final Request<?, ?> request = requestFactory.createRequest(Request.MethodType.PUT, "http://localhost");
  request.setFiles(null);
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

public void testSetFilesReturnsItself() throws Exception {
  final List<RequestFilePart> fileParts = Collections.singletonList(new RequestFilePart(testFile, "testFile"));
  final Request<?, ?> request = requestFactory.createRequest(Request.MethodType.POST, "http://localhost");
  assertEquals(request, request.setFiles(fileParts));
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

@Test(expected = IllegalStateException.class)
public void testSetFilesWithGetRequest() throws Exception {
  final List<RequestFilePart> fileParts = Collections.singletonList(new RequestFilePart(testFile, "testFile"));
  final Request<?, ?> request = requestFactory.createRequest(Request.MethodType.GET, "http://localhost");
  request.setFiles(fileParts);
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

@Test(expected = IllegalStateException.class)
public void testSetFilesWithHeadRequest() throws Exception {
  final List<RequestFilePart> fileParts = Collections.singletonList(new RequestFilePart(testFile, "testFile"));
  final Request<?, ?> request = requestFactory.createRequest(Request.MethodType.HEAD, "http://localhost");
  request.setFiles(fileParts);
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

@Test(expected = IllegalStateException.class)
public void testSetFilesWithDeleteRequest() throws Exception {
  final List<RequestFilePart> fileParts = Collections.singletonList(new RequestFilePart(testFile, "testFile"));
  final Request<?, ?> request = requestFactory.createRequest(Request.MethodType.DELETE, "http://localhost");
  request.setFiles(fileParts);
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

@Test
public void testCanSendMultipartPostRequest() throws Exception {
  Server server = new Server(0);
  ServletHandler handler = new ServletHandler();
  handler.addServletWithMapping(SetFilesServlet.class, "/*");
  server.setHandler(handler);
  try {
    // start jetty.
    server.start();
    // now, make a request.
    Request<?, ?> request = requestFactory.createRequest(Request.MethodType.POST, "http://localhost:" + getActivePort(server));
    request.setFiles(Collections.singletonList(new RequestFilePart(testFile, "testFile")));
    request.execute(new ResponseHandler() {
      public void handle(final Response response) throws ResponseException {
        assertTrue(response.isSuccessful());
      }
    });
  } finally {
    server.stop();
  }
}

代码示例来源:origin: com.atlassian.refapp/platform-ctk-plugin

@Test
public void testCanSendMultipartPutRequest() throws Exception {
  Server server = new Server(0);
  ServletHandler handler = new ServletHandler();
  handler.addServletWithMapping(SetFilesServlet.class, "/*");
  server.setHandler(handler);
  try {
    // start jetty.
    server.start();
    // now, make a request.
    Request<?, ?> request = requestFactory.createRequest(Request.MethodType.PUT, "http://localhost:" + getActivePort(server));
    request.setFiles(Collections.singletonList(new RequestFilePart(testFile, "testFile")));
    request.execute(new ResponseHandler() {
      public void handle(final Response response) throws ResponseException {
        assertTrue(response.isSuccessful());
      }
    });
  } finally {
    server.stop();
  }
}

相关文章