Search in sources :

Example 1 with RootPageModel

use of org.activityinfo.server.login.model.RootPageModel in project activityinfo by bedatadriven.

the class HostController method getHostPage.

@GET
@Produces(MediaType.TEXT_HTML)
@LogException(emailAlert = true)
public Response getHostPage(@Context UriInfo uri, @Context HttpServletRequest req, @QueryParam("redirect") boolean redirect) throws Exception {
    if (!authProvider.isAuthenticated()) {
        // Otherwise, go to the default ActivityInfo root page
        return Response.ok(new RootPageModel().asViewable()).type(MediaType.TEXT_HTML).cacheControl(CacheControl.valueOf("no-cache")).build();
    }
    if (redirect) {
        return Response.seeOther(uri.getAbsolutePathBuilder().replacePath(ENDPOINT).build()).build();
    }
    String appUri = uri.getAbsolutePathBuilder().replaceQuery("").build().toString();
    HostPageModel model = new HostPageModel(appUri);
    model.setAppCacheEnabled(checkAppCacheEnabled(req));
    return Response.ok(model.asViewable()).type(MediaType.TEXT_HTML).cacheControl(CacheControl.valueOf("no-cache")).build();
}
Also used : HostPageModel(org.activityinfo.server.login.model.HostPageModel) RootPageModel(org.activityinfo.server.login.model.RootPageModel) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) LogException(org.activityinfo.server.util.logging.LogException)

Aggregations

GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 HostPageModel (org.activityinfo.server.login.model.HostPageModel)1 RootPageModel (org.activityinfo.server.login.model.RootPageModel)1 LogException (org.activityinfo.server.util.logging.LogException)1