Stop Tomcat from persisting sessions
I can't seem to find the blog post about how to disable Session persistence for a given <Context>. Anyone got a link?
The Angular Mini-Book is a
guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and
deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.
Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.
For book updates, follow @angular_book on Twitter.
The JHipster Mini-Book is a
guide to getting started with hip technologies today: Angular, Bootstrap, and Spring
Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.
This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.
For book updates, follow @jhipster-book on Twitter.
I can't seem to find the blog post about how to disable Session persistence for a given <Context>. Anyone got a link?
Big news baby - the best Java tool in the world has a new release. I don't know that I'll use any of the new features (such as antlib, macrodef, presetdef, ssh tasks), but I do love to upgrade. Downloading now...
Later: It looks like Canoo's WebTest is not compatible with Ant 1.6. Reverting back to 1.5.4.
C:\Source\appfuse\test\web\web-tests.xml:29: Task must be of type "Step": invoke at C:\Source\appfuse\test\web\login.xml:1: is of type org.apache.tools.ant.UnknownElement
Line 29 is: <canoo name="login">. I've notified the webtest mailing list, hopefully there will be a resolution shortly.
After looking at Hibernate's AdminApp, as well as other WW2 apps - I've noticed something. WW2 developers don't seem to give a rats ass about referencing their POJOs in their Actions, or using Hibernate directly in their actions. At first glance, I think to myself, "boy that sure makes things easier." But then again - doesn't that tightly couple your web layer to your persistence layer?
I can understand the POJO reference in Actions - I'm about to give up on doing a parent/child relationship with Hibernate where the children are converted to ActionForms and then converted back (Hibernate loves to tell me "a different object with the same identifier value was already associated with the session: 1").
It would be SO much easier (with this particular problem) if I could just toss up POJOs to my view. The thought of importing "persistence.User" into my Action makes me cringe though. I don't know why, it just does. I need to get out of this patterns mindset I've been in for the last couple of years and get back to what really matters - simple, easy to learn, and fast to develop. I'm tired of banging my head against the wall with Struts and Hibernate.... I've been doing it for two days. It's not Hibernate, and it's not Struts, it's me... (thud, thud, thud).
I found a very nice plugin for JSPWiki this morning: the Java to HTML converter
.
I've found that it works for Java, XML and HTML. Here's a couple of examples (I've hooked it into Roller's JSPWiki support):
Java
/**
|
HTML
<html>
|
XML
|
The one thing I don't like is that it centers the code using <center>, adding "center table {width: 100%}" to your stylesheet fixes the issue. I also tried to upgrade Roller's JSPWiki.jar to 2.1.86-alpha (to get XHTML support), but I was getting all kinds of stacktraces from OSCache and it just didn't work. Java2Html also has an Ant Task to convert Java source to HTML. Java2HTML
has the same thing, but this new one supports different styles
.
NOTE: The above syntax coloring produces invalid XHTML, so this site won't validate for awhile.
I guess it happened yesterday, beginning upgrade at 3:10 MST... Done at 3:15 - let me know if you see any issues.
Later: There's issues all right. First thing is that the flag to allow symlinks used to be adding the following in your <Context> tag:
<Resources className="org.apache.naming.resources.FileDirContext" allowLinking="true" caseSensitive="true" />
And with 5.0.16, this doesn't work. Adding allowLinking="true" on your <Context> does allow symlinks, and should have been this way the whole time IMO. I also got a good ol' OutOfMemory error and I have a sneak suspicion it's not Roller (though Roller does though an exception when I do Weblog → Edit:
ERROR 2003-12-04 15:54:07,948 | HibernateStrategy:query | During QUERY net.sf.hibernate.QueryException: could not resolve property type: weblogEntryId [select p from p in class org.roller.pojos.RefererData where p.weblogEntryId=? and not title is null and not excerpt is null order by p.totalHits desc]
Maybe this has something to do with the fact that my referers are not getting cleaned out every night. Anyway, back to my sneaky suspicion of OOM errors. I have two domains hosted on this site - raible.net and raibledesigns.com. The first just redirects to my family blog, but that's not the point. What I'm seeing in Tomcat's logs is that it tries to load all apps for both domains - and it pukes on a few. Time to play around with server.xml and see if I can get raible.net to just load it's own context.
Solution Found: You have to configure 2 different appBase's for each host.
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.
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 Bear Giles 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);
...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.
<tangent>
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.
</tangent>
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 <form> is to encrypt passwords.
I've developed 3 different applications using AppFuse (struts-resume 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.
Here's a couple of tips to help you in your JSP development with JSTL:
mainMenu.link=Click <a href="{0}">here</a> to return to the Main Menu.In your JSP:
<fmt:message key="mainMenu.link"> <fmt:param><html:rewrite forward="mainMenu"/></fmt:param> </fmt:message>
Usually I try not to put any HTML in ApplicationResources.properties, but I don't think a minimal amount hurts anything. Of course, you could put all the HTML in your JSP, so mainMenu.link changes to "Click {0} to return to the Main Menu." and your JSP changes to:
<fmt:message key="mainMenu.link"> <fmt:param> <html:link forward="mainMenu">here</html:link> </fmt:param> </fmt:message>
Enjoy!
This User-Mode Linux sounds like a great opportunity for hosting this site. I currently pay around $50/month to host this site, and there's two things that are frustrating:
I do have a cable internet connection, so I could host this site myself, but my upload speed is only 241 KB. For you folks that do use UML, does anyone have experience with running Java (i.e. Tomcat or Roller) and MySQL?
I don't know if it was Fedora or me, but it appears that my main hard drive on my Red Hat 9 box is hosed. Here's what I posted on Experts Exchange and the Fedora Mailing list:
Creating root device mkrootdev: label / not found Mounting root filesystem mount: error 2 mounting ext3 pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2 umount /initrd/proc failed: 2 Freeing unused kernel memory: 132K freed Kernel panic: No init found. Try passing init= option to kernel _ <- Flashing cursor
I received a few responses from the mailing list, but my main hard drive appears to be hosed (unrecoverable). I tried doing a clean install, and Fedora again complained about not having enough disk space to copy the images over.
Finally, I took a break and thought of a workable solution while putting a turkey in the oven. I have another machine that has the exact same hardware as my Linux box - it has Windows XP on it, but I'm not using it. So I'm in the midst of installing Fedora on it, and then I'll move the hard drive. I lost all my configured stuff: Apache, CVS, Tomcat, DNS, DHCP, CUPS, but I was able to select most of it in the installation process. Let's hope all these packages are the latest and greatest - then I won't have much configuring to do.
From watching the struts-dev mailing list, I discovered a new Servlet Framework called Shocks. The thing that interests me about this framework is that the author looked extensively at Struts and WebWork both before creating it. It's feature-set sounds nice too:
It has an aspect-oriented workflow engine that can add crosscutting system logic (like form processing, L10N, security, logging, etc) dynamically at runtime (without having to mess around with the bytecode). It can trade actions across classloader boundaries, enabling web applications to span across multiple .WAR files. This allows users to drop in a new .WAR with new metadata and new actions, which updates the application workflow at runtime across all modules in the application namespace. It handles workflow versioning and version rollback (in case you make changes you come to regret). It does instance pooling of all components and sequences. Every aspect of the system can be managed with JMX at runtime.
Sounds like Spring, eh? Yes, says the author.
I think there are appreciable differences that have yet to be realized between the two (I haven't read their code at all), but definitely a lot of conceptual crossover.
I would think that introducing a new framework into the mix (and convincing folks to use it) must be pretty tough at this point, unless you create an IDE to go with it or introduce it in a book. BTW, did you know you can use Tiles with Spring.