当前位置: 首页>>代码示例>>Java>>正文


Java Security.setAttribute方法代码示例

本文整理汇总了Java中org.easyrec.util.core.Security.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Security.setAttribute方法的具体用法?Java Security.setAttribute怎么用?Java Security.setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.easyrec.util.core.Security的用法示例。


在下文中一共展示了Security.setAttribute方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removetenant

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView removetenant(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");

    ModelAndView mav = new ModelAndView("page");

    mav.addObject("title", "easyrec :: administration");

    mav.addObject("operatorId", operatorId);
    mav.addObject("tenantId", tenantId);

    if (Security.isDeveloper(request)) {
        RemoteTenant remoteTenant = remoteTenantDAO.get(operatorId, tenantId);

        if (remoteTenant != null) {
            remoteTenantService.removeTenant(remoteTenant.getId());

            Security.setAttribute(request, "tenantId", null);
            return MessageBlock.createSingle(mav, MSG.TENANT_REMOVED, REMOVE_TENANT, MSG.SUCCESS);
        }

        return MessageBlock.createSingle(mav, MSG.TENANT_REMOVE_FAILED, REMOVE_TENANT, MSG.ERROR);
    } else {
        return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, REMOVE_TENANT, MSG.ERROR);
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:27,代码来源:TenantsController.java

示例2: items

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView items(HttpServletRequest request, HttpServletResponse httpServletResponse)
        throws ParseException {
    ModelAndView mav = new ModelAndView("page");

    Security.setAttribute(request, "menu", "items");

    mav.addObject("title", "easyrec :: view items");
    mav.addObject("selectedMenu", "myEasyrec");
    mav.addObject("menubar", "viewItems");
    mav.addObject("page", "easyrec/viewitems");

    return generateSearchResult(request, mav);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:14,代码来源:ItemSearchController.java

示例3: signin

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView signin(HttpServletRequest request, HttpServletResponse httpServletResponse) {

        ModelAndView mav = security(request);

        Operator operator = operatorDAO.signIn(ServletUtils.getSafeParameter(request, "operatorId", ""),
                ServletUtils.getSafeParameter(request, "password", ""));

        if (operator != null) {

            if (operator.isActive()) {

                String token = Security.signIn(request, operator);
                Security.setAttribute(request, "tenantId", RemoteTenant.DEFAULT_TENANT_ID);

                operatorDAO.setTokenForOperator(token, operator.getOperatorId());
                if (operator.getAccessLevel() == Operator.ACCESS_LEVEL_ADMINISTRATOR) {
                    return MessageBlock
                            .createSingle(mav, MSG.ADMINISTRATOR_SIGNED_IN, "signin", MSG.SUCCESS, token);
                }
                return MessageBlock.createSingle(mav, MSG.OPERATOR_SIGNED_IN, "signin", MSG.SUCCESS, token);


            } else {
                return MessageBlock.createSingle(mav, MSG.OPERATOR_NOT_ACTIVATED, "signin", MSG.ERROR);
            }
        } else {
            return MessageBlock.createSingle(mav, MSG.OPERATOR_SIGNED_IN_FAILED, "signin", MSG.ERROR);
        }

    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:31,代码来源:OperatorController.java

示例4: create

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView create(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("page");
    String operatorId = Security.signedInOperatorId(request);
    Operator operator = Security.signedInOperator(request);
    String operatorIdPar = request.getParameter("operatorId");

    if (Security.isDeveloper(request) || !Strings.isNullOrEmpty(operatorId))
        mav.addObject("operatorId", operatorIdPar);
    else
        mav.addObject("operatorId", operatorId);

    if (operator != null)
        mav.addObject("apiKey", operator.getApiKey());

    if (Security.isSignedIn(request)) {
        mav.addObject("title", "easyrec :: create tenant");
        mav.addObject("page", "easyrec/create");
        mav.addObject("create", true);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));

        Security.setAttribute(request, "tenantId", null);
        mav.addObject("tenantId", (String) Security.getAttribute(request, "tenantId"));
    } else {
        mav.addObject("page", "home");
    }


    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:30,代码来源:EasyRecController.java

示例5: update

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView update(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = security(request, response);

    mav.addObject("title", "easyrec :: update tenant");
    mav.addObject("page", "easyrec/update");
    mav.addObject("update", true);

    Security.setAttribute(request, "tenantId", null);
    mav.addObject("tenantId", (String) Security.getAttribute(request, "tenantId"));

    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:13,代码来源:EasyRecController.java

示例6: removetenant

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView removetenant(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");

    ModelAndView mav = new ModelAndView("page");

    mav.addObject("title", "easyrec :: administration");

    mav.addObject("operatorId", operatorId);
    mav.addObject("tenantId", tenantId);

    if (Security.isDeveloper(request)) {
        RemoteTenant remoteTenant = remoteTenantDAO.get(operatorId, tenantId);

        if (remoteTenant != null) {
            remoteTenantService.removeTenant(remoteTenant.getId());

            pluginScheduler.stopTask(remoteTenant);
            Security.setAttribute(request, "tenantId", null);
            return MessageBlock.createSingle(mav, MSG.TENANT_REMOVED, REMOVE_TENANT, MSG.SUCCESS);
        }

        return MessageBlock.createSingle(mav, MSG.TENANT_REMOVE_FAILED, REMOVE_TENANT, MSG.ERROR);
    } else {
        return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, REMOVE_TENANT, MSG.ERROR);
    }
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:28,代码来源:TenantsController.java

示例7: create

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView create(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("page");
    String operatorId = Security.signedInOperatorId(request);
    Operator operator = Security.signedInOperator(request);
    String operatorIdPar = request.getParameter("operatorId");

    if (Security.isDeveloper(request) || !Strings.isNullOrEmpty(operatorId))
        mav.addObject("operatorId", operatorIdPar);
    else
        mav.addObject("operatorId", operatorId);

    if (operator != null)
        mav.addObject("apiKey", operator.getApiKey());

    if (Security.isSignedIn(request)) {
        mav.addObject("title", "easyrec :: create tenant");
        mav.addObject("page", "easyrec/create");
        mav.addObject("create", true);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));

        Security.setAttribute(request, "tenantId", null);
    } else {
        mav.addObject("page", "home");
    }


    return mav;
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:29,代码来源:EasyRecController.java

示例8: update

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView update(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = security(request, response);

    mav.addObject("title", "easyrec :: update tenant");
    mav.addObject("page", "easyrec/update");
    mav.addObject("update", true);

    Security.setAttribute(request, "tenantId", null);

    return mav;
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:12,代码来源:EasyRecController.java

示例9: view

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView view(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<Message>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");

        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, VIEW_TENANTS, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }

        if (messages.size() > 0 && !"easyrec".equals(operatorId)) {
            return MessageBlock.create(mav, messages, VIEW_TENANTS, MSG.ERROR);
        } else {
            Security.setAttribute(request, "menu", "tenant");
            mav.setViewName("easyrec/overview");

            if (Security.signedInOperator(request) != null && remoteTenant != null) {
                mav.addObject("tenant", remoteTenant);
            }

            mav.addObject("tenantsShow", remoteTenant != null);
        }

        String apiKey = Operator.DEFAULT_API_KEY;

        if (signedInOperator != null) {
            apiKey = signedInOperator.getApiKey();
        }

        mav.addObject("apiKey", apiKey);
        mav.addObject("signedIn", Security.isSignedIn(request));

        return mav;

    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:52,代码来源:RemoteTenantController.java

示例10: viewhotrecommendations

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView viewhotrecommendations(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");

        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, VIEW_HOT_RECOMMENDATIONS, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }


        Security.setAttribute(request, "menu", "viewhotrecommendations");
        // the page view provides the design with a side menu and the menu bar
        mav.setViewName("page");
        mav.addObject("title", "easyrec :: view hot recommendations");
        mav.addObject("menubar", VIEW_HOT_RECOMMENDATIONS);
        mav.addObject("page", "easyrec/viewhotrecommendations");
        mav.addObject("tenantId", tenantId);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));
        if (remoteTenant != null) {
            mav.addObject("items", itemDAO.getHotItems(remoteTenant, 0, 100));
        }


        String apiKey = Operator.DEFAULT_API_KEY;

        if (signedInOperator != null) {
            apiKey = signedInOperator.getApiKey();
        }

        mav.addObject("apiKey", apiKey);
        mav.addObject("signedIn", Security.isSignedIn(request));

        return mav;
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:52,代码来源:RemoteTenantController.java

示例11: clustermanager

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView clustermanager(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");

        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, VIEW_CLUSTER_MANAGER, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }

        Security.setAttribute(request, "menu", VIEW_CLUSTER_MANAGER);
        // the page view provides the design with a header and footer
        mav.setViewName("page");
        mav.addObject("title", "easyrec :: cluster manager");
        mav.addObject("menubar", VIEW_CLUSTER_MANAGER);
        mav.addObject("page", "easyrec/clustermanager");
        mav.addObject("tenantId", tenantId);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));
        if (remoteTenant != null) {
            mav.addObject("items", itemDAO.getHotItems(remoteTenant, 0, 100));
        }


        String apiKey = Operator.DEFAULT_API_KEY;

        if (signedInOperator != null) {
            apiKey = signedInOperator.getApiKey();
        }

        mav.addObject("apiKey", apiKey);
        mav.addObject("signedIn", Security.isSignedIn(request));

        return mav;
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:51,代码来源:RemoteTenantController.java

示例12: security

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
private ModelAndView security(HttpServletRequest request, HttpServletResponse response) {
    String operatorId = null;
    ModelAndView mav = new ModelAndView("page");
    Operator signedInOperator = Security.signedInOperator(request);

    if (signedInOperator != null)
        operatorId = signedInOperator.getOperatorId();

    String parOperatorId = request.getParameter("operatorId");
    String parTenantId = request.getParameter("tenantId");

    if (parTenantId != null)
        Security.setAttribute(request, "tenantId", parTenantId);
    else
        parTenantId = RemoteTenant.DEFAULT_TENANT_ID;

    if (Strings.isNullOrEmpty(parOperatorId))
        parOperatorId = operatorId;

    mav.addObject("tenant", remoteTenantDAO.get(parOperatorId, parTenantId));

    List<RemoteTenant> remoteTenants = null;

    if (signedInOperator != null) {
        mav.addObject("apiKey", signedInOperator.getApiKey());
        mav.addObject("selectedMenu", "myEasyrec");
        mav.addObject("signedIn", Security.isSignedIn(request));
        remoteTenants = remoteTenantDAO.getTenantsFromOperator(signedInOperator.getOperatorId());
    }

    if (Security.isDeveloper(request) && request.getParameter("operatorId") != null) {
        operatorId = request.getParameter("operatorId");
        remoteTenants = remoteTenantDAO.getTenantsFromOperator(request.getParameter("operatorId"));
    }

    mav.addObject("operatorId", operatorId);
    mav.addObject("tenants", remoteTenants);

    Long memory = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax() / (1000000);
    mav.addObject("heapsize", memory);

    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:44,代码来源:EasyRecController.java

示例13: viewhotrecommendations

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView viewhotrecommendations(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<Message>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");

        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, VIEW_HOT_RECOMMENDATIONS, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }


        Security.setAttribute(request, "menu", "viewhotrecommendations");
        // the page view provides the design with a side menu and the menu bar
        mav.setViewName("page");
        mav.addObject("title", "easyrec :: view hot recommendations");
        mav.addObject("menubar", VIEW_HOT_RECOMMENDATIONS);
        mav.addObject("page", "easyrec/viewhotrecommendations");
        mav.addObject("tenantId", tenantId);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));
        if (remoteTenant != null) {
            mav.addObject("items", itemDAO.getHotItems(remoteTenant, 0, 100));
        }


        String apiKey = Operator.DEFAULT_API_KEY;

        if (signedInOperator != null) {
            apiKey = signedInOperator.getApiKey();
        }

        mav.addObject("apiKey", apiKey);
        mav.addObject("signedIn", Security.isSignedIn(request));

        return mav;
    }
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:52,代码来源:RemoteTenantController.java

示例14: clustermanager

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView clustermanager(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<Message>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");

        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, VIEW_CLUSTER_MANAGER, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }

        Security.setAttribute(request, "menu", VIEW_CLUSTER_MANAGER);
        // the page view provides the design with a header and footer
        mav.setViewName("page");
        mav.addObject("title", "easyrec :: cluster manager");
        mav.addObject("menubar", VIEW_CLUSTER_MANAGER);
        mav.addObject("page", "easyrec/clustermanager");
        mav.addObject("tenantId", tenantId);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));
        if (remoteTenant != null) {
            mav.addObject("items", itemDAO.getHotItems(remoteTenant, 0, 100));
        }


        String apiKey = Operator.DEFAULT_API_KEY;

        if (signedInOperator != null) {
            apiKey = signedInOperator.getApiKey();
        }

        mav.addObject("apiKey", apiKey);
        mav.addObject("signedIn", Security.isSignedIn(request));

        return mav;
    }
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:51,代码来源:RemoteTenantController.java


注:本文中的org.easyrec.util.core.Security.setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。