/** * The object implements the writeExternal method to save its contents * by calling the methods of DataOutput for its primitive values or * calling the writeObject method of ObjectOutput for objects, strings * and arrays. * * @param out the ObjectOutput object to write to * @exception IOException Includes any I/O exceptions that may occur */ public void writeExternal(ObjectOutput out) throws IOException { out.writeUTF(toString()); out.flush(); }
/** * Gets the MIME type with which the binary content shall be printed. * * <p> * This method shall be used from those {@link RuntimeBuiltinLeafInfo} that are * bound to base64Binary. * * @see JAXBContextImpl#getXMIMEContentType(Object) */ public String getXMIMEContentType() { // xmime:contentType takes precedence String v = grammar.getXMIMEContentType(cycleDetectionStack.peek()); if(v!=null) return v; // then look for the current in-scope @XmlMimeType if(expectedMimeType!=null) return expectedMimeType.toString(); return null; }
/** * The object implements the writeExternal method to save its contents * by calling the methods of DataOutput for its primitive values or * calling the writeObject method of ObjectOutput for objects, strings * and arrays. * * @param out the ObjectOutput object to write to * @exception IOException Includes any I/O exceptions that may occur */ public void writeExternal(ObjectOutput out) throws IOException { out.writeUTF(toString()); out.flush(); }
/** * Gets the MIME type with which the binary content shall be printed. * * <p> * This method shall be used from those {@link RuntimeBuiltinLeafInfo} that are * bound to base64Binary. * * @see JAXBContextImpl#getXMIMEContentType(Object) */ public String getXMIMEContentType() { // xmime:contentType takes precedence String v = grammar.getXMIMEContentType(cycleDetectionStack.peek()); if(v!=null) return v; // then look for the current in-scope @XmlMimeType if(expectedMimeType!=null) return expectedMimeType.toString(); return null; }
private void writeResponse(HttpServletResponse response, String result, MimeType mimeType) throws IOException { response.setContentType(mimeType.toString()); PrintWriter writer = response.getWriter(); writer.write(result); writer.flush(); }
/** * Set the value of the HTTP Content-Type header */ public RequestOptions setContentType(MimeType value) { return setHeader("Content-Type", value.toString()); }
public void writeField(String name, MimeType value) throws IOException { if (value != null) { writeField(name, value.toString()); } }
private MimeType override(MimeType mimeType) throws MimeTypeDetectionException { String original = mimeType.toString(); String replaced = replacer.replace(original); if (!replaced.equals(original)) { LOG.debug("Detected mime type {} overriden by: {}", original, replaced); return toMimetype(original, replaced); } return mimeType; }
public void setMimeType(MimeType type) { complete(); setAttributeValue(TYPE, (type != null) ? type.toString() : null); }
protected void handleGet(HttpServletRequest request, HttpServletResponse response) throws IOException { final GraphNode node = getServiceNode(request); for (MimeType mimeType : getSupportedInputFormats()) { node.addPropertyValue(TRANSFORMER.supportedInputFormat, mimeType.toString()); } for (MimeType mimeType : getSupportedOutputFormats()) { node.addPropertyValue(TRANSFORMER.supportedOutputFormat, mimeType.toString()); } response.setStatus(HttpServletResponse.SC_OK); respondFromNode(response, node); }
public Content setMimeType(String type) { complete(); try { if (type != null) setAttributeValue(TYPE, (new MimeType(type)).toString()); else removeAttribute(TYPE); } catch (javax.activation.MimeTypeParseException e) { throw new org.apache.abdera.util.MimeTypeParseException(e); } return this; }
public Link setMimeType(String type) { complete(); try { if (type != null) setAttributeValue(TYPE, (new MimeType(type)).toString()); else removeAttribute(TYPE); } catch (javax.activation.MimeTypeParseException e) { throw new org.apache.abdera.util.MimeTypeParseException(e); } return this; }
public ResponseContext filter(RequestContext request, FilterChain chain) { ResponseContext resp = chain.next(request); String format = request.getParameter("format"); return (resp.getContentType() != null && jsonPreferred(request, resp.getContentType().toString())) || (format != null && format .equalsIgnoreCase("json")) ? new JsonResponseContext(resp, request.getAbdera()) : resp; }
@Programmatic public void modifyClob(Clob clob) { setName(clob.getName()); setMimeType(clob.getMimeType().toString()); setClobChars(clob.getChars().toString()); setSort(DocumentSort.CLOB); }
@Programmatic public void modifyClob(Clob clob) { setName(clob.getName()); setMimeType(clob.getMimeType().toString()); setClobChars(clob.getChars().toString()); setSort(DocumentSort.CLOB); }
@Programmatic public void modifyBlob(Blob blob) { setName(blob.getName()); setMimeType(blob.getMimeType().toString()); setBlobBytes(blob.getBytes()); setSort(DocumentSort.BLOB); } public boolean hideBlob() {
@Programmatic public void modifyBlob(Blob blob) { setName(blob.getName()); setMimeType(blob.getMimeType().toString()); setBlobBytes(blob.getBytes()); setSort(DocumentSort.BLOB); } public boolean hideBlob() {
@Test public void when_blob_is_not_null() { final Blob val = new Blob("image.png", "image/png", new byte[]{1,2,3,4,5}); CommonDtoUtils.setValueOn(valueDto, ValueType.BLOB, val, mockBookmarkService); final BlobDto blobDto = valueDto.getBlob(); Assert.assertThat(blobDto, is(notNullValue())); Assert.assertThat(blobDto.getBytes(), is(val.getBytes())); Assert.assertThat(blobDto.getName(), is(val.getName())); Assert.assertThat(blobDto.getMimeType(), is(val.getMimeType().toString())); }
@Test public void when_clob_is_not_null() { final Clob val = new Clob("image.png", "image/png", new char[]{1,2,3,4,5}); CommonDtoUtils.setValueOn(valueDto, ValueType.CLOB, val, mockBookmarkService); final ClobDto clobDto = valueDto.getClob(); Assert.assertThat(clobDto, is(notNullValue())); Assert.assertThat(clobDto.getChars(), is(val.getChars())); Assert.assertThat(clobDto.getName(), is(val.getName())); Assert.assertThat(clobDto.getMimeType(), is(val.getMimeType().toString())); } }