/** * Returns the default mime type for the format. * @return the default mime type */ public String getDefaultMimetype() { switch(this) { case UNKNOWN: return null; case BINARY: // TODO: or possibly "application/x-unknown-content-type" return "application/octet-stream"; case JSON: return "application/json"; case TEXT: return "text/plain"; case XML: return "application/xml"; default: throw new MarkLogicInternalException("Unknown format "+this.toString()); } }
/** * Returns the default mime type for the format. * @return the default mime type */ public String getDefaultMimetype() { switch(this) { case UNKNOWN: return null; case BINARY: // TODO: or possibly "application/x-unknown-content-type" return "application/octet-stream"; case JSON: return "application/json"; case TEXT: return "text/plain"; case XML: return "application/xml"; default: throw new MarkLogicInternalException("Unknown format "+this.toString()); } } }
xccFormat = DocumentFormat.NONE; } else if (logger.isDebugEnabled()) { logger.debug("Unsupported format, can't adapt to an XCC DocumentFormat; " + format.toString());
String metadataMimetype = null; if (metadataBase != null) { metadataFormat = metadataBase.getFormat().toString().toLowerCase(); metadataMimetype = metadataBase.getMimetype();
String metadataMimetype = null; if (metadataBase != null) { metadataFormat = metadataBase.getFormat().toString().toLowerCase(); metadataMimetype = metadataBase.getMimetype();
private OkHttpResultIterator getBulkDocumentsImpl(RequestLogger reqlog, long serverTimestamp, Transaction transaction, Set<Metadata> categories, Format format, RequestParameters extraParams, boolean withContent, String... uris) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException { String path = "documents"; RequestParameters params = new RequestParameters(); if ( extraParams != null ) params.putAll(extraParams); if (serverTimestamp != -1) params.add("timestamp", Long.toString(serverTimestamp)); addCategoryParams(categories, params, withContent); if (format != null) params.add("format", format.toString().toLowerCase()); for (String uri: uris) { if ( uri != null && uri.length() > 0 ) { params.add("uri", uri); } } OkHttpResultIterator iterator = getIteratedResourceImpl(DefaultOkHttpResultIterator.class, reqlog, path, transaction, params, MIMETYPE_MULTIPART_MIXED); if ( iterator != null ) { if ( iterator.getStart() == -1 ) iterator.setStart(1); if ( iterator.getSize() != -1 ) { if ( iterator.getPageSize() == -1 ) iterator.setPageSize(iterator.getSize()); if ( iterator.getTotalSize() == -1 ) iterator.setTotalSize(iterator.getSize()); } } return iterator; }
if (payloadMimetype == null) payloadMimetype = payloadFormat.getDefaultMimetype(); params.add("format", payloadFormat.toString().toLowerCase()); } else if (payloadMimetype == null) { payloadMimetype = "application/xml";
if (serverTimestamp != -1) params.add("timestamp", Long.toString(serverTimestamp)); addPointInTimeQueryParam(params, searchHandle); if ( format != null ) params.add("format", format.toString().toLowerCase()); HandleImplementation handleBase = HandleAccessor.as(searchHandle); if ( format == null && searchHandle != null ) {
break; default: throw new IllegalArgumentException("unsupported format: "+format.toString());
docMgr.setSearchView(QueryView.RESULTS); docMgr.setNonDocumentFormat(Format.XML); assertEquals("format set on document manager", "XML", docMgr.getNonDocumentFormat().toString()); assertEquals("Queryview set on document manager ", "RESULTS", docMgr.getSearchView().toString()); assertEquals("Page length ", 1, docMgr.getPageLength());
docMgr.setSearchView(QueryView.RESULTS); docMgr.setNonDocumentFormat(Format.XML); assertEquals("format set on document manager", "XML", docMgr.getNonDocumentFormat().toString()); assertEquals("Queryview set on document manager ", "RESULTS", docMgr.getSearchView().toString()); assertEquals("Page length ", 1, docMgr.getPageLength());
docMgr.setSearchView(QueryView.RESULTS); docMgr.setNonDocumentFormat(Format.XML); assertEquals("format set on document manager","XML",docMgr.getNonDocumentFormat().toString()); assertEquals("Queryview set on document manager ","RESULTS" ,docMgr.getSearchView().toString()); assertEquals("Page length ",1,docMgr.getPageLength());