Package org.soybeanMilk.web.config

Examples of org.soybeanMilk.web.config.WebConfiguration


  public void setUp() throws Exception
  {
    WebConfigurationParser parser=new WebConfigurationParser(null);
    parser.parse("org/soybeanMilk/test/unit/web/TestDefaultWebExecutor.xml");
   
    WebConfiguration webConfiguration= parser.getWebConfiguration();
   
    webExecutor=new DefaultWebExecutor(webConfiguration);
  }
View Full Code Here


    DefaultWebExecutor we=null;
   
    DefaultResolverObjectFactory rf=new DefaultResolverObjectFactory();
    rf.setExternalResolverObjectFactory(getInitExternalResolverObjectFactory());
   
    WebConfiguration webConfiguration=new WebConfiguration();
    webConfiguration.setResolverObjectFactory(rf);
   
    String configFileName=getInitParameter(WebConstants.ServletInitParams.SOYBEAN_MILK_CONFIG);
   
    WebConfigurationParser parser=new WebConfigurationParser(webConfiguration,getServletContext());
    parser.parse(configFileName);
View Full Code Here

  {
    {
      WebConfigurationParser parser=new WebConfigurationParser(null);
      parser.parse("org/soybeanMilk/test/unit/web/TestWebConfigurationParser-0.xml");
     
      WebConfiguration webConfiguration= parser.getWebConfiguration();
     
      Assert.assertEquals(DefaultTypeTargetHandler.class,
          webConfiguration.getTypeTargetHandler().getClass());
     
      Assert.assertEquals(JsonTargetHandler.class,
          webConfiguration.getTypeTargetHandler().getTargetHandler("json").getClass());
     
      Assert.assertEquals(JsonTargetHandler.class,
          webConfiguration.getTypeTargetHandler().getTargetHandler("forward").getClass());
     
      Assert.assertEquals(RedirectTargetHandler.class,
          webConfiguration.getTypeTargetHandler().getTargetHandler("redirect").getClass());
     
      TargetHandler multi= webConfiguration.getTypeTargetHandler().getTargetHandler("pdf");
      Assert.assertEquals(JsonTargetHandler.class, multi.getClass());
      Assert.assertTrue( multi ==  webConfiguration.getTypeTargetHandler().getTargetHandler("mp3"));
      Assert.assertTrue( multi ==  webConfiguration.getTypeTargetHandler().getTargetHandler("JPEG"));
    }
   
    {
      WebConfigurationParser parser=new WebConfigurationParser(null);
      parser.parse("org/soybeanMilk/test/unit/web/TestWebConfigurationParser-1.xml");
     
      WebConfiguration webConfiguration= parser.getWebConfiguration();
     
      Assert.assertEquals(MyTypeTargetHandler.class,
          webConfiguration.getTypeTargetHandler().getClass());
     
      Assert.assertEquals(JsonTargetHandler.class,
          webConfiguration.getTypeTargetHandler().getTargetHandler("json").getClass());
     
      Assert.assertEquals(ForwardTargetHandler.class,
          webConfiguration.getTypeTargetHandler().getTargetHandler("forward").getClass());
     
    }
  }
View Full Code Here

  public void parse_target() throws Exception
  {
    WebConfigurationParser parser=new WebConfigurationParser(null);
    parser.parse("org/soybeanMilk/test/unit/web/TestWebConfigurationParser-0.xml");
   
    WebConfiguration webConfiguration= parser.getWebConfiguration();
   
    {
      WebAction ac=(WebAction)webConfiguration.getExecutable("exe0");
      Assert.assertNull(ac.getTarget().getUrl());
      Assert.assertEquals(Target.FORWARD, ac.getTarget().getType());
    }
    {
      WebAction ac=(WebAction)webConfiguration.getExecutable("exe1");
      Assert.assertEquals("url", ac.getTarget().getUrl());
      Assert.assertEquals(Target.FORWARD, ac.getTarget().getType());
    }
    {
      WebAction ac=(WebAction)webConfiguration.getExecutable("exe2");
      Assert.assertNull(ac.getTarget().getUrl());
      Assert.assertEquals("json", ac.getTarget().getType());
    }
    {
      WebAction ac=(WebAction)webConfiguration.getExecutable("exe3");
      Assert.assertNull(ac.getTarget().getUrl());
      Assert.assertEquals("JSON", ac.getTarget().getType());
    }
  }
View Full Code Here

   */
  protected void parseTypeTargetHandler(Element parent)
  {
    Element hdlEl = getSingleElementByTagName(parent, TAG_TARGET_HANDLER);
   
    WebConfiguration cfg=getWebConfiguration();
   
    String clazz = hdlEl==null ? null : getAttributeValueIngoreEmpty(hdlEl, TAG_TARGET_HANDLER_ATTR_CLASS);
    TypeTargetHandler targetHandler=cfg.getTypeTargetHandler();
    if(targetHandler == null)
    {
      if(clazz==null || clazz.length()==0)
        targetHandler = createTypeTargetHandlerInstance();
      else
        targetHandler = (TypeTargetHandler)createClassInstance(clazz);
     
      cfg.setTypeTargetHandler(targetHandler);
    }
   
    parseTargetHandler(targetHandler, hdlEl);
  }
View Full Code Here

  }
 
  @Override
  protected Configuration createConfigurationInstance()
  {
    return new WebConfiguration();
  }
View Full Code Here

TOP

Related Classes of org.soybeanMilk.web.config.WebConfiguration

Copyright © 2018 www.massapicom. 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.