Examples of ModuleConfig


Examples of org.apache.struts.config.ModuleConfig

    SimpleLookupDispatchAction actionBean = createMock(SimpleLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);

    action.setServlet(servlet);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
    expect(servlet.getServletContext()).andReturn(context);
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("");
    expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);

    expect(mapping.getPath()).andReturn("appPath");

    replay(actionBean);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

    NavigableLookupDispatchAction actionBean = createMock(NavigableLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);

    action.setServlet(servlet);

    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
    expect(servlet.getServletContext()).andReturn(context);
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("");
    expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);
    expect(messageResources.getMessage(Locale.getDefault(), "insert.key")).andReturn("Insert Stuff Here");
    actionBean.insert();
    expect(actionBean.getNavigationResult()).andReturn("inserted");
    expect(mapping.findForward("inserted")).andReturn(actionForward);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

    NavigableLookupDispatchAction actionBean = createMock(NavigableLookupDispatchAction.class);

    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);

    action.setServlet(servlet);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
    expect(servlet.getServletContext()).andReturn(context);
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("");
    expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);

    expect(mapping.getPath()).andReturn("appPath");

    replay(actionBean);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

  protected MessageResources getMessageResources(ActionContext injectionContext)
  {
    HttpServletRequest request = injectionContext.getRequest();

    ServletContext context = injectionContext.getContext();
    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, context);

    // Return the requested message resources instance
    return (MessageResources) context.getAttribute(bundle + moduleConfig.getPrefix());
  }
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

 
  @Test
  public void testInit() throws ServletException
  {

    ModuleConfig config = createMock(ModuleConfig.class);
    ServletContext context = createMock(ServletContext.class);
    ActionServlet servlet = createMock(ActionServlet.class);

    expect(servlet.getServletContext()).andReturn(context);
    expect(config.getPrefix()).andReturn("prefix");

    replay(config);
    replay(context);
    replay(servlet);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

  {

    String className = type;
    Action action = null;

    ModuleConfig moduleConfig = actionConfig.getModuleConfig();
    String actionsKey = Constants.ACTIONS_KEY + moduleConfig.getPrefix();
   
    final Map applicationScope = context.getApplicationScope();
   
    Map<String, Action> actions = (Map<String, Action>) applicationScope.get(actionsKey);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

  }
 
  protected ModuleSelector extend(final ModuleSelector delegate) {
    return new ModuleSelector() {
      public ModuleContext getModuleContext(HttpServletRequest request) {
        ModuleConfig config = ModuleUtils.getInstance().getModuleConfig(request);
        if (config != null) {
          ModuleContext module = getStrutsModuleContext(config);
          if (module != null) {
            return module;
          }
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

     * @param context session
     * @param key bundle key
     * @return resources
     */
    public static MessageResources getMessageResources(ServletContext context, String key) {
        ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig("", context);
        return (MessageResources) context.getAttribute(key + moduleConfig.getPrefix());
    }
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

            initServlet();

            getServletContext().setAttribute(Globals.ACTION_SERVLET_KEY, this);
            initModuleConfigFactory();
            // Initialize modules as needed
            ModuleConfig moduleConfig = initModuleConfig("", config);
            initCore();

            // Start extensions
            bootProgressMonitor.updateMessage("Starting extensions");
            bootProgressMonitor.updateProgress(30);
View Full Code Here

Examples of org.apache.struts.config.ModuleConfig

            List<Pair> listItemsList = new ArrayList<Pair>();
            if (!definition.getTypeMeta().startsWith("!")) {
                for (Iterator i = ((List) definition.getTypeMetaObject()).iterator(); i.hasNext();) {
                    TypeMetaListItem item = (TypeMetaListItem) i.next();
                    ServletContext context = CoreServlet.getServlet().getServletContext();
                    ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, context);
                    String mrKey = (item.getMessageResourcesKey() == null ? "properties" : item.getMessageResourcesKey())
                                    + moduleConfig.getPrefix();
                    MessageResources res = (MessageResources) context.getAttribute(mrKey);
                    String k = definition.getName() + ".value." + item.getValue();
                    String v = "";
                    if (res != null) {
                        v = res.getMessage((Locale) request.getSession().getAttribute(Globals.LOCALE_KEY), k);
View Full Code Here
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.