001    package com.khubla.pragmatach.framework.controller.impl;
002    
003    import com.khubla.pragmatach.framework.annotation.Controller;
004    import com.khubla.pragmatach.framework.annotation.Route;
005    import com.khubla.pragmatach.framework.api.PragmatachException;
006    import com.khubla.pragmatach.framework.api.Response;
007    
008    /**
009     * <p>
010     * Controller to redirect root requests to /public/. Such as favicon.ico.
011     * </p>
012     * 
013     * @author tome
014     */
015    @Controller(name = "pragmatachDefaultContextRootController")
016    public class DefaultContextRootController extends AbstractController {
017       /**
018        * ctor
019        */
020       public DefaultContextRootController() {
021       }
022    
023       @Route(uri = "/*")
024       public Response render(String[] resource) throws PragmatachException {
025          try {
026             return redirect("/public" + buildWildcardResourceURI(resource));
027          } catch (final Exception e) {
028             throw new PragmatachException("Exception in render", e);
029          }
030       }
031    }