io.undertow.util.MimeMappings Java Examples

The following examples show how to use io.undertow.util.MimeMappings. 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: DeploymentManagerImpl.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
private void initializeMimeMappings(final DeploymentImpl deployment, final DeploymentInfo deploymentInfo) {
    final Map<String, String> mappings = new HashMap<>(MimeMappings.DEFAULT_MIME_MAPPINGS);
    for (MimeMapping mapping : deploymentInfo.getMimeMappings()) {
        mappings.put(mapping.getExtension().toLowerCase(Locale.ENGLISH), mapping.getMimeType());
    }
    deployment.setMimeExtensionMappings(mappings);
}
 
Example #2
Source File: PathResource.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getContentType(final MimeMappings mimeMappings) {
    final String fileName = file.getFileName().toString();
    int index = fileName.lastIndexOf('.');
    if (index != -1 && index != fileName.length() - 1) {
        return mimeMappings.getMimeType(fileName.substring(index + 1));
    }
    return null;
}
 
Example #3
Source File: URLResource.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
@Override
public String getContentType(final MimeMappings mimeMappings) {
    final String fileName = getName();
    int index = fileName.lastIndexOf('.');
    if (index != -1 && index != fileName.length() - 1) {
        return mimeMappings.getMimeType(fileName.substring(index + 1));
    }
    return null;
}
 
Example #4
Source File: PathResource.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
@Override
public String getContentType(final MimeMappings mimeMappings) {
    final String fileName = file.getFileName().toString();
    int index = fileName.lastIndexOf('.');
    if (index != -1 && index != fileName.length() - 1) {
        return mimeMappings.getMimeType(fileName.substring(index + 1));
    }
    return null;
}
 
Example #5
Source File: URLResource.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getContentType(final MimeMappings mimeMappings) {
    final String fileName = getName();
    int index = fileName.lastIndexOf('.');
    if (index != -1 && index != fileName.length() - 1) {
        return mimeMappings.getMimeType(fileName.substring(index + 1));
    }
    return null;
}
 
Example #6
Source File: DeploymentManagerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void initializeMimeMappings(final DeploymentImpl deployment, final DeploymentInfo deploymentInfo) {
    final Map<String, String> mappings = new HashMap<>(MimeMappings.DEFAULT_MIME_MAPPINGS);
    for (MimeMapping mapping : deploymentInfo.getMimeMappings()) {
        mappings.put(mapping.getExtension().toLowerCase(Locale.ENGLISH), mapping.getMimeType());
    }
    deployment.setMimeExtensionMappings(mappings);
}
 
Example #7
Source File: FileErrorPageHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public FileErrorPageHandler(HttpHandler next, final Path file, MimeMappings mimeMappings, final Integer... responseCodes) {
    this.next = next;
    this.file = file;
    this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
    this.mimeMappings = mimeMappings;
}
 
Example #8
Source File: FileErrorPageHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public FileErrorPageHandler(HttpHandler next, final Path file, final Integer... responseCodes) {
    this(next, file, MimeMappings.DEFAULT, responseCodes);
}
 
Example #9
Source File: FileErrorPageHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public FileErrorPageHandler(final Path file, final Integer... responseCodes) {
    this.file = file;
    this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
    this.mimeMappings = MimeMappings.DEFAULT;
}
 
Example #10
Source File: CachedResource.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String getContentType(final MimeMappings mimeMappings) {
    return underlyingResource.getContentType(mimeMappings);
}
 
Example #11
Source File: ResourceHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public ResourceHandler setMimeMappings(final MimeMappings mimeMappings) {
    this.mimeMappings = mimeMappings;
    return this;
}
 
Example #12
Source File: ResourceHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public MimeMappings getMimeMappings() {
    return mimeMappings;
}
 
Example #13
Source File: KnownPathResourceManager.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public String getContentType(MimeMappings mimeMappings) {
    return null;
}
 
Example #14
Source File: CachedResource.java    From quarkus-http with Apache License 2.0 4 votes vote down vote up
@Override
public String getContentType(final MimeMappings mimeMappings) {
    return underlyingResource.getContentType(mimeMappings);
}
 
Example #15
Source File: ResourceHandler.java    From quarkus-http with Apache License 2.0 4 votes vote down vote up
public ResourceHandler setMimeMappings(final MimeMappings mimeMappings) {
    this.mimeMappings = mimeMappings;
    return this;
}
 
Example #16
Source File: ResourceHandler.java    From quarkus-http with Apache License 2.0 4 votes vote down vote up
public MimeMappings getMimeMappings() {
    return mimeMappings;
}
 
Example #17
Source File: TestResourceLoader.java    From quarkus-http with Apache License 2.0 4 votes vote down vote up
@Override
public String getContentType(MimeMappings mimeMappings) {
    return delegate.getContentType(mimeMappings);
}
 
Example #18
Source File: Resource.java    From quarkus-http with Apache License 2.0 2 votes vote down vote up
/**
 * Return the resources content type. In most cases this will simply use the provided
 * mime mappings, however in some cases the resource may have additional information as
 * to the actual content type.
 */
String getContentType(final MimeMappings mimeMappings);
 
Example #19
Source File: Resource.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the resources content type. In most cases this will simply use the provided
 * mime mappings, however in some cases the resource may have additional information as
 * to the actual content type.
 */
String getContentType(final MimeMappings mimeMappings);