org.apache.cxf.jaxrs.ext.multipart.MultipartBody Java Examples
The following examples show how to use
org.apache.cxf.jaxrs.ext.multipart.MultipartBody.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProxyServletTest.java From openwebbeans-meecrowave with Apache License 2.0 | 6 votes |
@Test public void upload() { withClient(target -> { final Response response = target.path("/upload1").request() .post(entity(new MultipartBody(asList( new Attachment("metadata", APPLICATION_JSON, "{\"content\":\"text\"}"), new Attachment( "file", Thread.currentThread().getContextClassLoader().getResourceAsStream("ProxyServletTest/upload/file.txt"), new ContentDisposition("uploadded.txt")) )), MULTIPART_FORM_DATA)); assertEquals(HttpURLConnection.HTTP_OK, response.getStatus()); final String actual = response.readEntity(String.class); assertTrue(actual, actual.contains("uuid:")); assertTrue(actual, actual.contains("Content-Type: application/json")); assertTrue(actual, actual.contains("{\"content\":\"text\"}")); assertTrue(actual, actual.contains("Content-Type: application/octet-stream")); assertTrue(actual, actual.contains("test\nfile\nwith\nmultiple\nlines")); }); }
Example #2
Source File: AttachmentUtils.java From cxf with Apache License 2.0 | 6 votes |
public static MultipartBody getMultipartBody(MessageContext mc, String attachmentDir, String attachmentThreshold, String attachmentMaxSize) { if (attachmentDir != null) { mc.put(AttachmentDeserializer.ATTACHMENT_DIRECTORY, attachmentDir); } if (attachmentThreshold != null) { mc.put(AttachmentDeserializer.ATTACHMENT_MEMORY_THRESHOLD, attachmentThreshold); } if (attachmentMaxSize != null) { mc.put(AttachmentDeserializer.ATTACHMENT_MAX_SIZE, attachmentMaxSize); } boolean embeddedAttachment = mc.get("org.apache.cxf.multipart.embedded") != null; String propertyName = embeddedAttachment ? MultipartBody.INBOUND_MESSAGE_ATTACHMENTS + ".embedded" : MultipartBody.INBOUND_MESSAGE_ATTACHMENTS; MultipartBody body = (MultipartBody)mc.get(propertyName); if (!embeddedAttachment && mc.get(IN_FILTERS) != null) { List<MultipartInputFilter> filters = CastUtils.cast((List<?>)mc.get(IN_FILTERS)); for (MultipartInputFilter filter : filters) { filter.filter(body.getAllAttachments()); } } return body; }
Example #3
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 6 votes |
@Test public void failUploadFileWithBadFileName() throws IOException, ArchivaRestServiceException { FileUploadService service = getUploadService(); try { Path file = getProjectDirectory().resolve("src/test/repositories/snapshot-repo/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-20130425.081822-1.jar"); final Attachment fileAttachment = new AttachmentBuilder().object(Files.newInputStream(file)).contentDisposition(new ContentDisposition("form-data; filename=\"/../TestFile.testext\"; name=\"files[]\"")).build(); MultipartBody body = new MultipartBody(fileAttachment); try { service.post(body); fail("FileNames with path contents should not be allowed."); } catch (ClientErrorException e) { assertEquals(422, e.getResponse().getStatus()); } } finally { service.clearUploadedFiles(); } }
Example #4
Source File: JAXRSMultipartTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testUploadImageFromForm2() throws Exception { File file = new File(getClass().getResource("/org/apache/cxf/systest/jaxrs/resources/java.jpg") .toURI().getPath()); String address = "http://localhost:" + PORT + "/bookstore/books/formimage2"; WebClient client = WebClient.create(address); client.type("multipart/form-data").accept("multipart/form-data"); WebClient.getConfig(client).getRequestContext().put("support.type.as.multipart", "true"); MultipartBody body2 = client.post(file, MultipartBody.class); InputStream is2 = body2.getRootAttachment().getDataHandler().getInputStream(); byte[] image1 = IOUtils.readBytesFromStream( getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/java.jpg")); byte[] image2 = IOUtils.readBytesFromStream(is2); assertArrayEquals(image1, image2); ContentDisposition cd2 = body2.getRootAttachment().getContentDisposition(); assertEquals("form-data;name=file;filename=java.jpg", cd2.toString()); assertEquals("java.jpg", cd2.getParameter("filename")); }
Example #5
Source File: JAXRSMultipartTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testUploadFileWithSemicolonName() throws Exception { String address = "http://localhost:" + PORT + "/bookstore/books/file/semicolon"; WebClient client = WebClient.create(address); client.type("multipart/form-data").accept("text/plain"); ContentDisposition cd = new ContentDisposition("attachment;name=\"a\";filename=\"a;txt\""); MultivaluedMap<String, String> headers = new MetadataMap<>(); headers.putSingle("Content-Disposition", cd.toString()); Attachment att = new Attachment(new ByteArrayInputStream("file name with semicolon".getBytes()), headers); MultipartBody body = new MultipartBody(att); String partContent = client.post(body, String.class); assertEquals("file name with semicolon, filename:" + "a;txt", partContent); }
Example #6
Source File: MultipartStore.java From cxf with Apache License 2.0 | 6 votes |
@POST @Path("/books/fileform") @Produces("text/xml") @Consumes("multipart/form-data") public Response addBookFilesForm(MultipartBody body) throws Exception { String owner = body.getAttachmentObject("owner", String.class); Book book = body.getAttachmentObject("file", Book.class); if (!"CXF in Action - 1".equals(book.getName()) || !"Larry".equals(owner)) { throw new WebApplicationException(); } book.setId(124); book.setName("CXF in Action - 2"); return Response.ok(book).build(); }
Example #7
Source File: MultipartStore.java From cxf with Apache License 2.0 | 6 votes |
@POST @Path("/books/jaxb-body") @Consumes("multipart/related;type=\"text/xml\"") @Produces("text/xml") public Response addBookParts2(MultipartBody body) throws Exception { Book b1 = body.getAttachmentObject("rootPart", Book.class); Book b2 = body.getAttachmentObject("book2", Book.class); if (b1.equals(b2)) { throw new WebApplicationException(); } if (!b1.getName().equals(b2.getName())) { throw new WebApplicationException(); } b1.setId(124); return Response.ok(b1).build(); }
Example #8
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 6 votes |
@Test public void saveFile() throws IOException, ArchivaRestServiceException { log.debug("Starting saveFile()"); Path path = Paths.get("target/appserver-base/repositories/internal/org/apache/archiva/archiva-model/1.2/archiva-model-1.2.jar"); log.debug("Jar exists: {}",Files.exists(path)); Files.deleteIfExists(path); path = Paths.get("target/appserver-base/repositories/internal/org/apache/archiva/archiva-model/1.2/archiva-model-1.2.pom"); Files.deleteIfExists(path); FileUploadService service = getUploadService(); service.clearUploadedFiles(); Path file = getProjectDirectory().resolve("src/test/repositories/snapshot-repo/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-20130425.081822-1.jar"); log.debug("Upload file exists: {}", Files.exists(file)); final Attachment fileAttachment = new AttachmentBuilder().object(Files.newInputStream(file)).contentDisposition(new ContentDisposition("form-data; filename=\"archiva-model.jar\"; name=\"files[]\"")).build(); MultipartBody body = new MultipartBody(fileAttachment); service.post(body); service.save("internal", "org.apache.archiva", "archiva-model", "1.2", "jar", true); }
Example #9
Source File: MultipartStore.java From cxf with Apache License 2.0 | 6 votes |
@POST @Path("/books/formimage") @Consumes("multipart/form-data") @Produces("multipart/form-data") public MultipartBody addBookFormImage(MultipartBody image) throws Exception { List<Attachment> atts = image.getAllAttachments(); if (atts.size() != 1) { throw new WebApplicationException(); } List<Attachment> newAtts = new ArrayList<>(); Attachment at = atts.get(0); MultivaluedMap<String, String> headers = at.getHeaders(); if (!"http://host/bar".equals(headers.getFirst("Content-Location"))) { throw new WebApplicationException(); } if (!"custom".equals(headers.getFirst("Custom-Header"))) { throw new WebApplicationException(); } headers.putSingle("Content-Location", "http://host/location"); newAtts.add(new Attachment(at.getContentId(), at.getDataHandler(), headers)); return new MultipartBody(newAtts); }
Example #10
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 6 votes |
@Test public void saveFileWithOtherExtension() throws IOException, ArchivaRestServiceException { log.debug("Starting saveFileWithOtherExtension()"); Path path = Paths.get("target/appserver-base/repositories/internal/org/apache/archiva/archiva-model/1.2/archiva-model-1.2.bin"); log.debug("Jar exists: {}",Files.exists(path)); Files.deleteIfExists(path); Path pomPath = Paths.get("target/appserver-base/repositories/internal/org/apache/archiva/archiva-model/1.2/archiva-model-1.2.pom"); Files.deleteIfExists(pomPath); FileUploadService service = getUploadService(); service.clearUploadedFiles(); Path file = getProjectDirectory().resolve("src/test/repositories/snapshot-repo/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-20130425.081822-1.jar"); log.debug("Upload file exists: {}", Files.exists(file)); final Attachment fileAttachment = new AttachmentBuilder().object(Files.newInputStream(file)).contentDisposition(new ContentDisposition("form-data; filename=\"archiva-model.bin\"; name=\"files[]\"")).build(); MultipartBody body = new MultipartBody(fileAttachment); service.post(body); assertTrue(service.save("internal", "org.apache.archiva", "archiva-model", "1.2", "bin", false)); assertTrue(Files.exists(path)); }
Example #11
Source File: BookCatalog.java From cxf with Apache License 2.0 | 6 votes |
@POST @Consumes("multipart/form-data") public Response addBook(final MultipartBody body) throws Exception { for (final Attachment attachment: body.getAllAttachments()) { final DataHandler handler = attachment.getDataHandler(); if (handler != null) { final String source = handler.getName(); final LuceneDocumentMetadata metadata = new LuceneDocumentMetadata() .withSource(source) .withField("modified", Date.class); final Document document = extractor.extract(handler.getInputStream(), metadata); if (document != null) { try (IndexWriter writer = getIndexWriter()) { writer.addDocument(document); writer.commit(); } } } } return Response.ok().build(); }
Example #12
Source File: ShowScheduler.java From iaf with Apache License 2.0 | 5 votes |
@POST @RolesAllowed({"IbisDataAdmin", "IbisAdmin", "IbisTester"}) @Path("/schedules") @Relation("schedules") @Produces(MediaType.APPLICATION_JSON) public Response createSchedule(MultipartBody input) throws ApiException { return createSchedule(null, input); }
Example #13
Source File: ShowScheduler.java From iaf with Apache License 2.0 | 5 votes |
@PUT @RolesAllowed({"IbisDataAdmin", "IbisAdmin", "IbisTester"}) @Path("/schedules/{groupName}/job/{jobName}") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response updateSchedule(@PathParam("groupName") String groupName, @PathParam("jobName") String jobName, MultipartBody input) throws ApiException { return createSchedule(groupName, jobName, input, true); }
Example #14
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 5 votes |
@Test public void failUploadAndDeleteFileInOtherDir() throws IOException, ArchivaRestServiceException { Path testFile = null; try { FileUploadService service = getUploadService(); Path file = getProjectDirectory().resolve("src/test/repositories/snapshot-repo/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-20130425.081822-1.jar"); Path targetDir = Paths.get("target/testDelete").toAbsolutePath(); if (!Files.exists(targetDir)) Files.createDirectories(targetDir); Path tempDir = SystemUtils.getJavaIoTmpDir().toPath(); testFile = Files.createTempFile(targetDir, "TestFile", ".txt"); log.debug("Test file {}", testFile.toAbsolutePath()); log.debug("Tmp dir {}", tempDir.toAbsolutePath()); assertTrue(Files.exists(testFile)); Path relativePath = tempDir.relativize(testFile.toAbsolutePath()); final Attachment fileAttachment = new AttachmentBuilder().object(Files.newInputStream(file)).contentDisposition(new ContentDisposition("form-data; filename=\"" + file.getFileName().toString() + "\"; name=\"files[]\"")).build(); MultipartBody body = new MultipartBody(fileAttachment); service.post(body); String relativePathEncoded = URLEncoder.encode("../target/" + relativePath.toString(), "UTF-8"); log.debug("Trying to delete with path traversal: {}, {}", relativePath, relativePathEncoded); try { service.deleteFile(relativePathEncoded); } catch (ArchivaRestServiceException ex) { // Expected exception } assertTrue("File in another directory may not be deleted", Files.exists(testFile)); } finally { if (testFile != null) { Files.deleteIfExists(testFile); } } }
Example #15
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 5 votes |
@Test public void failUploadAndDeleteWrongFile() throws IOException, ArchivaRestServiceException { FileUploadService service = getUploadService(); try { Path file = getProjectDirectory().resolve("src/test/repositories/snapshot-repo/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-20130425.081822-1.jar"); final Attachment fileAttachment = new AttachmentBuilder().object(Files.newInputStream(file)).contentDisposition(new ContentDisposition("form-data; filename=\"" + file.getFileName().toString() + "\"; name=\"files[]\"")).build(); MultipartBody body = new MultipartBody(fileAttachment); service.post(body); assertFalse(service.deleteFile("file123" + file.getFileName().toString())); } finally { service.clearUploadedFiles(); } }
Example #16
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 5 votes |
@Test public void uploadAndDeleteFile() throws IOException, ArchivaRestServiceException { FileUploadService service = getUploadService(); try { Path file = getProjectDirectory().resolve("src/test/repositories/snapshot-repo/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-20130425.081822-1.jar"); final Attachment fileAttachment = new AttachmentBuilder().object(Files.newInputStream(file)).contentDisposition(new ContentDisposition("form-data; filename=\"" + file.getFileName().toString() + "\"; name=\"files[]\"")).build(); MultipartBody body = new MultipartBody(fileAttachment); service.post(body); service.deleteFile(file.getFileName().toString()); } finally { service.clearUploadedFiles(); } }
Example #17
Source File: ShowScheduler.java From iaf with Apache License 2.0 | 5 votes |
@POST @RolesAllowed({"IbisDataAdmin", "IbisAdmin", "IbisTester"}) @Path("/schedules/{groupName}/job") @Relation("schedules") @Produces(MediaType.APPLICATION_JSON) public Response createScheduleInJobGroup(@PathParam("groupName") String groupName, MultipartBody input) throws ApiException { return createSchedule(groupName, input); }
Example #18
Source File: Base.java From iaf with Apache License 2.0 | 5 votes |
protected String resolveStringFromMap(MultipartBody inputDataMap, String key, String defaultValue) throws ApiException { String result = resolveTypeFromMap(inputDataMap, key, String.class, null); if(StringUtils.isEmpty(result)) { if(defaultValue != null) { return defaultValue; } throw new ApiException("Key ["+key+"] may not be empty"); } return result; }
Example #19
Source File: Base.java From iaf with Apache License 2.0 | 5 votes |
protected <T> T resolveTypeFromMap(MultipartBody inputDataMap, String key, Class<T> clazz, T defaultValue) throws ApiException { try { if(inputDataMap.getAttachment(key) != null) { return inputDataMap.getAttachment(key).getObject(clazz); } } catch (Exception e) { log.debug("Failed to parse parameter ["+key+"]", e); } if(defaultValue != null) { return defaultValue; } throw new ApiException("Key ["+key+"] not defined", 400); }
Example #20
Source File: Services.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@POST @Path("/$batch") @Consumes(MULTIPART_MIXED) @Produces(APPLICATION_OCTET_STREAM + ";boundary=" + BOUNDARY) public Response batch( @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer, final @Multipart MultipartBody attachment) { try { final boolean continueOnError = prefer.contains("odata.continue-on-error"); return xml.createBatchResponse( exploreMultipart(attachment.getAllAttachments(), BOUNDARY, continueOnError)); } catch (IOException e) { return xml.createFaultResponse(Accept.XML.toString(), e); } }
Example #21
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 5 votes |
@Test public void uploadFile() throws IOException, ArchivaRestServiceException { FileUploadService service = getUploadService(); try { Path file = getProjectDirectory().resolve("src/test/repositories/snapshot-repo/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-20130425.081822-1.jar"); final Attachment fileAttachment = new AttachmentBuilder().object(Files.newInputStream(file)).contentDisposition(new ContentDisposition("form-data; filename=\"" + file.getFileName().toString() + "\"; name=\"files[]\"")).build(); MultipartBody body = new MultipartBody(fileAttachment); service.post(body); } finally { service.clearUploadedFiles(); } }
Example #22
Source File: BookStore.java From cxf with Apache License 2.0 | 5 votes |
@Descriptions({ @Description(value = "Attachments, max < 10", target = DocTarget.PARAM) }) @POST @Consumes("multipart/form-data") public void formdata(MultipartBody body) { }
Example #23
Source File: AbstractJwsMultipartSignatureFilter.java From cxf with Apache License 2.0 | 5 votes |
protected List<Object> getAttachmentParts(Object rootEntity) { List<Object> parts = null; if (rootEntity instanceof MultipartBody) { parts = CastUtils.cast(((MultipartBody)rootEntity).getAllAttachments()); } else { parts = new ArrayList<>(); if (rootEntity instanceof List) { List<Object> entityList = CastUtils.cast((List<?>)rootEntity); parts.addAll(entityList); } else { parts.add(rootEntity); } } JwsHeaders headers = new JwsHeaders(); headers.setPayloadEncodingStatus(false); JwsSignatureProvider theSigProvider = sigProvider != null ? sigProvider : JwsUtils.loadSignatureProvider(headers, true); JwsSignature jwsSignature = theSigProvider.createJwsSignature(headers); String base64UrlEncodedHeaders = Base64UrlUtility.encode(writer.toJson(headers)); byte[] headerBytesWithDot = StringUtils.toBytesASCII(base64UrlEncodedHeaders + "."); jwsSignature.update(headerBytesWithDot, 0, headerBytesWithDot.length); AttachmentUtils.addMultipartOutFilter(new JwsMultipartSignatureOutFilter(jwsSignature)); JwsDetachedSignature jws = new JwsDetachedSignature(headers, base64UrlEncodedHeaders, jwsSignature, useJwsJsonSignatureFormat); Attachment jwsPart = new Attachment("signature", JoseConstants.MEDIA_TYPE_JOSE, jws); parts.add(jwsPart); return parts; }
Example #24
Source File: FormEncodingProvider.java From cxf with Apache License 2.0 | 5 votes |
/** * Retrieve map of parameters from the passed in message */ protected void populateMap(MultivaluedMap<String, String> params, Annotation[] anns, InputStream is, MediaType mt, boolean decode) { if (mt.isCompatible(MediaType.MULTIPART_FORM_DATA_TYPE)) { MultipartBody body = AttachmentUtils.getMultipartBody(mc, attachmentDir, attachmentThreshold, attachmentMaxSize); FormUtils.populateMapFromMultipart(params, body, PhaseInterceptorChain.getCurrentMessage(), decode); } else { String enc = HttpUtils.getEncoding(mt, StandardCharsets.UTF_8.name()); Object servletRequest = mc != null ? mc.getHttpServletRequest() : null; if (servletRequest == null) { FormUtils.populateMapFromString(params, PhaseInterceptorChain.getCurrentMessage(), FormUtils.readBody(is, enc), enc, decode); } else { FormUtils.populateMapFromString(params, PhaseInterceptorChain.getCurrentMessage(), FormUtils.readBody(is, enc), enc, decode, (javax.servlet.http.HttpServletRequest)servletRequest); } } }
Example #25
Source File: RestRequestForDiagramViewer.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
/** * 部署流程 * * @throws IOException */ private static void deployLeave() { WebClient client = createClient("repository/deployments"); InputStream resourceAsStream = RestRequestTandem.class.getClassLoader().getResourceAsStream("diagrams/leave.bpmn"); client.type("multipart/form-data"); ContentDisposition cd = new ContentDisposition("form-data;name=bpmn;filename=leave.bpmn;"); Attachment att = new Attachment("leave.bpmn", resourceAsStream, cd); MultipartBody body = new MultipartBody(att); Response response = client.post(body); // 转换并输出响应结果 printResult("部署流程", response); }
Example #26
Source File: RestRequestTandem.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
/** * 部署流程 * * @throws IOException */ private static void deployLeave() { WebClient client = createClient("repository/deployments"); InputStream resourceAsStream = RestRequestTandem.class.getClassLoader().getResourceAsStream("diagrams/leave.bpmn"); client.type("multipart/form-data"); ContentDisposition cd = new ContentDisposition("form-data;name=bpmn;filename=leave.bpmn;"); Attachment att = new Attachment("leave.bpmn", resourceAsStream, cd); MultipartBody body = new MultipartBody(att); Response response = client.post(body); // 转换并输出响应结果 printResult("部署流程", response); }
Example #27
Source File: JAXRSClientServerTikaTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testUploadIndexAndSearchPdfFile() { final WebClient wc = createWebClient("/catalog").type(MediaType.MULTIPART_FORM_DATA); final ContentDisposition disposition = new ContentDisposition("attachment;filename=testPDF.pdf"); final Attachment attachment = new Attachment("root", getClass().getResourceAsStream("/files/testPDF.pdf"), disposition); wc.post(new MultipartBody(attachment)); final Collection<ScoreDoc> hits = search("modified=le=2007-09-16T09:00:00"); assertEquals(hits.size(), 1); }
Example #28
Source File: JAXRSClientServerTikaTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testUploadIndexAndSearchPdfFileUsingUserDefinedDatePattern() { final WebClient wc = createWebClient("/catalog").type(MediaType.MULTIPART_FORM_DATA); final ContentDisposition disposition = new ContentDisposition("attachment;filename=testPDF.pdf"); final Attachment attachment = new Attachment("root", getClass().getResourceAsStream("/files/testPDF.pdf"), disposition); wc.post(new MultipartBody(attachment)); // Use user-defined date pattern final Collection<ScoreDoc> hits = search("modified=le=2007/09/16"); assertEquals(hits.size(), 1); }
Example #29
Source File: MultipartStore.java From cxf with Apache License 2.0 | 5 votes |
@POST @Path("/books/formimage2") @Consumes("multipart/form-data") @Produces("multipart/form-data") public MultipartBody addBookFormImage2(MultipartBody image) throws Exception { image.getAllAttachments(); return image; }
Example #30
Source File: MultipartStore.java From cxf with Apache License 2.0 | 5 votes |
@POST @Path("/books/formbody") @Consumes("multipart/form-data") @Produces("text/xml") public Response addBookFromFormBody(MultipartBody body) throws Exception { MultivaluedMap<String, String> data = AttachmentUtils.populateFormMap(context); Book b = new Book(); b.setId(Long.valueOf(data.getFirst("id"))); b.setName(data.getFirst("name")); return Response.ok(b).build(); }