org.opentripplanner.api.parameter.MIMEImageFormat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.api.parameter;
import java.util.Arrays;
import java.util.Collection;
import javax.ws.rs.BadRequestException;
public class MIMEImageFormat {
public static final Collection acceptedTypes = Arrays.asList(
"png",
"gif",
"jpeg",
"geotiff"
);
public final String type;
public MIMEImageFormat(String s) {
String[] parts = s.split("/");
if (parts.length == 2 && parts[0].equals("image")) {
if (acceptedTypes.contains(parts[1])) {
type = parts[1];
} else {
throw new BadRequestException("unsupported image format: " + parts[1]);
}
} else {
throw new BadRequestException("malformed image format mime type: " + s);
}
}
public String toString() {
return "image/" + type;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy