All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vtence.molecule.decoration.HtmlPageSelector Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
package com.vtence.molecule.decoration;

import com.vtence.molecule.HttpStatus;
import com.vtence.molecule.Response;
import com.vtence.molecule.util.MimeTypes;

public class HtmlPageSelector implements Selector {

    public boolean select(Response response) {
        return isOk(response.statusCode()) && isHtml(response.contentType());
    }

    private boolean isOk(int code) {
        return code == HttpStatus.OK.code;
    }

    private boolean isHtml(String contentType) {
        return contentType != null && contentType.startsWith(MimeTypes.TEXT_HTML);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy