Package resources.search

Source Code of resources.search.SearchResource

package resources.search;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;

import models.Article;
import views.ArticlesView;
import daos.ArticleDao;

@Path("/search")
public class SearchResource {

    private ArticleDao articleDao;

    public SearchResource(ArticleDao articleDao) {
        this.articleDao = articleDao;
    }

    @GET
    public ArticlesView search(@QueryParam("term") String term) {
        List<Article> articles = articleDao.findBySlugAndText(term, term);
        return new ArticlesView(articles);
    }
}
TOP

Related Classes of resources.search.SearchResource

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.