/** * Specifies the resource media type string. * * @param mediaType The resource media type string. * @return This object (for method chaining). */ public Builder mediaType(String mediaType) { this.mediaType = MediaType.forString(mediaType); return this; }
/** * Specifies the resource media type string. * * @param mediaType The resource media type string. * @return This object (for method chaining). */ public Builder mediaType(String mediaType) { this.mediaType = MediaType.forString(mediaType); return this; }
/** * Specifies the resource media type string. * * @param mediaType The resource media type string. * @return This object (for method chaining). */ public Builder mediaType(String mediaType) { this.mediaType = MediaType.forString(mediaType); return this; }
/** * Specifies the resource media type string. * * @param mediaType The resource media type string. * @return This object (for method chaining). */ public Builder mediaType(String mediaType) { this.mediaType = MediaType.forString(mediaType); return this; }
/** * Specifies the resource media type string. * * @param mediaType The resource media type string. * @return This object (for method chaining). */ public Builder mediaType(String mediaType) { this.mediaType = MediaType.forString(mediaType); return this; }
/** * Specifies the resource media type string. * * @param mediaType The resource media type string. * @return This object (for method chaining). */ public Builder mediaType(String mediaType) { this.mediaType = MediaType.forString(mediaType); return this; }
/** * Returns the <code>Content-Type</code> header stripped of the charset attribute if present. * * @return The <code>media-type</code> portion of the <code>Content-Type</code> header. */ public MediaType getMediaType() { return MediaType.forString(getContentType()); }
@Header("Content-Type") @Override /* Streamable */ public MediaType getMediaType() { return MediaType.forString("application/zip"); }
/** * Returns the <code>Content-Type</code> header stripped of the charset attribute if present. * * @return The <code>media-type</code> portion of the <code>Content-Type</code> header. */ public MediaType getMediaType() { return MediaType.forString(getContentType()); }
/** * Returns the <code>Content-Type</code> header stripped of the charset attribute if present. * * @return The <code>media-type</code> portion of the <code>Content-Type</code> header. */ public MediaType getMediaType() { return MediaType.forString(getContentType()); }
@Header("Content-Type") @Override /* Streamable */ public MediaType getMediaType() { return MediaType.forString("application/zip"); }
@Header("Content-Type") @Override /* Streamable */ public MediaType getMediaType() { return MediaType.forString("application/zip"); }
/** * Same as {@link #getClasspathReaderResource(String, boolean)} with <code>resolveVars == <jk>false</jk></code> * * @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}. * @return A new reader resource, or <jk>null</jk> if resource could not be found. * @throws IOException */ public ReaderResource getClasspathReaderResource(String name) throws IOException { return getClasspathReaderResource(name, false, MediaType.forString(context.getMediaTypeForName(name)), false); }
/** * Same as {@link #getClasspathStreamResource(String, MediaType, boolean)} except uses the resource mime-type map * constructed using {@link RestContextBuilder#mimeTypes(String...)} to determine the media type. * * @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}. * @return A new stream resource, or <jk>null</jk> if resource could not be found. * @throws IOException */ public StreamResource getClasspathStreamResource(String name) throws IOException { return getClasspathStreamResource(name, MediaType.forString(context.getMediaTypeForName(name)), false); }
/** * Same as {@link #getClasspathStreamResource(String, MediaType, boolean)} except uses the resource mime-type map * constructed using {@link RestContextBuilder#mimeTypes(String...)} to determine the media type. * * @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}. * @return A new stream resource, or <jk>null</jk> if resource could not be found. * @throws IOException */ public StreamResource getClasspathStreamResource(String name) throws IOException { return getClasspathStreamResource(name, MediaType.forString(context.getMediaTypeForName(name)), false); }
/** * Same as {@link #getClasspathReaderResource(String, boolean)} with <code>resolveVars == <jk>false</jk></code> * * @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}. * @return A new reader resource, or <jk>null</jk> if resource could not be found. * @throws IOException */ public ReaderResource getClasspathReaderResource(String name) throws IOException { return getClasspathReaderResource(name, false, MediaType.forString(context.getMediaTypeForName(name)), false); }
/** * Same as {@link #getClasspathStreamResource(String, MediaType, boolean)} except uses the resource mime-type map * constructed using {@link RestContextBuilder#mimeTypes(String...)} to determine the media type. * * @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}. * @return A new stream resource, or <jk>null</jk> if resource could not be found. * @throws IOException */ public StreamResource getClasspathStreamResource(String name) throws IOException { return getClasspathStreamResource(name, MediaType.forString(context.getMediaTypeForName(name)), false); }
/** * Same as {@link #getClasspathReaderResource(String, boolean)} with <code>resolveVars == <jk>false</jk></code> * * @param name The name of the resource (i.e. the value normally passed to {@link Class#getResourceAsStream(String)}. * @return A new reader resource, or <jk>null</jk> if resource could not be found. * @throws IOException */ public ReaderResource getClasspathReaderResource(String name) throws IOException { return getClasspathReaderResource(name, false, MediaType.forString(context.getMediaTypeForName(name)), false); }
/** * Test method for {@link Swagger#setConsumes(java.util.Collection)}. */ @Test public void testSetConsumes() { Swagger t = new Swagger(); t.setConsumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo"))); assertObjectEquals("['text/foo']", t.getConsumes()); assertInstanceOf(List.class, t.getConsumes()); t.setConsumes(new ASet<MediaType>()); assertObjectEquals("[]", t.getConsumes()); assertInstanceOf(List.class, t.getConsumes()); t.setConsumes(null); assertNull(t.getConsumes()); }
/** * Test method for {@link Operation#setConsumes(java.util.Collection)}. */ @Test public void testSetConsumes() { Operation t = new Operation(); t.setConsumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo"))); assertObjectEquals("['text/foo']", t.getConsumes()); assertInstanceOf(List.class, t.getConsumes()); t.setConsumes(new ASet<MediaType>()); assertObjectEquals("[]", t.getConsumes()); assertInstanceOf(List.class, t.getConsumes()); t.setConsumes(null); assertNull(t.getConsumes()); }