Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Main
TextFormattingRules
WhatIsWiki




JSPWiki v2.2.33

[RSS]


Hide Menu

SandBox


Difference between version 318 and version 16:

At line 1 changed 5 lines.
* [AppFuse Demo]
* [StrutsResume Demo|http://raibledesigns.com/resume]
* [SecurityExample Demo]
* [StrutsMenu Demo|http://raibledesigns.com/struts-menu]
* [Charleston Real Estate Guide|http://www.charlestonrealestateguide.com]
[this mailing list thread|http://nagoya.apache.org/eyebrowse/[email protected]&msgNo=451].
At line 7 changed 2 lines.
I feel this release deserves the big __1.0__ designation because it is an up-to-date representation of my learnings and my perceived
best practices in building web applications. Of course, as I learn more, I will continue to push out new releases.
[What is this SandBox?|WhatIsThisSandBox]
At line 10 changed 8 lines.
In this release, I did a lot of refactoring and enhancements to existing features. The DAO and Manager interfaces are no longer tied
to Struts or Hibernate. Hibernate's Session object is now passed as an argument into Manager and DAO constructors, rather than
method signatures. The DAOFactory was refactored by <a href="http://www.coyotesong.com/">Bear Giles</a> to use reflection to
instantiate Hibernate DAO's. Now, if you add a new DAO, you don't have to edit DAOFactory and DAOFactoryHibernate. To insantiate a
new DAO, the code is now:
{{{
LookupDAO dao = (LookupDAO) DAOFactory.getInstance(conn, LookupDAO.class);
}}}
[{Java2HtmlPlugin
At line 19 changed 1 line.
...where __conn__ is a connection object retrieved from ServiceLocator or ActionFilter. When you add new POJOs, you still have to add them to ServiceLocator (for JUnit tests) and hibernate.cfg.xml, which is kindof a pain. I'd like to figure out a way to tell Hibernate to just look in appfuse-ejb.jar.
import javax.naming.Context;
import javax.naming.InitialContext;
At line 21 changed 7 lines.
&lt;tangent&gt;\\
I still don't have a Factory for Managers, and I don't know that there's a need for one, but it's something I might add in the future. Managers are still creating using: {{LookupManager mgr = new LookupManagerImpl(ActionFilter.getConnection());}}. One thing I've been thinking about is the ability to switch webapp frameworks - kindof like you can do with Persistence Frameworks and the DAO Pattern. It'd be cool to add a way to switch (at build time) to use WebWork or Tapestry. Maybe by replacing values for the controller in web.xml. It'd probably be a pain since I'd probably have to create new JSPs for the new frameworks - but it would probably be a great learning experience.\\
&lt;/tangent&gt;
The Remember Me feature has been refactored so the username and password cookies are only available under
the /appfuse/security url-pattern. I also changed the posting to "j_security_check" in LoginServlet from response.sendRedirect to
an HTTP POST, using Jakarta Common's HttpClient. The reason I have a LoginServlet vs. just using action="j_security_check" in my &lt;form&gt; is to encrypt passwords.
import junit.framework.TestCase;
At line 29 changed 3 lines.
I've developed 3 different applications using AppFuse ([struts-resume|StrutsResume] is one of them), and I have found that it's a pain to
upgrade to new versions of AppFuse. Because of this, I don't recommend upgrading unless you really need to. I will be upgrading
struts-resume to AppFuse 1.0, but I doubt I'll upgrade it to any future AppFuse releases - it's just too much work for not much reward.
import org.mockejb.MockContainer;
import org.mockejb.SessionBeanDescriptor;
import org.mockejb.jndi.MockContextFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
At line 33 changed 4 lines.
* [Download|http://sourceforge.net/project/showfiles.php?group_id=49385&amp;release_id=200891] (~11.5 MB for src, ~3.9 MB for bin)
* [Release Notes|http://sourceforge.net/project/shownotes.php?release_id=200891]
* [API Documentation and Source|http://raibledesigns.com/downloads/appfuse/api/]
* [Mailing List|http://sourceforge.net/mailarchive/forum.php?forum_id=18761]
/**
* Parent TestCase class for testing EJBs using MockEJB
*
* @author mraible
*
*/
public abstract class MockEJBTestCase extends TestCase {
/**
* This method sets up a MockContainer and allows you to deploy an EJB to
* it. Override <code>onSetUp()</code> to add custom set-up behavior.
*
* @see #onSetUp()
*/
protected final void setUp() throws Exception {
MockContextFactory.setAsInitial();
Context ctx = new InitialContext();
ApplicationContext appCtx =
new ClassPathXmlApplicationContext(getConfigLocations());
ctx.bind("java:comp/env/jdbc/appDS", appCtx.getBean("dataSource"));
MockContainer mc = new MockContainer(ctx);
SessionBeanDescriptor dd = getDeploymentDescriptor();
mc.deploy(dd);
onSetUp();
}
protected String[] getConfigLocations() {
return new String[] { "classpath:/applicationContext.xml" };
}
protected void onSetUp() throws Exception {}
protected abstract SessionBeanDescriptor getDeploymentDescriptor();
}
}]
[CreateDAO_zh]
[CreateDAO_sp]
[CreateManager_es]
[QuickStart Guide_es]
[SpringControllerUnitTest]
[δΈ­ζ–‡ζŒ‡ε—|Articles_zh]

Back to SandBox, or to the Page History.