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

net.gdface.web.DefaultResponseFactory Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package net.gdface.web;

import java.util.Iterator;
import net.gdface.utils.SPIUtils;

/**
 * {@link ResponseFactory}接口默认实现
 * @author guyadong
 *
 */
public class DefaultResponseFactory implements ResponseFactory{

    @Override
    public Response createResponse() {
        return new DefaultResponse();
    }
    /**
     * SPI(Service Provider Interface)加载{@link ResponseFactory}接口实例,
     * 没有找到则返回{@link DefaultResponseFactory}实例
     * @return 返回{@link ResponseFactory}实例
     */
    public static final ResponseFactory loadResponseFactory() {
            Iterator itor = SPIUtils.serviceLoaderOf(ResponseFactory.class).iterator();
            return itor.hasNext() ? itor.next() : new DefaultResponseFactory();
    }  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy