Thursday, June 30, 2005

Roadmap - The Apache Struts Web Application Framework

Roadmap - The Apache Struts Web Application Framework: "# Transparent support for a portlet environment (JSR 168), with minimal-to-no changes in your business logic and pages.
# Direct support for JSTL/JSF taglibs and the JSF API"

How to create a Struts Portlet ?

How to create a Struts Portlet ?

Thursday, June 16, 2005

jGuru: How do I ensure that my servlet is thread-safe?

jGuru: How do I ensure that my servlet is thread-safe?: "Re: How local data in servlet is syncronized
Steve Xu, Aug 9, 2003
don't confuse the instance variable with the local variable inside service method. instance variable: allocated at the object level, needs to be synchronized. local variable: allocated on the stack of the calling thread, does not need to be synchronized.
"

jGuru: Why shouldn't we make the service() method synchronized?

jGuru: Why shouldn't we make the service() method synchronized?

jGuru: What is the meaning of calling a method or object thread-safe?

jGuru: What is the meaning of calling a method or object thread-safe?: "Answer
Basically, calling a method 'thread-safe' means that even if multiple threads try to access it simultaneously, nothing bad happens. Here 'bad' usually means that due to race conditions, or deadlock, or other pitfalls, the object's state gets corrupted, or its methods produce unreliable results. A method usually acheives thread-safety by protecting access to shared resources. This usually translates to using the Java synchronized keyword to protect blocks of code that access instance variables, or other shared variables.

For an object to be thread-safe, it must be possible for multiple threads to simultaneously access the same method, or multiple methods, in that object. Usually this is acheived by assuring that each method is thread-safe, but this doesn't always suffice, since methods can call each other in strange ways, leading to deadlock and other weirdness.

It is very difficult to prove that an object is thread-safe. The main rule of thumb for making thread-safe objects is, 'Make all the instance variables private, and all the public accessor methods synchronized.' However, this is sometimes difficult to achieve in practice, due to exigencies of performance, architecture, or implementation.

Accurate multithreaded programming is a true art, and very difficult to master. Read 'Java Threads' by Oaks and Wong, and 'Concurrent Programming in Java' by Lea, for inspiration in your quest to become a thread-safe programmer. "

Monday, June 06, 2005

Java Tip 111: Implement HTTPS tunneling with JSSE

Java Tip 111: Implement HTTPS tunneling with JSSE

siehe auch im Furl

Using RMI over SSL authentication for application-level access control

Using RMI over SSL authentication for application-level access control

Sun provides support for running RMI over SSL in its Java2 platforms using a custom RMISocketFactory. In cases when applications need to provide their own fine-grained access control, it is useful to obtain access to the Java security principal (java.security.Principal) that was SSL authenticated.

The Java2 SSLSocket class provides a getSession() method which can be used to obtain the SSL principal who was authenticated. Unfortunately, by the time the RMI server method is invoked, the socket used to read the remote invocation parameters has been hidden by the RMI implementation.

JGloss-WWW

JGloss-WWW

JGloss-WWW is a Java servlet which proxies web content. Words in a Japanese HTML document are annotated on the fly with their readings and translations. These annotations are shown as pop-ups when the user moves the mouse over a word using JavaScript (currently only Mozilla is supported).