<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>servlet &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/servlet/</link>
	<description>Feed of posts on WordPress.com tagged "servlet"</description>
	<pubDate>Tue, 01 Dec 2009 15:00:55 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[อะไรคือความแตกต่างระหว่าง response.sendRedirect(), RequestDispatcher.forward(), และ PageContext.forward()? ]]></title>
<link>http://kobdesign.wordpress.com/2009/11/26/%e0%b8%ad%e0%b8%b0%e0%b9%84%e0%b8%a3%e0%b8%84%e0%b8%b7%e0%b8%ad%e0%b8%84%e0%b8%a7%e0%b8%b2%e0%b8%a1%e0%b9%81%e0%b8%95%e0%b8%81%e0%b8%95%e0%b9%88%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b0%e0%b8%ab%e0%b8%a7/</link>
<pubDate>Thu, 26 Nov 2009 10:14:03 +0000</pubDate>
<dc:creator>kobdesign</dc:creator>
<guid>http://kobdesign.wordpress.com/2009/11/26/%e0%b8%ad%e0%b8%b0%e0%b9%84%e0%b8%a3%e0%b8%84%e0%b8%b7%e0%b8%ad%e0%b8%84%e0%b8%a7%e0%b8%b2%e0%b8%a1%e0%b9%81%e0%b8%95%e0%b8%81%e0%b8%95%e0%b9%88%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b0%e0%b8%ab%e0%b8%a7/</guid>
<description><![CDATA[ผมเองมักจะลืมว่า เจ้าเมธอดทั้งสามตัวนี้มันต่างกันตรงใหน เขียนผิดเขียนถูกอยู่นั่นแหละ รำคาญตัวเองก็เล]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>ผมเองมักจะลืมว่า เจ้าเมธอดทั้งสามตัวนี้มันต่างกันตรงใหน เขียนผิดเขียนถูกอยู่นั่นแหละ รำคาญตัวเองก็เลยมาเขียนในบล๊อกเอาไว้กันลืม และเผื่อจะมีผู้สนใจร่วมคอมเม้นต์มาแลกเปลี่ยนความรู้ความคิดเห็นกัน</p>
<p>RequestDispatcher.forward() เป็นการทำงานที่อยู่บนเซิร์บเวอร์ แต่ response.sendRedirect() ทำงานอยู่บนบราวเซอร์. เมื่อมีการเรียกใช้งาน RequestDispatcher.forward(), servlet engine จะำทำการ Transfer control ของ HTTP request ที่ได้รับมาตั้งแต่แรกและยังทำงานอยู่ที่ Servlet หรือ ที่ JSP ยังทำการที่ Servlet อื่น. แต่เมื่อทำการเรียกใช้งาน response.sendRedirect() การส่งภาระให้กับบราวเซอร์คืนกลับไปจัดการเอง เหมือนทำให้ท้องแล้วไม่รับผิดชอบยังใงยังงั้น อ๊อบเจ็คต์ Request Response ก็ให้บราวเซอร์ทำการ Route ไปหา Servlet อื่นหรือหน้า JSP อื่นตัวเก่าก็ไม่เหลืออะไร</p>
<p>ส่วน RequestDispatcher.forward() และ PageContext.forward() จะมีหน้าที่เหมือนๆ กันแต่ PageContext.forward() จะเป็น Method Helper ให้กับทาง RequestDispacher.forward() อีกทีหนึ่งนั่นเอง</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[History of Java programming language]]></title>
<link>http://sourcecodejava.wordpress.com/2009/11/23/history-of-java-programming-language/</link>
<pubDate>Mon, 23 Nov 2009 21:16:30 +0000</pubDate>
<dc:creator>thaufan</dc:creator>
<guid>http://sourcecodejava.wordpress.com/2009/11/23/history-of-java-programming-language/</guid>
<description><![CDATA[Java is an object-oriented programming language developed by James Gosling and colleagues at Sun Mic]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:left;"><strong>Java</strong> is an object-oriented programming language developed by James Gosling and colleagues at Sun Microsystems in the early 1990s. Unlike conventional languages which are generally designed either to be compiled to native (machine) code, or to be interpreted from source code at runtime, Java is intended to be compiled to a bytecode, which is then run (generally using JIT compilation) by a Java Virtual Machine.</p>
<p style="text-align:left;">The language itself borrows much syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java is only distantly related to JavaScript, though they have similar names and share a C-like syntax.</p>
<p style="text-align:left;">Java was started as a project called &#8220;Oak&#8221; by James Gosling in June 1991. Gosling&#8217;s goals were to implement a virtual machine and a language that had a familiar C-like notation but with greater uniformity and simplicity than C/C++. The first public implementation was Java 1.0 in 1995. It made the promise of &#8220;Write Once, Run Anywhere&#8221;, with free runtimes on popular platforms. It was fairly secure and its security was configurable, allowing for network and file access to be limited. The major web browsers soon incorporated it into their standard configurations in a secure &#8220;applet&#8221; configuration. popular quickly. New versions for large and small platforms (J2EE and J2ME) soon were designed with the advent of &#8220;Java 2&#8243;. Sun has not announced any plans for a &#8220;Java 3&#8243;.</p>
<p style="text-align:left;">In 1997, Sun approached the ISO/IEC JTC1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process. Java remains a proprietary de facto standard that is controlled through the Java Community Process. Sun makes most of its Java implementations available without charge, with revenue being generated by specialized products such as the Java Enterprise System. Sun distinguishes between its Software Development Kit (SDK) and Runtime Environment (JRE) which is a subset of the SDK, the primary distinction being that in the JRE the compiler is not present.</p>
<p style="text-align:left;"><strong>Philosophy</strong> <ins><ins></ins></ins></p>
<p style="text-align:left;">There were five primary goals in the creation of the Java language:</p>
<p>1. It should use the object-oriented programming methodology.<br />
2. It should allow the same program to be executed on multiple operating systems.<br />
3. It should contain built-in support for using computer networks.<br />
4. It should be designed to execute code from remote sources securely.<br />
5. It should be easy to use by selecting what was considered the good parts of other object-oriented languages.</p>
<p>To achieve the goals of networking support and remote code execution, Java programmers sometimes find it necessary to use extensions such as CORBA, Internet Communications Engine, or OSGi.<!--more--></p>
<p><strong>Object orientation</strong></p>
<p>The first characteristic, object orientation (&#8220;OO&#8221;), refers to a method of programming and language design. Although there are many interpretations of OO, one primary distinguishing idea is to design software so that the various types of data it manipulates are combined together with their relevant operations. Thus, data and code are combined into entities called objects. An object can be thought of as a self-contained bundle of behavior (code) and state (data). The principle is to separate the things that change from the things that stay the same; often, a change to some data structure requires a corresponding change to the code that operates on that data, or vice versa. This separation into coherent objects provides a more stable foundation for a software system&#8217;s design. The intent is to make large software projects easier to manage, thus improving quality and reducing the number of failed projects.</p>
<p>Another primary goal of OO programming is to develop more generic objects so that software can become more reusable between projects. A generic &#8220;customer&#8221; object, for example, should have roughly the same basic set of behaviors between different software projects, especially when these projects overlap on some fundamental level as they often do in large organizations. In this sense, software objects can hopefully be seen more as pluggable components, helping the software industry build projects largely from existing and well-tested pieces, thus leading to a massive reduction in development times. Software reusability has met with mixed practical results, with two main difficulties: the design of truly generic objects is poorly understood, and a methodology for broad communication of reuse opportunities is lacking. Some open source communities want to help ease the reuse problem, by providing authors with ways to disseminate information about generally reusable objects and object libraries.</p>
<p><strong>Platform independence</strong></p>
<p>The second characteristic, platform independence, means that programs written in the Java language must run similarly on diverse hardware. One should be able to write a program once and run it anywhere.</p>
<p>This is achieved by most Java compilers by compiling the Java language code &#8220;halfway&#8221; to bytecode (specifically Java bytecode)—simplified machine instructions specific to the Java platform. The code is then run on a virtual machine (VM), a program written in native code on the host hardware that interprets and executes generic Java bytecode. Further, standardized libraries are provided to allow access to features of the host machines (such as graphics, threading and networking) in unified ways. Note that, although there&#8217;s an explicit compiling stage, at some point, the Java bytecode is interpreted or converted to native machine instructions by the JIT compiler.</p>
<p>There are also implementations of Java compilers that compile to native object code, such as GCJ, removing the intermediate bytecode stage, but the output of these compilers can only be run on a single architecture.</p>
<p>Sun&#8217;s license for Java insists that all implementations be &#8220;compatible&#8221;. This resulted in a legal dispute with Microsoft after Sun claimed that the Microsoft implementation did not support the RMI and JNI interfaces and had added platform-specific features of their own. In response, Microsoft no longer ships Java with Windows, and in recent versions of Windows, Internet Explorer cannot support Java applets without a third-party plug-in. However, Sun and others have  made available Java run-time systems at no cost for those and other versions of Windows.</p>
<p>The first implementations of the language used an interpreted virtual machine to achieve portability. These implementations produced programs that ran more slowly than programs compiled to native executables, for instance written in C or C++, so the language suffered a reputation for poor performance. More recent JVM implementations produce programs that run significantly faster than before, using multiple techniques.</p>
<p>The first technique is to simply compile directly into native code like a more traditional compiler, skipping bytecodes entirely. This achieves good performance, but at the expense of portability. Another technique, known as just-in-time compilation (JIT), translates the Java bytecodes into native code at the time that the program is run which results in a program that executes faster than interpreted code but also incurs compilation overhead during execution. More sophisticated VMs use dynamic recompilation, in which the VM can analyze the behavior of the running program and selectively recompile and optimize critical parts of the program. Dynamic recompilation can achieve optimizations superior to static compilation because the dynamic compiler can base optimizations on knowledge about the runtime environment and the set of loaded classes. JIT compilation and dynamic recompilation allow Java programs to take advantage of the speed of native code without losing portability.</p>
<p>Portability is a technically difficult goal to achieve, and Java&#8217;s success at that goal has been mixed. Although it is indeed possible to write programs for the Java platform that behave consistently across many host platforms, the large number of available platforms with small errors or inconsistencies led some to parody Sun&#8217;s &#8220;Write once, run anywhere&#8221; slogan as &#8220;Write once, debug everywhere&#8221;.</p>
<p>Platform-independent Java is however very successful with server-side applications, such as Web services,  servlets, and Enterprise JavaBeans, as well as with Embedded systems based on OSGi, using Embedded Java environments.</p>
<p><strong>Automatic garbage collection</strong></p>
<p>One idea behind Java&#8217;s automatic memory management model is that programmers should be spared the burden of having to perform manual memory management. In some languages the programmer allocates memory to create any object stored on the heap and is responsible for later manually deallocating that memory to delete any such objects. If a programmer forgets to deallocate memory or writes code that fails to do so in a timely fashion, a memory leak can occur: the program will consume a potentially arbitrarily large amount of memory. In addition, if a region of memory is deallocated twice, the program can become unstable and may crash. Finally, in non garbage collected environments, there is a certain degree of overhead and complexity of user-code to track and finalize allocations.</p>
<p>In Java, this potential problem is avoided by automatic garbage collection. The programmer determines when objects are created, and the Java runtime is responsible for managing the object&#8217;s lifecycle. The program or other objects can reference an object by holding a reference to it (which, from a low-level point of view, is its address on the heap). When no references to an object remain, the Java garbage collector automatically deletes the unreachable object, freeing memory and preventing a memory leak. Memory leaks may still occur if a programmer&#8217;s code holds a reference to an object that is no longer needed—in other words, they can still occur but at higher conceptual levels.</p>
<p>The use of garbage collection in a language can also affect programming paradigms. If, for example, the developer assumes that the cost of memory allocation/recollection is low, they may choose to more freely construct objects instead of pre-initializing, holding and reusing them. With the small cost of potential performance penalties (inner-loop construction of large/complex objects), this facilitates thread-isolation (no need to synchronize as different threads work on different object instances) and data-hiding. The use of transient immutable value-objects minimizes side-effect programming.</p>
<p>Comparing Java and C++, it is possible in C++ to implement similar functionality (for example, a memory management model for specific classes can be designed in C++ to improve speed and lower memory fragmentation considerably), with the possible cost of extra development time and some application complexity. In Java, garbage collection is built-in and virtually invisible to the developer. That is, developers may have no notion of when garbage collection will take place as it may not necessarily correlate with any actions being explicitly performed by the code they write. Depending on intended application, this can be beneficial or disadvantageous: the programmer is freed from performing low-level tasks, but at the same time loses the option of writing lower level code.</p>
<p><strong>Syntax</strong></p>
<p>The syntax of Java is largely derived from C++. However, unlike C++, which combines the syntax for structured, generic, and  object-oriented programming, Java was built from the ground up to be virtually fully object-oriented: everything in Java is an object with the exceptions of atomic datatypes (ordinal and real numbers, boolean values, and characters) and everything in Java is written inside a class.</p>
<p><strong>Applet</strong></p>
<p>Java applets are programs that are embedded in other applications, typically in a Web page displayed in a Web browser.</p>
<p>// Hello.java<br />
import java.applet.Applet;<br />
import java.awt.Graphics;</p>
<p>public class Hello extends Applet {<br />
public void paint(Graphics gc) {<br />
gc.drawString(&#8220;Hello, world!&#8221;, 65, 95);<br />
}<br />
}</p>
<p>This applet will simply draw the string &#8220;Hello, world!&#8221; in the rectangle within which the applet will run. This is a slightly better example of using Java&#8217;s OO features in that the class explicitly extends the basic &#8220;Applet&#8221; class, that it overrides the &#8220;paint&#8221; method and that it uses import statements.</p>
<p>&#60;!&#8211; Hello.html &#8211;&#62;<br />
&#60;html&#62;<br />
&#60;head&#62;<br />
&#60;title&#62;Hello World Applet&#60;/title&#62;<br />
&#60;/head&#62;<br />
&#60;body&#62;<br />
&#60;applet code=&#8221;Hello&#8221; width=&#8221;200&#8243; height=&#8221;200&#8243;&#62;<br />
&#60;/applet&#62;<br />
&#60;/body&#62;<br />
&#60;/html&#62;</p>
<p>An applet is placed in an HTML document using the &#60;applet&#62; HTML element. The applet tag has three attributes set: code=&#8221;Hello&#8221; specifies the name of the Applet class and width=&#8221;200&#8243; height=&#8221;200&#8243; sets the pixel width and height of the applet. (Applets may also be embedded in HTML using either the object or embed element, although support for these elements by Web browsers is inconsistent.</p>
<p><strong>Servlet</strong></p>
<p>Java servlets are server-side Java EE components that generate responses to requests from clients.</p>
<p>// Hello.java<br />
import java.io.*;<br />
import javax.servlet.*;</p>
<p>public class Hello extends GenericServlet {<br />
public void service(ServletRequest request, ServletResponse response)<br />
throws ServletException, IOException<br />
{<br />
response.setContentType(&#8220;text/html&#8221;);<br />
PrintWriter pw = response.getWriter();<br />
pw.println(&#8220;Hello, world!&#8221;);<br />
pw.close();<br />
}<br />
}</p>
<p>The import statements direct the Java compiler to include all of the public classes and interfaces from the java.io and javax.servlet packages in the compilation. The Hello class extends the GenericServlet class; the GenericServlet class provides the interface for the server to forward requests to the servlet and control the servlet&#8217;s lifecycle.</p>
<p>The Hello class overrides the service(ServletRequest, ServletResponse) method defined by the Servlet interface to provide the code for the service request handler. The service() method is passed a ServletRequest object that contains the request from the client and a ServletResponse object used to create the response returned to the client. The service() method declares that it throws the exceptions ServletException and IOException if a problem prevents it from responding to the request.</p>
<p>The setContentType(String) method in the response object is called to set the MIME content type of the returned data to &#8220;text/html&#8221;. The getWriter() method in the response returns a PrintWriter object that is used to write the data that is sent to the client. The println(String) method is called to write the &#8220;Hello, world!&#8221; string to the response and then the close() method is called to close the print writer, which causes the data that has been written to the stream to be returned to the client.</p>
<p><strong>Swing application</strong></p>
<p>Swing is the advanced graphical user interface library for the Java SE platform.</p>
<p>// Hello.java<br />
import javax.swing.*;</p>
<p>public class Hello extends JFrame {<br />
Hello() {<br />
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);<br />
add(new JLabel(&#8220;Hello, world!&#8221;));<br />
pack();<br />
}</p>
<p>public static void main(String[] args) {<br />
new Hello().setVisible(true);<br />
}<br />
}</p>
<p>The import statement directs the Java compiler to include all of the public classes and interfaces from the javax.swing package in the compilation. The Hello class extends the JFrame class; the JFrame class implements a window with a title bar with a close control.</p>
<p>The Hello() constructor initializes the frame by first calling the setDefaultCloseOperation(int) method inherited from JFrame to set the default operation when the close control on the title bar is selected to WindowConstants.DISPOSE_ON_CLOSE—this causes the JFrame to be disposed of when the frame is closed (as opposed to merely hidden), which allows the JVM to exit and the program to terminate. Next a new JLabel is created for the string &#8220;Hello, world!&#8221; and the add(Component) method inherited from the Container superclass is called to add the label to the frame. The pack() method inherited from the Window superclass is called to size the window and layout its contents.</p>
<p>The main() method is called by the JVM when the program starts. It instantiates a new Hello frame and causes it to be displayed by calling the setVisible(boolean) method inherited from the Component superclass with the boolean parameter true. Note that once the frame is displayed, exiting the main method does not cause the program to terminate because the AWT event dispatching thread remains active until all of the Swing top-level windows have been disposed.</p>
<p><strong>Look and feel</strong></p>
<p>The default look and feel of GUI applications written in Java using the  Swing toolkit is very different from native applications. It is possible to specify a different look and feel through the pluggable look and feel system of Swing. Clones of Windows, GTK and Motif are supplied by Sun. Apple also provides an Aqua look and feel for Mac OS X. Though prior implementations of these look and feels have been considered lacking, Swing in Java SE 6 addresses this problem by using more native widget drawing routines of the underlying platforms. Alternatively, third party toolkits such as wx4j or SWT may be used for increased integration with the native windowing system.</p>
<p><strong>Lack of OO purity and facilities</strong></p>
<p>Java&#8217;s primitive types are not objects. Primitive types hold their values in the stack rather than being references to values. This was a conscious decision by Java&#8217;s designers for performance reasons. Because of this, Java is not considered to be a pure object-oriented programming language. However, as of Java 5.0, autoboxing enables programmers to write as if primitive types are their wrapper classes, and freely interchange between them for improved flexibility. Java designers decided not to implement certain features present in other OO languages, including:</p>
<p>* multiple inheritance<br />
* operator overloading<br />
* class properties<br />
* tuples</p>
<p><strong>Java Runtime Environment</strong></p>
<p>The Java Runtime Environment or JRE is the software required to run any application deployed on the Java Platform. End-users commonly use a JRE in software packages and Web browser plugins. Sun also distributes a superset of the JRE called the Java 2 SDK (more commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc, and debugger.</p>
<p style="text-align:left;"><span style="font-size:xx-small;">Above article originally from wikipedia.org. Above article is available under GNU Free Documentation License.</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[LSNED 16: Finding the name of a servlet from a library that it uses]]></title>
<link>http://yaytay.wordpress.com/2009/11/19/lsned-16-finding-the-name-of-a-servlet-from-a-library-that-it-uses/</link>
<pubDate>Thu, 19 Nov 2009 06:02:18 +0000</pubDate>
<dc:creator>yaytay</dc:creator>
<guid>http://yaytay.wordpress.com/2009/11/19/lsned-16-finding-the-name-of-a-servlet-from-a-library-that-it-uses/</guid>
<description><![CDATA[I have a class that performs logging for a servlet. This class is wrapped up inside a jar and is use]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have a class that performs logging for a servlet.<br />
This class is wrapped up inside a jar and is used in a number of unrelated wars that are deployed in the same tomcat instance.<br />
In order to log useful information the class in the jar file needs to know something that it is human-understandable and unique for the servlet in which is it deployed.</p>
<p>This has been bothering me for a couple of weeks, but I&#8217;ve just worked out how to do it:</p>
<pre class="brush: java;">
public class ConfigReporter implements ApplicationListener
{
    private String artifactName;

    @Override
    public void onApplicationEvent( ApplicationEvent event )
    {
        if( event instanceof ContextRefreshedEvent )
        {
            ContextRefreshedEvent refreshEvent = (ContextRefreshedEvent)event;
            this.artifactName = &#34;Unknown&#34;;
            if( refreshEvent.getApplicationContext() instanceof WebApplicationContext )
            {
                WebApplicationContext webCtx = (WebApplicationContext)refreshEvent.getApplicationContext();
                this.artifactName = webCtx.getServletContext().getContextPath();
            }
            startup();
        }
        else if( event instanceof ContextClosedEvent )
        {
            shutdown();
        }
    }
</pre>
<p>The startup method does the actual logging, but it&#8217;s the context path from the web servlet context that is the good stuff.<br />
On tomcat this gives the same name that the tomcat manager servlet uses in its list of apps.<br />
The technique should work with any servlet container, but results will vary (i.e. the name given by jetty is not the same as the name given by tomcat).</p>
<p>Clearly this is dependent upon the war file, but if the user deviates from the standard (maven) naming structure then they should still recognise their alternative name in my list.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Do you know JFastCGI ?]]></title>
<link>http://jrialland.wordpress.com/2009/11/10/do-you-know-jfastcgi/</link>
<pubDate>Tue, 10 Nov 2009 12:56:38 +0000</pubDate>
<dc:creator>jrialland</dc:creator>
<guid>http://jrialland.wordpress.com/2009/11/10/do-you-know-jfastcgi/</guid>
<description><![CDATA[JFastCGI est un projet sous licence BSD démarré il y a quelques mois maintenant. Le but est de perme]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://sourceforge.net/projects/jfastcgi">JFastCGI</a> est un projet sous licence BSD démarré il y a quelques mois maintenant. Le but est de permettre a un container de servlet (type tomcat ou jetty) de servir des pages générées par une application compatible <a href="http://www.fastcgi.com">fastCGI</a>.</p>
<p>Cela permet par exemple de servir des pages PHP interprétées par le moteur PHP officiel sans avoir a utiliser un serveur apache.</p>
<p>La version 1.1 est &#8220;en prod&#8221;, et la version 2.0, qui introduit la notion de pool de connexion entre une application tomcat et plusieurs &#8220;serveurs&#8221; fastcgi est en cours de tests (j&#8217;en ai profité pour créer un ensemble de tests unitaires, utilisant <a href="http://mockrunner.sourceforge.net/">mockrunner</a>). Elle permettra un énorme gain de performance pour les applications fortement sollicitées !</p>
<p>La version 2.0 ajoute aussi une meilleur intégration avec Spring, en implémentant <a href="http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/web/HttpRequestHandler.html">HttpRequestHandler</a>.</p>
<p>&#160;</p>
<p>Des contacts ont même étés pris avec l&#8217;équipe de développement de <a href="https://glassfish.dev.java.net/">Glassfish</a>, dont jfastcgi pourrait devenir un module optionnel de la version 3 &#8230;</p>
<p>Bref, cette librairie semble promise a un bel avenir, et permet d&#8217;utiliser les serveurs en java de manière moins &#8220;fermée&#8221; mais ce projet demande à gagner en maturité, <strong>votre aide est la bienvenue !</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Avoid multiple per-user sessions in Tomcat without using tomcat api]]></title>
<link>http://bihag.wordpress.com/2009/11/03/avoid-multiple-per-user-sessions-in-tomcat/</link>
<pubDate>Tue, 03 Nov 2009 13:34:22 +0000</pubDate>
<dc:creator>bihag</dc:creator>
<guid>http://bihag.wordpress.com/2009/11/03/avoid-multiple-per-user-sessions-in-tomcat/</guid>
<description><![CDATA[In typical web application user with a registered account can do two different logins from two diffe]]></description>
<content:encoded><![CDATA[In typical web application user with a registered account can do two different logins from two diffe]]></content:encoded>
</item>
<item>
<title><![CDATA[BIRT - Establecer el valor de un parametro(desde un servlet)]]></title>
<link>http://cirovladimir.wordpress.com/2009/10/22/birt-establecer-el-valor-de-un-parametrodesde-un-servlet/</link>
<pubDate>Thu, 22 Oct 2009 20:15:05 +0000</pubDate>
<dc:creator>cirovladimir</dc:creator>
<guid>http://cirovladimir.wordpress.com/2009/10/22/birt-establecer-el-valor-de-un-parametrodesde-un-servlet/</guid>
<description><![CDATA[Con la ayuda de este ejemplo(bueno, el de la version 2.5 que aparece en los comentarios), pude crear]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img class="alignnone size-full wp-image-298" title="extendingBirtBook" src="http://cirovladimir.wordpress.com/files/2009/10/extendingbirtbook.png" alt="extendingBirtBook" width="153" height="202" /></p>
<p>Con la ayuda de <a href="http://wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1#Comments" target="_blank">este ejemplo</a>(bueno, el de la version 2.5 que aparece en los comentarios), pude crear un servlet que ejecuta y despliega un reporte de <a href="http://www.eclipse.org/birt/phoenix/" target="_blank">BIRT</a>.<br />
Para establecer el valor de un parámetro desde este servlet, a través del <a href="http://www.birt-exchange.org/modules/documentation/#currentdocs" target="_blank">Report Engine API</a>, hay que utilizar la interfaz <a href="http://www.birt-exchange.org/documentation/BIRT_231/EngineJavadoc/engine/api/index.html" target="_blank">IRunAndRenderTask</a> (no he visto si se puede con alguna otra).<br />
Lo primero es obtener una referencia a esta interfaz mediante:</p>
<blockquote><p>IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design );</p></blockquote>
<p>y luego simplemente utilizar el método setParameterValue de la siguiente forma:</p>
<blockquote><p>task.setParameterValue(&#8220;Name&#8221;, &#8220;Value&#8221;);</p></blockquote>
<p>Fuente:<br />
<a href="http://www.theserverside.com/tt/articles/article.tss?l=IntegratingBIRTwithPHP" target="_blank">Integrating BIRT with PHP</a></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=f91a45d8-d8e6-8817-a0b2-901920ba8728" alt="" /></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Read parameters from web.xml]]></title>
<link>http://sbuki.wordpress.com/2009/10/21/read-parameters-from-web-xml/</link>
<pubDate>Wed, 21 Oct 2009 07:23:33 +0000</pubDate>
<dc:creator>sbuki</dc:creator>
<guid>http://sbuki.wordpress.com/2009/10/21/read-parameters-from-web-xml/</guid>
<description><![CDATA[добавить в web.xml: &lt;context-param&gt; &lt;param-name&gt;managerData&lt;/param-name&gt; &lt;param]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>добавить в web.xml:<br />
<code><br />
</code>&#60;context-param&#62;<br />
&#60;param-name&#62;managerData&#60;/param-name&#62;<br />
&#60;param-value&#62;http://localhost/managerData&#60;/param-value&#62;<br />
&#60;/context-param&#62;<code><br />
</code></p>
<p>читаем из jsp:<br />
${initParam.managerData}</p>
<p>читаем из servlet&#8217;а:<br />
getServletContext().getInitParameter(&#8220;managerData&#8221;);</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Check in Java web app if user is logged in in Rails web app]]></title>
<link>http://kr3l.wordpress.com/2009/10/20/check-in-java-web-app-if-user-is-logged-in-in-rails-web-app/</link>
<pubDate>Tue, 20 Oct 2009 11:56:29 +0000</pubDate>
<dc:creator>Karel</dc:creator>
<guid>http://kr3l.wordpress.com/2009/10/20/check-in-java-web-app-if-user-is-logged-in-in-rails-web-app/</guid>
<description><![CDATA[I have a Rails application where users can log in and do stuff. For one of the actions a user can pe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have a Rails application where users can log in and do stuff. For one of the actions a user can perform, I actually use a Java web application integrated in the Rails application. Because I don&#8217;t want a malicious user that is not logged in to the application to surf directly to the Java application, I need a system where my Java application is only accessible for users logged in to the Rails application. I used a Servlet Filter that contacts the Rails application in the background and asks if the user is logged in. Only then is the user allowed to proceed.</p>
<p>First I built an a controller in Rails with an action that checks if the user is logged in. In my application this is available at the url localhost:3000/session/check.</p>
<p><span style="font-family:'Times New Roman';line-height:normal;font-size:small;"> </span></p>
<div style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:#ffffff;font:normal normal normal 13px/19px Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;background-position:initial initial;margin:0;padding:.6em;">
<div>
<div>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">class</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:blue;">SessionController</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">&#60;</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">ApplicationController</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">def</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#007f7f;">check</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">if</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">session<strong>[</strong></span><span style="font-size:12pt;font-family:'Courier New';color:#7f007f;">'user'</span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">].</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">nil?</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">logged_in</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">false</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">else</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">logged_in</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">true</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">end</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">render</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#c0a030;">:text</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">=&#62;</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:black;">logged_in<strong>.</strong>to_s</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">#just write true or false to the output</span><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">end</span></strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p class="MsoNormal" style="margin-bottom:.0001pt;line-height:normal;"><strong><span style="font-size:13pt;font-family:Verdana, sans-serif;color:#00007f;">end</span></strong></p>
</div>
</div>
</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">package be.vrt.medialab.filters;</div>
<p>Now I want my Java web application to first request the Rails session check and when it returns false it should redirect to the login page instead of serving the Java servlets.  I used a Java servlet filter for this job. I created the filter in a separate project, here is the source code: <span style="font-family:'Times New Roman';line-height:normal;white-space:normal;font-size:small;"> </span></p>
<div style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:#ffffff;font:normal normal normal 13px/19px Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;background-position:initial initial;margin:0;padding:.6em;"><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">package</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">be<strong>.</strong>vrt<strong>.</strong>medialab<strong>.</strong>filters<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>io<strong>.</strong>BufferedReader<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>io<strong>.</strong>IOException<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>io<strong>.</strong>InputStream<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>io<strong>.</strong>InputStreamReader<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>net<strong>.</strong>MalformedURLException<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>util<strong>.</strong>ResourceBundle<strong>;</strong></span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>Filter<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>FilterChain<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>FilterConfig<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>ServletContext<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>ServletException<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>ServletRequest<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>ServletResponse<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>http<strong>.</strong>Cookie<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>http<strong>.</strong>HttpServletRequest<strong>;</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">public</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">class</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">RailsAuthentication</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">implements</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">Filter</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">FilterConfig</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">filterConfig</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">null</span></strong><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">;</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">private</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ResourceBundle</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">resources<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">public</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">RailsAuthentication<strong>()</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">resources</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ResourceBundle<strong>.</strong>getBundle<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;config&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">public</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">boolean</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">getRailsResponse<strong>(</strong>String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">urlString<strong>,</strong>String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">cookie<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// Open a URL connection.</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>net<strong>.</strong>URL</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">url<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">try</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">System<strong>.</strong>out<strong>.</strong>println<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;urlString=&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">+</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">urlString<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">url</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">new</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>net<strong>.</strong>URL<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">urlString</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">final</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>net<strong>.</strong>URLConnection</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">uconn</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">url<strong>.</strong>openConnection<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">if</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">!(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">uconn</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">instanceof</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>net<strong>.</strong>HttpURLConnection<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">)</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">throw</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">new</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>lang<strong>.</strong>IllegalArgumentException<strong>(</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;URL protocol must be HTTP.&#8221;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">final</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>net<strong>.</strong>HttpURLConnection</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>net<strong>.</strong>HttpURLConnection<strong>)</strong>uconn<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// Set up a request.</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>setConnectTimeout<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#007f7f;">10000</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// 10 sec</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>setReadTimeout<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#007f7f;">10000</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// 10 sec</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>setInstanceFollowRedirects<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">true</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>setRequestProperty<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;User-agent&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">,</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;spider&#8221;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>setRequestProperty<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;Cookie&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">,</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;_ifip_rails_session=&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">+</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">cookie<strong>+</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;;&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// Send the request.</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>connect<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">BufferedReader</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">in</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">new</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">BufferedReader<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">new</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">InputStreamReader<strong>((</strong>InputStream<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>getContent<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">)));</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">inputLine<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">inputLine</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">in<strong>.</strong>readLine<strong>();</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// Process each line.</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">System<strong>.</strong>out<strong>.</strong>println<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;rails returned: &#8220;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">+</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">inputLine<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">conn<strong>.</strong>disconnect<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">if</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">inputLine<strong>.</strong>equals<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;true&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">))</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">//authentication successful: user is logged in</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">System<strong>.</strong>out<strong>.</strong>println<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;authentication successful!&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">return</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">true<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">else</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">//authentication failed: user is not logged in</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">System<strong>.</strong>out<strong>.</strong>println<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;authentication failed!&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">return</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">false<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">catch</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">Exception</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">e<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">e<strong>.</strong>printStackTrace<strong>();</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">return</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">false<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">public</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">void</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">doFilter<strong>(</strong>ServletRequest</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">req<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ServletResponse</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">response<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">FilterChain</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">chain<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">throws</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">IOException<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ServletException</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">railsCheck</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">resources<strong>.</strong>getString<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;RailsCheck&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">invalidUrl<strong>=</strong>resources<strong>.</strong>getString<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;InvalidUrl&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">HttpServletRequest</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">request</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">HttpServletRequest<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">req<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">Cookie<strong>[]</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">cookies</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">request<strong>.</strong>getCookies<strong>();</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">rails_session_id</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">null</span></strong><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">;</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">for</span></strong><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">int</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">i<strong>=</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#007f7f;">0</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">;</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">i<strong>&#60;</strong>cookies<strong>.</strong>length<strong>;</strong>i<strong>++)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">Cookie</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">cookie</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">cookies<strong>[</strong>i<strong>];</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">if</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">cookie<strong>.</strong>getName<strong>().</strong>equals<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;_ifip_rails_session&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">))</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">rails_session_id</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">cookie<strong>.</strong>getValue<strong>();</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">if</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">rails_session_id</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">==</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">null</span></strong><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">)</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">//authentication fails</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">System<strong>.</strong>out<strong>.</strong>println<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;Autentication fails, no rails session id!&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">else</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">System<strong>.</strong>out<strong>.</strong>println<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;Rails session id is &#8220;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">+</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">rails_session_id<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">//query rails app if this session id is from a logged in user</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">boolean</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">valid_user</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">getRailsResponse<strong>(</strong>railsCheck<strong>,</strong>rails_session_id<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">if</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">(</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">valid_user<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// pass the request along the filter chain</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">chain<strong>.</strong>doFilter<strong>(</strong>request<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">response<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">else</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">System<strong>.</strong>out<strong>.</strong>println<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;valid_user=&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">+</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">valid_user<strong>+</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;, redirecting to /RedirectServlet&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ServletContext</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">context</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">filterConfig<strong>.</strong>getServletContext<strong>();</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">context<strong>.</strong>getRequestDispatcher<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;/RedirectServlet&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">).</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">forward<strong>(</strong>request<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">response<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">public</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">void</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">init<strong>(</strong>FilterConfig</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">fConfig<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">throws</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ServletException</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:9pt;font-family:'Comic Sans MS';color:#007f00;">// TODO Auto-generated method stub</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">filterConfig</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">fConfig<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-family:Verdana, sans-serif;"><strong><br />
</strong></span></p>
<p><span style="font-family:Verdana, sans-serif;">I couldn&#8217;t find how to redirect to an external URL directly from within the servlet filter, so I just forwarded to a second servlet that has the sole job of redirecting to a certain URL (the login page):</span></p>
<p><span style="font-family:Verdana, sans-serif;"><strong></strong></span><br />
<span style="font-family:Verdana, sans-serif;"><strong></strong></span></p>
<p><strong></p>
<div style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:#ffffff;font:normal normal normal 13px/19px Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;background-position:initial initial;margin:0;padding:.6em;"><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">package</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">be<strong>.</strong>vrt<strong>.</strong>medialab<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>io<strong>.</strong>IOException<strong>;</strong></span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">java<strong>.</strong>util<strong>.</strong>ResourceBundle<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>ServletException<strong>;</strong></span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>http<strong>.</strong>HttpServlet<strong>;</strong></span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>http<strong>.</strong>HttpServletRequest<strong>;</strong></span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">import</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">javax<strong>.</strong>servlet<strong>.</strong>http<strong>.</strong>HttpServletResponse<strong>;</strong></span></p>
<p><span style="font-family:Verdana, sans-serif;color:#808080;"><br />
</span></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">public</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">class</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">RedirectServlet</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">extends</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">HttpServlet</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">private</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">static</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">final</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">long</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">serialVersionUID</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#007f7f;">1L</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">;</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">private</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ResourceBundle</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">resources<strong>;</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">public</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">RedirectServlet<strong>()</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">super</span></strong><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">();</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">resources</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">=</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ResourceBundle<strong>.</strong>getBundle<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;config&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">protected</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">void</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">doGet<strong>(</strong>HttpServletRequest</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">request<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">HttpServletResponse</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">response<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">throws</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ServletException<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">IOException</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">invalidUrl<strong>=</strong>resources<strong>.</strong>getString<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;InvalidUrl&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">response<strong>.</strong>sendRedirect<strong>(</strong>invalidUrl<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><span style="font-family:Verdana, sans-serif;color:#808080;"><br />
</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">protected</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">void</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">doPost<strong>(</strong>HttpServletRequest</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">request<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">HttpServletResponse</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">response<strong>)</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#00007f;">throws</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">ServletException<strong>,</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">IOException</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">{</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">String</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">invalidUrl<strong>=</strong>resources<strong>.</strong>getString<strong>(</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;InvalidUrl&#8221;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">);</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">response<strong>.</strong>sendRedirect<strong>(</strong>invalidUrl<strong>);</strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:gray;"> </span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
<p><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:black;">}</span></strong></p>
</div>
<p></strong></p>
</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">import java.io.BufferedReader;</div>
<p>Now the only thing we have to do is place the classes in our web application and change the web.xml as follows:</p>
<div style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:#ffffff;font:normal normal normal 13px/19px Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;background-position:initial initial;margin:0;padding:.6em;"><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">&#60;?</span></strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">xml</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">version</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;1.0&#8243;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">encoding</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;UTF-8&#8243;</span><strong><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">?&#62;</span></strong></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;web-app</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">xmlns:xsi</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;http://www.w3.org/2001/XMLSchema-instance&#8221;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">xmlns</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;http://java.sun.com/xml/ns/javaee&#8221;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">xmlns:web</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#8221;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">xsi:schemaLocation</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#8221;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">id</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;WebApp_ID&#8221;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:teal;">version</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:purple;">=</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:#7f007f;">&#8220;2.5&#8243;</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;display-name&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">IfipUploader</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/display-name&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;welcome-file-list&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;welcome-file&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">TestPage.html</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/welcome-file&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;welcome-file&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">FormUpload.html</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/welcome-file&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;welcome-file&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">index.jsp</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/welcome-file&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;welcome-file&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">default.html</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/welcome-file&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;welcome-file&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">default.htm</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/welcome-file&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;welcome-file&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">default.jsp</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/welcome-file&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/welcome-file-list&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> <strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;filter&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;filter-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>Rails Authentication</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/filter-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;filter-class&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>be.vrt.medialab.filters.RailsAuthentication</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/filter-class&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/filter&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;filter-mapping&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;filter-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>Rails Authentication</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/filter-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;url-pattern&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>/*</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/url-pattern&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/filter-mapping&#62;</strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;servlet&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;servlet-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>RedirectServlet</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/servlet-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;display-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>RedirectServlet</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/display-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;description&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>redirects to InvalidUrl</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/description&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;servlet-class&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>be.vrt.medialab.RedirectServlet</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/servlet-class&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/servlet&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;servlet-mapping&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;servlet-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>RedirectServlet</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/servlet-name&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;url-pattern&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong>/RedirectServlet</strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/url-pattern&#62;</strong></span><span style="font-family:'Times New Roman', serif;color:black;"><strong></strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"><strong> </strong></span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;"><strong>&#60;/servlet-mapping&#62;</strong></span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;servlet&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;description&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">Extension of abstract class UploadServlet</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/description&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;display-name&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">UploadServletWithQueue</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/display-name&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;servlet-name&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">UploadServletWithQueue</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/servlet-name&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;servlet-class&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">be.vrt.medialab.upload.UploadServletWithQueue</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/servlet-class&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/servlet&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;servlet-mapping&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;servlet-name&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">UploadServletWithQueue</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/servlet-name&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;url-pattern&#62;</span><span style="font-family:'Times New Roman', serif;color:black;">/UploadServletWithQueue</span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/url-pattern&#62;</span></p>
<p><span style="font-family:'Times New Roman', serif;color:black;"> </span><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/servlet-mapping&#62;</span></p>
<p><span style="font-size:10pt;font-family:Verdana, sans-serif;color:navy;">&#60;/web-app&#62;</span></p>
</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">import java.io.IOException;</div>
<p>Below are two logs from the Java web application:</p>
<p><strong>Logged out: </strong>(the Rails session id is from a previous session and thus invalid)</p>
<pre>Rails session id is BAh7CToQX2NzcmZfdG9rZW4iMVUyeFJWWWVzc1hUZFNPRDR2dkFUb3lONVFaQlJrVmsxR1h0VzVaS3RmUFU9Og9zZXNzaW9uX2lkIiUyOTg2NDc2NzY0N2RlMGU1OWExMTFiOTUwMTk0Zjg2MCIQaW5pdGlhbF91cmkiDS9tYW1taWUvIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--41ae001042b16ee26966fc931d11719bc51d7b71
urlString=http://media.ibbt.be/mammie/session/check
rails returned: false
authentication failed!
valid_user=false, redirecting to /RedirectServlet</pre>
<p><strong>Logged in:</strong></p>
<pre>Rails session id is BAh7CiIJdXNlcm86CVVzZXIHOhZAYXR0cmlidXRlc19jYWNoZXsAOhBAYXR0cmlidXRlc3sdIg5qb2JfdGl0bGUiF1NpdGUgQWRtaW5pc3RyYXRvciIRb2ZmaWNlX3Bob25lMCIPdXBkYXRlZF9hdCIYMjAwOS0xMC0wOCAxMTo1OToxNiIKdGl0bGUiF3NpdGUgYWRtaW5pc3RyYXRvciIYb3JnYW5pc2F0aW9uX3JlZ2lvbjAiDXVzZXJuYW1lIgphZG1pbiIMY291bnRyeSIHQkUiGW9yZ2FuaXNhdGlvbl9hZGRyZXNzMCIHaWQiBjEiHG9yZ2FuaXNhdGlvbl9kZXBhcnRtZW50MCIWb3JnYW5pc2F0aW9uX2NpdHkwIhRhc3Npc3RhbnRfcGhvbmUwIg9maXJzdF9uYW1lIgphZG1pbiITaGFzaGVkX3Bhc3dvcmQiLWI0NzIwODY3MGU2YmU1ODdhNjE1YTcwZDMzZGRkYmVkNmNhMGNiZjAiD29mZmljZV9mYXgwIhFvcmdhbmlzYXRpb24wIg5sYXN0X25hbWUiFnRoZSBhZG1pbmlzdHJhdG9yIhBhZmZpbGlhdGlvbjAiFm9yZ2FuaXNhdGlvbl90eXBlMCIPY3JlYXRlZF9hdCIYMjAwOS0xMC0wOCAxMTo1OToxNiIKZW1haWwiHmthcmVsLmJyYWVja21hbkBnbWFpbC5jb20iEW1vYmlsZV9waG9uZTAiHW9yZ2FuaXNhdGlvbl9wb3N0YWxfY29kZTAiGW9yZ2FuaXNhdGlvbl9jb3VudHJ5MDoPc2Vzc2lvbl9pZCIlMjk4NjQ3Njc2NDdkZTBlNTlhMTExYjk1MDE5NGY4NjA6EF9jc3JmX3Rva2VuIjFVMnhSVlllc3NYVGRTT0Q0dnZBVG95TjVRWkJSa1ZrMUdYdFc1Wkt0ZlBVPSIQaW5pdGlhbF91cmkiDS9tYW1taWUvIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--9857ba6780010c041df44eabbfa5f3943ecbe218
urlString=http://media.ibbt.be/mammie/session/check
rails returned: true
authentication successful!</pre>
<pre><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="line-height:19px;white-space:normal;"><span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;font-size:small;"><span style="line-height:18px;white-space:pre;">
</span></span></span></span></pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Oracle Application Server 10.1.3.5 - Dependency Injection]]></title>
<link>http://jpaandejb.wordpress.com/2009/10/19/oracle-application-server-10-1-3-5-dependency-injection/</link>
<pubDate>Mon, 19 Oct 2009 06:08:10 +0000</pubDate>
<dc:creator>bovinemagnet</dc:creator>
<guid>http://jpaandejb.wordpress.com/2009/10/19/oracle-application-server-10-1-3-5-dependency-injection/</guid>
<description><![CDATA[One of the cool things about EJB&#8217;s is the fact that you no longer need to do certain things, l]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>One of the cool things about EJB&#8217;s is the fact that you no longer need to do certain things, like go to the JNDI context, and search for your EJB.  You can let the @EJB tag do it for you (for example).</p>
<p>Writing a simple application to talk to a local EJB should be as simple as</p>
<pre class="brush: java;">
@EJB
 private SimpleStatelessEJBLocal simpleStateless;
 ...
 simpleStateless.someLocalMethod();
 ...
</pre>
<p>But what I found was a null pointer exception.<br />
So taking the application down to the simplest app.</p>
<ul>
<li>One servlet.</li>
<li>One statless session bean.</li>
<li>Using Jdeveloper 10.1.3.5 (I can&#8217;t use 11g as I need oc4j 10.1.3.5, I know I can get around it.. more on that later)</li>
<li>One local OC4J 10.1.3.5 instance.</li>
</ul>
<p>Deploying this application and after much playing around, the null pointer was gone, and this error remained.</p>
<pre class="brush: java;">

[Oracle Containers for J2EE 10g (10.1.3.5.0) ]

9/10/19 16:52:14.779 SimpleTwoWEB: Servlet error
java.lang.ClassCastException: com.evermind.server.ejb.StatelessSessionDefaultLocalHomeImpl cannot be cast to au.edu.rmit.its.qas.ejb.SimpleStatelessEJBLocal
</pre>
<p>This puzzled me for an hour or so, but through an obscure post on <a title="coderanch" href="http://www.coderanch.com/t/455629/EJB-Certification-SCBCD/certification/EJB-DI-JSP" target="_blank">coderanch</a> I found the problem.  It seems that JDeveloper 10.1.3.x creates web projects in web 2.4 compliance, but in order to run DI you need to run web container version 2.5.  Testing this out, I changed the web.xml from this:</p>
<pre class="brush: xml;">

&#60;web-app xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34; xsi:schemaLocation=&#34;http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd&#34; version=&#34;2.4&#34; xmlns=&#34;http://java.sun.com/xml/ns/j2ee&#34;&#62;
</pre>
<p>changing to&#8230;</p>
<pre class="brush: xml;">

&#60;web-app xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34; xmlns=&#34;http://java.sun.com/xml/ns/javaee&#34;   xmlns:web=&#34;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#34;  xsi:schemaLocation=&#34;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#34;  id=&#34;WebApp_ID&#34; version=&#34;2.5&#34;&#62;
</pre>
<p>And like magic is worked.</p>
<p>Now according to two OTN Discussions:</p>
<p><em>If you have a look at the J2EE 5 spec, the classes where DI is supported are listed on page 64.</p>
<p><strong>Component classes supporting injection</strong><br />
Servlet: servlets, servlet filters, event listeners<br />
JSP: tag handlers, tag library event listeners<br />
JSF: scoped managed beans<br />
JAX-WS: service endpoints, handlers<br />
EJB: beans, interceptors<br />
Java EE platform: main class (static), login callback handler</em></p>
<p><a title="OTN Link 1" href="http://forums.oracle.com/forums/thread.jspa?threadID=434481" target="_blank"><em>OTN  Link 1</em></a></p>
<p><em><a title="OTN Link 2" href="http://forums.oracle.com/forums/thread.jspa?threadID=447310" target="_blank">OTN Link 2</a><br />
</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA['Java Servlets &amp; JSP' Book Review]]></title>
<link>http://denverjug.wordpress.com/2009/10/15/java-servlets-jsp-book-review/</link>
<pubDate>Thu, 15 Oct 2009 14:50:24 +0000</pubDate>
<dc:creator>demian0311</dc:creator>
<guid>http://denverjug.wordpress.com/2009/10/15/java-servlets-jsp-book-review/</guid>
<description><![CDATA[Review of Java Servlets and JSP by David Madouros I’m torn after reading Murach’s Java Servlets ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img class="alignright size-full wp-image-21" title="murach_cover" src="http://denverjug.wordpress.com/files/2009/10/murach_cover.jpg" alt="murach_cover" width="160" height="200" /></p>
<p>Review of <a href="http://www.amazon.com/Murachs-Java-Servlets-Andrea-Steelman/dp/1890774189">Java Servlets and JSP</a> by <a href="http://www.linkedin.com/pub/david-madouros/8/b93/a8b">David Madouros</a></p>
<p>I’m torn after reading Murach’s Java Servlets &#38; JSP book, 2nd Ed. I read the first version when I was making the transition from mainframe programming to Java programming and found the information to be extremely helpful for getting up and running very quickly. With the authors’ assistance I had a database server, a servlet container, and a ‘hello world’ web app running within a couple of hours. On the other hand, reading the second edition as an experienced Java developer made me cringe. Ultimately, I have to side with the my experienced side. Especially when I consider how well the format of Murach books tends to make them canonical references and how easy it would have been for the authors to teach better practices.</p>
<p>The cover of the book makes at least three claims:</p>
<ul>
<li>Get off to a quick start</li>
<li>Build professional web sites</li>
<li>Handle databases like a pro</li>
</ul>
<p><strong>Get Off to a Quick Start</strong><br />
The authors get off to a great start by helping the reader to download, install, some basic tools including a servlet container, a database server, and an IDE. They guide the reader with step by step instructions for installing both Tomcat and MySQL &#8212; bonus points for recommending the latest versions of each. However, I’m stumped by their choice of IDE &#8212; NetBeans &#8212; and their claims that it is a top notch IDE. Technically, I suppose it is third, but in my experience it’s a distant third well behind Eclipse and IntelliJ.<br />
<strong>Build Professional Web Sites</strong><br />
I take issue with much of the material presented in the book and how it lends itself to creating ‘professional’ web sites. For starters, the authors provide an excellent introduction to HTML. Too bad XHTML is the current standard. The authors state that they’d rather discuss HTML than XHTML because they feel that XHTML is too difficult to teach in a single chapter. I thought this was ridiculous, but assumed they would at least promote well-formed HTML &#8212; boy, was I wrong. They consistently use of malformed HTML in their examples and go as far as mentioning the lack of unquoted attributes as a good thing! This is bad, but it gets worse because a couple of chapters later they have to discuss well-formed HTML before they can teach the reader how to use JSTL.<br />
The authors discuss both JSP and Servlet technologies in separate chapters and demonstrate how to create ‘complete’ websites with each technology. I suppose this is necessary to teach the underlying technologies, but I wish that the authors had down played their use a little more. They do eventually discuss MVC (model 2) and state that it is a better solution, but they take the easy way out by saying that sometimes straight JSP and straight Servlet implementations are except- able.<br />
My final grumble about creating professional websites has to do with the chapter on custom tags. While using the classic tag mechanism was a pleasure (not!), the simple tag mechanism is exactly what it claims to be &#8212; simpler &#8212; and much more straight forward. However, the authors only mention the classic mechanism &#8212; no mention of SimpleTagSupport and no mention of tag files. Long live SKIP_BODY!<br />
Now for the good stuff&#8230; My favorite chapter in the entire book has to be chapter 9 because they give a high-level summary of JavaBeans and JSP tags stating that they are outdated and rarely used anymore &#8212; replaced by JSTL. The only reason the authors even mention them is that the reader may need to know about them to support legacy applications. I wish the rest of the book gave more of these disclaimers.<br />
Finally, the authors really do a good job of describing the technologies. I just wish that they’d promote best practices and shun bad ones more often.</p>
<p><strong>Handle Databases Like a Pro</strong><br />
The authors give a good overview of SQL and then move on to coding straight JDBC code. However, they choose to close the connection inside of the try block rather than follow the best practice of closing the connection in the finally block. Also, they mention the differences between Statement and PreparedStatement and seem to lean towards Statement unless there is a need to execute the same statement repeatedly, but throughout the entire discussion there is no mention of cross site scripting prevention as one of the benefits of the PreparedStatement (not that PreparedStatement completely eliminates the threat of XSS, but it greatly reduces it).</p>
<p><strong>Summary</strong><br />
In summary, this book is a disappointment. The subject of web development involves many technologies: CSS, HTML/XHTML, Java, Servlets, JSP, JSTL, EL, SQL, Http, and Javascript; and this doesn’t include the various frameworks (Struts, JSF, Spring, Hibernate, GWT, etc.) The authors make a valiant effort to cover all the base technologies, but there’s just too much to cover in a single book and be able to make the claim that the reader will have all the skills necessary to create professional websites. This book barely manages to cover the basics. I give the authors an A for effort, but a D for execution. Having said that, if you don’t understand any of the technologies (other than Java) and read the book with the understanding that this is just the beginning, this might be the book for you.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Определение соединений с мобилок по User-Agent]]></title>
<link>http://sbuki.wordpress.com/2009/10/14/%d0%be%d0%bf%d1%80%d0%b5%d0%b4%d0%b5%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d1%81%d0%be%d0%b5%d0%b4%d0%b8%d0%bd%d0%b5%d0%bd%d0%b8%d0%b9-%d1%81-%d0%bc%d0%be%d0%b1%d0%b8%d0%bb%d0%be%d0%ba-%d0%bf%d0%be-user-agen/</link>
<pubDate>Wed, 14 Oct 2009 12:06:55 +0000</pubDate>
<dc:creator>sbuki</dc:creator>
<guid>http://sbuki.wordpress.com/2009/10/14/%d0%be%d0%bf%d1%80%d0%b5%d0%b4%d0%b5%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d1%81%d0%be%d0%b5%d0%b4%d0%b8%d0%bd%d0%b5%d0%bd%d0%b8%d0%b9-%d1%81-%d0%bc%d0%be%d0%b1%d0%b8%d0%bb%d0%be%d0%ba-%d0%bf%d0%be-user-agen/</guid>
<description><![CDATA[public static boolean isMobileDevice(HttpServletRequest request){ String ua = ((HttpServletRequest)r]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><code>    public static boolean isMobileDevice(HttpServletRequest request){</p>
<p>        String ua = ((HttpServletRequest)request).getHeader("User-Agent");<br />
        String accept = ((HttpServletRequest)request).getHeader("Accept");<br />
        String xwp = ((HttpServletRequest)request).getHeader("x-wap-profile");</p>
<p>        return isMobileDevice(ua,accept,xwp);<br />
    }</code></p>
<p><code>    public static boolean isMobileDevice(String userAgent, String accept, String xWapProfile){</p>
<p>        String ua = (userAgent==null) ? "" : userAgent.toLowerCase();<br />
        String a = (accept==null) ? "" : accept.toLowerCase();</p>
<p>        return ua.matches(".*(ipod&#124;iphone).*")<br />
                    &#124;&#124; ua.matches(".*android.*")<br />
                    &#124;&#124; ua.matches(".*opera mini.*")<br />
                    &#124;&#124; ua.matches(".*blackberry.*")<br />
                    &#124;&#124; ua.matches(".*(palm&#124;hiptop&#124;avantgo&#124;plucker&#124;xiino&#124;blazer&#124;elaine).*")<br />
                    &#124;&#124; ua.matches(".*windows ce; (ppc;&#124;smartphone;&#124;iemobile).*")<br />
                    &#124;&#124; a.matches(".*text/vnd\\.wap\\.wml.*")<br />
                    &#124;&#124; a.matches(".*application/vnd\\.wap\\.xhtml\\+xml.*")<br />
                    &#124;&#124; (xWapProfile != null);<br />
    }</code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Siklus Hidup Servlet, HTTP Request Methods, dan 3rd Party Library]]></title>
<link>http://bambangpdp.wordpress.com/2009/10/14/siklus-hidup-servlet-http-request-methods-dan-3rd-party-library/</link>
<pubDate>Wed, 14 Oct 2009 09:57:21 +0000</pubDate>
<dc:creator>bpdp</dc:creator>
<guid>http://bambangpdp.wordpress.com/2009/10/14/siklus-hidup-servlet-http-request-methods-dan-3rd-party-library/</guid>
<description><![CDATA[HTTP Request Methods Setiap request dari web client mengandung suatu verb yang merupakan penanda tip]]></description>
<content:encoded><![CDATA[HTTP Request Methods Setiap request dari web client mengandung suatu verb yang merupakan penanda tip]]></content:encoded>
</item>
<item>
<title><![CDATA[Apache Ant untuk Membangun Aplikasi Web]]></title>
<link>http://bambangpdp.wordpress.com/2009/10/07/apache-ant-untuk-membangun-aplikasi-web/</link>
<pubDate>Wed, 07 Oct 2009 00:42:31 +0000</pubDate>
<dc:creator>bpdp</dc:creator>
<guid>http://bambangpdp.wordpress.com/2009/10/07/apache-ant-untuk-membangun-aplikasi-web/</guid>
<description><![CDATA[Pengantar Aplikasi web di Java bisa dipaket dalam bentuk file .WAR ataupun langsung disalin ke direk]]></description>
<content:encoded><![CDATA[Pengantar Aplikasi web di Java bisa dipaket dalam bentuk file .WAR ataupun langsung disalin ke direk]]></content:encoded>
</item>
<item>
<title><![CDATA[Gut Nacht]]></title>
<link>http://aufgehts.wordpress.com/2009/10/05/gut-nacht/</link>
<pubDate>Mon, 05 Oct 2009 00:12:20 +0000</pubDate>
<dc:creator>itgruendungmuenchen</dc:creator>
<guid>http://aufgehts.wordpress.com/2009/10/05/gut-nacht/</guid>
<description><![CDATA[Du liebe Zeit, schon wieder viertel nach 2. Jetzt aber ins Bett &#8212;- kurz mal was festhalten jav]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Du liebe Zeit, schon wieder viertel nach 2. Jetzt aber ins Bett <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>&#8212;-</p>
<p>kurz mal was festhalten</p>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">java ap (EE) runterladen (gibts auch ohne alles!, ca 100MB)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Eclipse runterladen</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">installieren</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Eclipse -&#62; Help -&#62; Install (new) Software</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">http://download.eclipse.org/webtools/updates/</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">WTP (Web Tools Platform) auswählen</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">File &#62; New &#62; Web &#62; Dyn Web Proj</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Erstellen</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Dann auf dem Projekt links im Projekt Explorer rechte Maustaste &#62; New &#62; Servlet</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Erstellen</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">dann rechte Maustaste Properties &#62; Java Build Path &#62; Libraries &#62; Add External Jars &#62; C:\Sun\SDK\lib\j2ee.jar auswählen</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Dann im Projekt src&#8230; Klasse.java sollte alles grün sein</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">dort dann die doGet ändern auf:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>response.setContentType( &#8220;text/html&#8221; );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> PrintWriter out = response.getWriter();</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println( &#8220;&#60;html&#62;&#8221; );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println( &#8220;&#60;h3&#62; Hallo, mein erstes Servlet meldet sich &#60;/h3&#62;&#8221; );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println( &#8220;&#60;/html&#62;&#8221; );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.close();</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> }</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">damit auch was rauskommt</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Servlet ist also gebaut&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Jetzt müssen wir noch ein WAR draus machen</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Auf Project -&#62; Export &#62; WAR&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Dann aufn Tomcat kopieren</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">tomcat erst mal starten:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">rsync:~ # cd /root/java/apache-tomcat-6.0.20/bin/</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">rsync:~/java/apache-tomcat-6.0.20/bin # sh startup.sh</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">WAR ins Webapp dir kopieren:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">C:\..&#62;pscp de.bla.dest.war root@192.168.178.49:/root/java/apache-tomcat-6.0.20/webapps/.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Mal in den Manager gucken:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">http://192.168.178.49:8080/manager/html</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Passwortproblem?</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">in /root/java/apache-tomcat-6.0.20/conf/tomcat-users.xml</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">eins definieren</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;tomcat-users&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;user username=&#8221;admin&#8221; password=&#8221;geheim&#8221; roles=&#8221;admin,manager&#8221;/&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;/tomcat-users&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">dort ist unser war zu sehen</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Im Project Webcontent &#62; Web-INF &#62; lib &#62; web.xml</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;servlet-mapping&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8230;&#60;url-pattern&#62;/MeinTest&#60;/url-pattern&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">findet sich die URL</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">http://192.168.178.49:8080/projekt-ear-name/Klassenname (src.Klasse)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">also zB</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">http://192.168.178.49:8080/de.bla.dest/MeinTest</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Fertig&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Schritt 2:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Servlet ändern:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">..doGet(..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">out.println( &#8220;&#60;/html&#62;&#8221; );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">out.close();</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">nach</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">..doGet(..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> PrintENV(request, out);<span style="white-space:pre;"> </span> <span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> PrintParams(request, response, out);<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println( &#8220;time&#8221;+new SimpleDateFormat(&#8220;dd-MM-yyyy HH:mm:ss&#8221;).format(new Date()) );<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println( &#8220;&#60;/html&#62;&#8221; );<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.close();</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>private void PrintENV(HttpServletRequest request, PrintWriter out) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>out.println(&#8220;&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> &#8220;&#60;B&#62;Request Method: &#60;/B&#62;&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> request.getMethod() + &#8220;&#60;BR&#62;\n&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> &#8220;&#60;B&#62;Request URI: &#60;/B&#62;&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> request.getRequestURI() + &#8220;&#60;BR&#62;\n&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> &#8220;&#60;B&#62;Request Protocol: &#60;/B&#62;&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> request.getProtocol() + &#8220;&#60;BR&#62;&#60;BR&#62;\n&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> &#8220;&#60;TABLE BORDER=1 &#62;\n&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> &#8220;&#60;TR BGCOLOR=\&#8221;#FFAD00\&#8221;&#62;\n&#8221; +</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> &#8220;&#60;TH&#62;Header Name&#60;TH&#62;Header Value&#8221;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>Enumeration headerNames = request.getHeaderNames();</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>while(headerNames.hasMoreElements()) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> String headerName = (String)headerNames.nextElement();</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println(&#8220;&#60;TR&#62;&#60;TD&#62;&#8221; + headerName);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println(&#8221;    &#60;TD&#62;&#8221; + request.getHeader(headerName));</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>out.println(&#8220;&#60;/TABLE&#62;&#8221;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>private void PrintParams(HttpServletRequest request,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>HttpServletResponse response, PrintWriter out) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>// Get the value of a request parameter; the name is case-sensitive</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> String name = &#8220;param&#8221;;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> String value = request.getParameter(name);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> if (value == null) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> // The request parameter &#8216;param&#8217; was not present in the query string</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> // e.g. http://hostname.com?a=b</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> } else if (&#8220;&#8221;.equals(value)) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> // The request parameter &#8216;param&#8217; was present in the query string but has no value</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> // e.g. http://hostname.com?param=&#38;a=b</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> }</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println(name+&#8217;=');<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> // Get the value of the request parameter</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> value = request.getParameter(name);<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> // If the request parameter can appear more than once in the query string, get all values</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> String[] values = request.getParameterValues(name);<span style="white-space:pre;"> </span></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> for (int i=0; i&#60;values.length; i++) {</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> out.println(&#8221;    &#8221;+values[i]+&#8221;&#60;br&#62;&#8221;);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> }</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span> }</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Einfach rüberkopieren, Tomcat startet WAR selbst neu</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Aufrufen:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">http://192.168.178.49:8080/de.bla.dest/MeinTest?bla=bull</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">im web.xml steht</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;servlet&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;servlet-class&#62;de.bla.dest.MeinTest&#60;/servlet-class&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/servlet&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;servlet-mapping&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;servlet-name&#62;MeinTest&#60;/servlet-name&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;url-pattern&#62;/MeinTest&#60;/url-pattern&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/servlet-mapping&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">wir wollen alles was hinter MeinTest kommt mit MeinTest verarbeiten,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">also ändern</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;url-pattern&#62;/MeinTest/*&#60;/url-pattern&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">dann geht auch hinten an der url was anzuhängen:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">http://192.168.178.49:8080/de.bla.dest/MeinTest/x/y.html?bla=bull</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">auszulesen in request.getRequestURI():  /de.bla.dest//MeinTest/x/y.html</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Root.WAR</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">um eine /index.html auszuliefern Rechte Maustaste aufm Projekt</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Exportname nach ROOT.war ändern und in webapps kopieren&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">zusätzlich im webinf:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;servlet-mapping&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;servlet-name&#62;MeinTest&#60;/servlet-name&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;url-pattern&#62;/&#60;/url-pattern&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/servlet-mapping&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Wirds nicht deployed, dann das webapps/ROOT/.. Verzeichnis löschen, erneut deployen (bzw server neu starten)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Nachher gehts von selbst</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">ein einfachs Pom für maven:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;project xmlns=&#8221;http://maven.apache.org/POM/4.0.0&#8243;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>xsi:schemaLocation=&#8221;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&#8221;&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;modelVersion&#62;4.0.0&#60;/modelVersion&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;groupId&#62;Example&#60;/groupId&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;artifactId&#62;Example&#60;/artifactId&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;packaging&#62;war&#60;/packaging&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;version&#62;0.0.1&#60;/version&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;dependencies&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;dependency&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;groupId&#62;tomcat&#60;/groupId&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;artifactId&#62;servlet-api&#60;/artifactId&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;version&#62;5.5.23&#60;/version&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;scope&#62;provided&#60;/scope&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/dependency&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/dependencies&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;build&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;plugins&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;plugin&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;artifactId&#62;maven-compiler-plugin&#60;/artifactId&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;configuration&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;source&#62;1.5&#60;/source&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;target&#62;1.5&#60;/target&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/configuration&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/plugin&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/plugins&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="white-space:pre;"> </span>&#60;/build&#62;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">&#60;/project&#62;</div>
<p>java ap (EE) runterladen (gibts auch ohne alles!, ca 100MB)</p>
<p>Eclipse runterladen</p>
<p>installieren</p>
<p>Eclipse -&#62; Help -&#62; Install (new) Software</p>
<p>http://download.eclipse.org/webtools/updates/</p>
<p>WTP (Web Tools Platform) auswählen</p>
<p>File &#62; New &#62; Web &#62; Dyn Web Proj</p>
<p>Erstellen</p>
<p>Dann auf dem Projekt links im Projekt Explorer rechte Maustaste &#62; New &#62; Servlet</p>
<p>Erstellen</p>
<p>dann rechte Maustaste Properties &#62; Java Build Path &#62; Libraries &#62; Add External Jars &#62; C:\Sun\SDK\lib\j2ee.jar auswählen</p>
<p>Dann im Projekt src&#8230; Klasse.java sollte alles grün sein</p>
<p>dort dann die doGet ändern auf:</p>
<p><span style="white-space:pre;"> </span>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span>response.setContentType( &#8220;text/html&#8221; );</p>
<p><span style="white-space:pre;"> </span> PrintWriter out = response.getWriter();</p>
<p><span style="white-space:pre;"> </span> out.println( &#8220;&#60;html&#62;&#8221; );</p>
<p><span style="white-space:pre;"> </span> out.println( &#8220;&#60;h3&#62; Hallo, mein erstes Servlet meldet sich &#60;/h3&#62;&#8221; );</p>
<p><span style="white-space:pre;"> </span> out.println( &#8220;&#60;/html&#62;&#8221; );</p>
<p><span style="white-space:pre;"> </span> out.close();</p>
<p><span style="white-space:pre;"> </span> }</p>
<p>damit auch was rauskommt</p>
<p>Servlet ist also gebaut&#8230;</p>
<p>Jetzt müssen wir noch ein WAR draus machen</p>
<p>Auf Project -&#62; Export &#62; WAR&#8230;</p>
<p>Dann aufn Tomcat kopieren</p>
<p>tomcat erst mal starten:</p>
<p>rsync:~ # cd /root/java/apache-tomcat-6.0.20/bin/</p>
<p>rsync:~/java/apache-tomcat-6.0.20/bin # sh startup.sh</p>
<p>WAR ins Webapp dir kopieren:</p>
<p>C:\..&#62;pscp de.bla.dest.war root@192.168.178.49:/root/java/apache-tomcat-6.0.20/webapps/.</p>
<p>Mal in den Manager gucken:</p>
<p>http://192.168.178.49:8080/manager/html</p>
<p>Passwortproblem?</p>
<p>in /root/java/apache-tomcat-6.0.20/conf/tomcat-users.xml</p>
<p>eins definieren</p>
<p>&#60;tomcat-users&#62;</p>
<p>&#60;user username=&#8221;admin&#8221; password=&#8221;geheim&#8221; roles=&#8221;admin,manager&#8221;/&#62;</p>
<p>&#60;/tomcat-users&#62;</p>
<p>dort ist unser war zu sehen</p>
<p>Im Project Webcontent &#62; Web-INF &#62; lib &#62; web.xml</p>
<p>&#8230;</p>
<p>&#60;servlet-mapping&#62;</p>
<p>&#8230;</p>
<p>&#8230;&#60;url-pattern&#62;/MeinTest&#60;/url-pattern&#62;</p>
<p>findet sich die URL</p>
<p>http://192.168.178.49:8080/projekt-ear-name/Klassenname (src.Klasse)</p>
<p>also zB</p>
<p>http://192.168.178.49:8080/de.bla.dest/MeinTest</p>
<p>Fertig&#8230;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Schritt 2:</p>
<p>Servlet ändern:</p>
<p>..doGet(..</p>
<p>&#8230;</p>
<p>out.println( &#8220;&#60;/html&#62;&#8221; );</p>
<p>out.close();</p>
<p>}</p>
<p>nach</p>
<p>..doGet(..</p>
<p>&#8230;</p>
<p><span style="white-space:pre;"> </span> PrintENV(request, out);<span style="white-space:pre;"> </span> <span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> PrintParams(request, response, out);<span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> out.println( &#8220;time&#8221;+new SimpleDateFormat(&#8220;dd-MM-yyyy HH:mm:ss&#8221;).format(new Date()) );<span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> out.println( &#8220;&#60;/html&#62;&#8221; );<span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> out.close();</p>
<p>}</p>
<p><span style="white-space:pre;"> </span>private void PrintENV(HttpServletRequest request, PrintWriter out) {</p>
<p><span style="white-space:pre;"> </span>out.println(&#8220;&#8221; +</p>
<p><span style="white-space:pre;"> </span> &#8220;&#60;B&#62;Request Method: &#60;/B&#62;&#8221; +</p>
<p><span style="white-space:pre;"> </span> request.getMethod() + &#8220;&#60;BR&#62;\n&#8221; +</p>
<p><span style="white-space:pre;"> </span> &#8220;&#60;B&#62;Request URI: &#60;/B&#62;&#8221; +</p>
<p><span style="white-space:pre;"> </span> request.getRequestURI() + &#8220;&#60;BR&#62;\n&#8221; +</p>
<p><span style="white-space:pre;"> </span> &#8220;&#60;B&#62;Request Protocol: &#60;/B&#62;&#8221; +</p>
<p><span style="white-space:pre;"> </span> request.getProtocol() + &#8220;&#60;BR&#62;&#60;BR&#62;\n&#8221; +</p>
<p><span style="white-space:pre;"> </span> &#8220;&#60;TABLE BORDER=1 &#62;\n&#8221; +</p>
<p><span style="white-space:pre;"> </span> &#8220;&#60;TR BGCOLOR=\&#8221;#FFAD00\&#8221;&#62;\n&#8221; +</p>
<p><span style="white-space:pre;"> </span> &#8220;&#60;TH&#62;Header Name&#60;TH&#62;Header Value&#8221;);</p>
<p><span style="white-space:pre;"> </span>Enumeration headerNames = request.getHeaderNames();</p>
<p><span style="white-space:pre;"> </span>while(headerNames.hasMoreElements()) {</p>
<p><span style="white-space:pre;"> </span> String headerName = (String)headerNames.nextElement();</p>
<p><span style="white-space:pre;"> </span> out.println(&#8220;&#60;TR&#62;&#60;TD&#62;&#8221; + headerName);</p>
<p><span style="white-space:pre;"> </span> out.println(&#8221;    &#60;TD&#62;&#8221; + request.getHeader(headerName));</p>
<p><span style="white-space:pre;"> </span>}</p>
<p><span style="white-space:pre;"> </span>out.println(&#8220;&#60;/TABLE&#62;&#8221;);</p>
<p><span style="white-space:pre;"> </span>}</p>
<p><span style="white-space:pre;"> </span>private void PrintParams(HttpServletRequest request,</p>
<p><span style="white-space:pre;"> </span>HttpServletResponse response, PrintWriter out) {</p>
<p><span style="white-space:pre;"> </span>// Get the value of a request parameter; the name is case-sensitive</p>
<p><span style="white-space:pre;"> </span> String name = &#8220;param&#8221;;</p>
<p><span style="white-space:pre;"> </span> String value = request.getParameter(name);</p>
<p><span style="white-space:pre;"> </span> if (value == null) {</p>
<p><span style="white-space:pre;"> </span> // The request parameter &#8216;param&#8217; was not present in the query string</p>
<p><span style="white-space:pre;"> </span> // e.g. http://hostname.com?a=b</p>
<p><span style="white-space:pre;"> </span> } else if (&#8220;&#8221;.equals(value)) {</p>
<p><span style="white-space:pre;"> </span> // The request parameter &#8216;param&#8217; was present in the query string but has no value</p>
<p><span style="white-space:pre;"> </span> // e.g. http://hostname.com?param=&#38;a=b</p>
<p><span style="white-space:pre;"> </span> }</p>
<p><span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> out.println(name+&#8217;=');<span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> // Get the value of the request parameter</p>
<p><span style="white-space:pre;"> </span> value = request.getParameter(name);<span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> // If the request parameter can appear more than once in the query string, get all values</p>
<p><span style="white-space:pre;"> </span> String[] values = request.getParameterValues(name);<span style="white-space:pre;"> </span></p>
<p><span style="white-space:pre;"> </span> for (int i=0; i&#60;values.length; i++) {</p>
<p><span style="white-space:pre;"> </span> out.println(&#8221;    &#8221;+values[i]+&#8221;&#60;br&#62;&#8221;);</p>
<p><span style="white-space:pre;"> </span> }</p>
<p><span style="white-space:pre;"> </span> }</p>
<p>Einfach rüberkopieren, Tomcat startet WAR selbst neu</p>
<p>Aufrufen:</p>
<p>http://192.168.178.49:8080/de.bla.dest/MeinTest?bla=bull</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>im web.xml steht</p>
<p>&#60;servlet&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;servlet-class&#62;de.bla.dest.MeinTest&#60;/servlet-class&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/servlet&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;servlet-mapping&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;servlet-name&#62;MeinTest&#60;/servlet-name&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;url-pattern&#62;/MeinTest&#60;/url-pattern&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/servlet-mapping&#62;</p>
<p>wir wollen alles was hinter MeinTest kommt mit MeinTest verarbeiten,</p>
<p>also ändern</p>
<p><span style="white-space:pre;"> </span>&#60;url-pattern&#62;/MeinTest/*&#60;/url-pattern&#62;</p>
<p>dann geht auch hinten an der url was anzuhängen:</p>
<p>http://192.168.178.49:8080/de.bla.dest/MeinTest/x/y.html?bla=bull</p>
<p>auszulesen in request.getRequestURI():  /de.bla.dest//MeinTest/x/y.html</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Root.WAR</p>
<p>um eine /index.html auszuliefern Rechte Maustaste aufm Projekt</p>
<p>Exportname nach ROOT.war ändern und in webapps kopieren&#8230;</p>
<p>zusätzlich im webinf:</p>
<p><span style="white-space:pre;"> </span>&#60;servlet-mapping&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;servlet-name&#62;MeinTest&#60;/servlet-name&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;url-pattern&#62;/&#60;/url-pattern&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/servlet-mapping&#62;</p>
<p>Wirds nicht deployed, dann das webapps/ROOT/.. Verzeichnis löschen, erneut deployen (bzw server neu starten)</p>
<p>Nachher gehts von selbst</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>ein einfachs Pom für maven:</p>
<p>&#60;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&#62;</p>
<p>&#60;project xmlns=&#8221;http://maven.apache.org/POM/4.0.0&#8243;</p>
<p><span style="white-space:pre;"> </span>xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221;</p>
<p><span style="white-space:pre;"> </span>xsi:schemaLocation=&#8221;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&#8221;&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;modelVersion&#62;4.0.0&#60;/modelVersion&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;groupId&#62;Example&#60;/groupId&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;artifactId&#62;Example&#60;/artifactId&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;packaging&#62;war&#60;/packaging&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;version&#62;0.0.1&#60;/version&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;dependencies&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;dependency&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;groupId&#62;tomcat&#60;/groupId&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;artifactId&#62;servlet-api&#60;/artifactId&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;version&#62;5.5.23&#60;/version&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;scope&#62;provided&#60;/scope&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/dependency&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/dependencies&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;build&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;plugins&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;plugin&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;artifactId&#62;maven-compiler-plugin&#60;/artifactId&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;configuration&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;source&#62;1.5&#60;/source&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;target&#62;1.5&#60;/target&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/configuration&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/plugin&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/plugins&#62;</p>
<p><span style="white-space:pre;"> </span>&#60;/build&#62;</p>
<p>&#60;/project&#62;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Resolve IE8 Compatibility Issues with Richfaces]]></title>
<link>http://technicalbrainwave.wordpress.com/2009/10/03/resolve-ie8-compatibility-issues-with-richfaces/</link>
<pubDate>Sat, 03 Oct 2009 06:38:12 +0000</pubDate>
<dc:creator>Gift Sam</dc:creator>
<guid>http://technicalbrainwave.wordpress.com/2009/10/03/resolve-ie8-compatibility-issues-with-richfaces/</guid>
<description><![CDATA[Introduction: I have developed a web application in JSF along with richfaces. My application perfect]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div>
<p><strong>Introduction:</strong></p>
<p>I have developed a web application in JSF along with richfaces. My application perfectly works in the various browsers like Firefox, Google Chrome also in IE6 and IE7. But in IE8, I found a compatability issue with Richfaces. I felt wrecked, because the web application designed in the older version browsers, doesnt have the support in the newer versions. But eventually I have a founded a solution to resolve this Richfaces compatability issues in IE8. The way is to implement “IE=7” X-UA-Compatible tag, which instructs IE8 to display content in IE7 Standards mode. I got this resource from the following link of <a href="http://blogs.msdn.com/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx">IE blogs</a>.</p>
<p><strong>The Trick:</strong></p>
<p>Resolving IE8 compatability issues with richfaces is accomplished by two tricks,</p>
<p><strong>Trick1:</strong></p>
<p><strong> </strong>Add the &#60;meta http-equiv=&#8221;X-UA-Compatible&#8221; content=&#8221;IE=EmulateIE7&#8243; /&#62; header tag <!--more-->in your jsp code like the below</p>
<pre class="brush: css;">
&#60;%@page contentType=&#34;text/html&#34; pageEncoding=&#34;UTF-8&#34;%&#62;
&#60;%@ taglib uri=&#34;http://java.sun.com/jsf/html&#34; prefix=&#34;h&#34; %&#62;
&#60;%@ taglib uri=&#34;http://java.sun.com/jsf/core&#34; prefix=&#34;f&#34; %&#62;
&#60;%@ taglib uri=&#34;http://richfaces.org/a4j&#34; prefix=&#34;a4j&#34;%&#62;
&#60;%@ taglib uri=&#34;http://richfaces.org/rich&#34; prefix=&#34;rich&#34;%&#62;

&#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD HTML 4.01 Transitional//EN&#34;
 &#34;http://www.w3.org/TR/html4/loose.dtd&#34;&#62;
&#60;f:view&#62;
 &#60;html&#62;
    &#60;head&#62;
         &#60;meta http-equiv=&#34;X-UA-Compatible&#34; content=&#34;IE=EmulateIE7&#34; /&#62;
         &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34;/&#62;
         &#60;title&#62;Resolve IE8 Compatability Issues&#60;/title&#62;
    &#60;/head&#62;
     &#60;body&#62;
         &#60;h1&#62;&#60;h:outputText value=&#34;Resolve IE8 Compatability Issues&#34;/&#62;&#60;/h1&#62;
     &#60;/body&#62;
 &#60;/html&#62;
&#60;/f:view&#62;
</pre>
<blockquote><p><em><strong>Note: </strong></em>This header tag should comes first in the head tag. if not IE8 will ignore all the other tags.</p></blockquote>
<p><strong>Trick2</strong>(Resolve using a filter):</p>
<p>You can also set this header tag in a HttpServletResponse, by contolling your entire java application by a filter. So that the response page processed by this servlet response will contains the specified http header tag. Thanks for the resource provided in <a href="http://cse-mjmcl.cse.bris.ac.uk/blog/2008/06/12/1213260442881.html">Mark McLaren&#8217;s Weblog</a>.</p>
<pre class="brush: css;">
package com.example.web;

import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
public class IE8CompatablityFixServlet implements Filter
{
public void init(FilterConfig filterConfig) throws ServletException
{
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException
{
((HttpServletResponse) response).setHeader(&#34;X-UA-Compatible&#34;, &#34;IE=EmulateIE7&#34;);
chain.doFilter(request, response);
}

public void destroy()
{
}
}</pre>
<p>So by implementing any of the tricks you can accomplish the IE8 Compatability issues with richfaces.</p>
<p><strong>Seam:</strong></p>
<p>Some may say I am using seam, how to resolve this issue in seam?? Dont worry there is a way to implement this and it will be touched on soon. I got this resource from the <a href="http://www.jboss.org/community/wiki/IE8CompatibilityModewithRichfaces">Jboss wiki</a>.  In seam, configurations should be done in pages.xml, which is the file used to specify the settings for the entire applications.</p>
<div><strong>Pages.xml Configuration:</strong></div>
<div>The below code is used to apply globally for all the pages in a single configuration.</div>
<div>
<pre class="brush: css;">
&#60;page view-id=&#34;*&#34;&#62;
&#60;header name=&#34;X-UA-Compatible&#34;&#62;IE=EmulateIE7&#60;/header&#62;
&#60;navigation&#62;
&#60;rule if-outcome=&#34;main&#34;&#62;
&#60;redirect view-id=&#34;pages/main.xhtml&#34;/&#62;
&#60;/rule&#62;
&#60;/navigation&#62;
&#60;/page&#62;
</pre>
<p>If you want to apply this header tag for an individual page, the below code should be invoked.</p>
<pre class="brush: css;">
&#60;page view-id=&#34;/pages/login.xhtml&#34;&#62;
&#60;header name=&#34;X-UA-Compatible&#34;&#62;IE=EmulateIE7&#60;/header&#62;
&#60;description&#62;User Login&#60;/description&#62;
&#60;/page&#62;
</pre>
<p>Thats all folks. I hope this article would be helpful to resolve the compatability issues with richfaces in IE8.<em><strong> If you find this article is quite useful, Dont forget to share with me by giving your valuable comments</strong></em>. Have a joyous code day.</p>
</div>
</div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Web Applications]]></title>
<link>http://shishircyb.wordpress.com/2009/10/01/web-applications/</link>
<pubDate>Thu, 01 Oct 2009 11:40:29 +0000</pubDate>
<dc:creator>Mihir Patel</dc:creator>
<guid>http://shishircyb.wordpress.com/2009/10/01/web-applications/</guid>
<description><![CDATA[A web application consists of web components, static resource files such as images, and helper class]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A web application consists of web components, static resource files such as images, and helper classes and libraries. In the Java 2 platform, web components provide the dynamic extension capabilities for a web server.</p>
<p><strong>Web Components :</strong></p>
<ul>
<li>Java Servlets</li>
<li>JSP</li>
<li>Web Services endpoint</li>
</ul>
<p><strong>Web Container :</strong></p>
<ul>
<li>Web components are supported by the services of a runtime platform called a web container.</li>
<li>A web container provides services such as request dispatching, security, concurrency, and life-cycle management. It also gives web components access to APIs such as naming, transactions, and email.</li>
</ul>
<p><strong>Web application deployment descriptor (DD) :</strong> The configuration information is maintained in a text file in XML format called a web application deployment descriptor.</p>
<div id="attachment_722" class="wp-caption aligncenter" style="width: 470px"><img class="size-full wp-image-722" title="Request Handling" src="http://shishircyb.wordpress.com/files/2009/09/request-handling.jpg" alt="Java Web Application Request Handling" width="460" height="304" /><p class="wp-caption-text">Java Web Application Request Handling</p></div>
<h2><strong>Java Web Application Technologies</strong></h2>
<p><strong> </strong></p>
<div id="attachment_726" class="wp-caption aligncenter" style="width: 427px"><strong><strong><img class="size-full wp-image-726" title="Web Application Technologies" src="http://shishircyb.wordpress.com/files/2009/09/web-application-technologies.jpg" alt="Java Web Application Technologies" width="417" height="173" /></strong></strong><p class="wp-caption-text">Java Web Application Technologies</p></div>
<p><strong> </strong></p>
<p><strong>Servlets</strong> are Java programming language classes that dynamically process requests and construct responses.</p>
<p>Servlets are best suited for service-oriented applications (web service endpoints are implemented as servlets) and the control functions of a presentation-oriented application, such as dispatching requests and handling nontextual data.</p>
<p>JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content.</p>
<p>JSP pages are more appropriate for generating text-based markup such as HTML, Scalable Vector Graphics (SVG), Wireless Markup Language (WML), and XML.</p>
<h2><strong>Web Application Life Cycle</strong></h2>
<p>The process for creating, deploying, and executing a web application can be summarized as follows :</p>
<p>1.    Develop the web component code.<br />
2.    Develop the web application deployment descriptor.<br />
3.    Compile the web application components and helper classes referenced by the components.<br />
4.    Optionally package the application into a deployable unit.<br />
5.    Deploy the application into a web container.<br />
6.    Access a URL that references the web application.</p>
<h2><strong>Web Module</strong></h2>
<p><strong>Web Resources :</strong> In the Java EE architecture, web components and static web content files such as images are called web resources.</p>
<p><strong>Web Module :</strong> A web module is the smallest deployable and usable unit of web resources.</p>
<p>In addition to web components and web resources, a web module can contain other files :</p>
<ul>
<li>Server-side utility classes (database beans, shopping carts, and so on). Often these classes conform to the JavaBeans component architecture.</li>
<li>Client-side classes (applets and utility classes).</li>
</ul>
<p><strong>Structure of Web Module</strong></p>
<p>Top level directory is  &#8211; <em>Document Root</em> of the application</p>
<p><em>Document Root contains : </em></p>
<ol>
<li>JSP pages</li>
<li>Client side classes and archives</li>
<li>Static web resources, such as images</li>
<li>WEB-INF (Sub Directory) contains -
<ul>
<li><em>web.xml :</em> The web application deployment descriptor</li>
<li><em>Tag library descriptor</em> files</li>
<li><em>classes :</em> A directory that contains server-side classes: servlets, utility classes, and JavaBeans components</li>
<li><em>tags :</em> A directory that contains tag files, which are implementations of tag libraries</li>
<li><em>lib :</em> A directory that contains JAR archives of libraries called by server-side classes</li>
</ul>
</li>
</ol>
<p>If your web module <em>does not contain any servlets, filter, or listener</em> components then it <em>does not need a web application deployment descriptor</em>.</p>
<p>You can also <em>create application-specific subdirectories</em> in -</p>
<ul>
<li>document root or</li>
<li>WEB-INF/classes/ directory</li>
</ul>
<p>You can deploy <em>Web Module</em> into any web container that conforms to the Java Servlets Specification.</p>
<p>To deploy a WAR on the Application Server, the file must also contain a <em>Runtime Deployment Descriptor</em>.</p>
<p><strong>Runtime Deployment Descriptor :</strong> The runtime deployment descriptor is an <em>XML file</em> that contains information such as the <em>context root of the web application</em> and the <em>mapping of </em>the portable names of an <em>application’s resources to the Application Server’s resources</em>.</p>
<p>The Application Server web application runtime DD is named <em>sun-web.xml</em> and is located in the WEB-INF directory along with the web application DD.</p>
<div id="attachment_748" class="wp-caption aligncenter" style="width: 452px"><img class="size-full wp-image-748" title="Web Module Structure" src="http://shishircyb.wordpress.com/files/2009/10/web-module-structure.jpg" alt="Web Module Structure " width="442" height="413" /><p class="wp-caption-text">Web Module Structure </p></div>
<p><strong>Packaging Web Modules</strong><br />
To build the hello1 application with NetBeans IDE, follow these instructions :</p>
<ol>
<li>Select File?Open Project.</li>
<li>In the Open Project dialog, navigate to<em> tut-install/javaeetutorial5/examples/web/</em></li>
<li>Select the hello1 folder.</li>
<li>Select the Open as Main Project check box.</li>
<li>Click Open Project.</li>
<li>In the Projects tab, right-click the hello1 project and select Build.</li>
</ol>
<p>To build the hello1 application using the Ant utility, follow these steps:</p>
<ol>
<li>In a terminal window, go to <em>tut-install/javaeetutorial5/examples/web/hello1/</em>.</li>
<li>Type ant. This command will spawn any necessary compilations, copy files to the <em>tut-install/javaeetutorial5/examples/web/hello1/build/</em> directory, create the WAR file, and copy it to the <em>tut-install/javaeetutorial5/examples/web/hello1/dist/</em> directory.</li>
</ol>
<p><strong>Deploying a WAR File</strong><br />
<em>Context Root :</em> A context root <em>identifies a web application in a Java EE server. </em></p>
<ul>
<li>You specify the context root when you deploy a web module.</li>
<li>A context root must start with a forward slash (/) and end with a string.</li>
</ul>
<p><strong><em>Setting the Context Root :</em></strong><br />
In a packaged web module for deployment on the Application Server, the context root is <em>stored in sun-web.xml</em>.<br />
To edit the context root, do the following :</p>
<ol>
<li> Expand your project tree in the Projects pane of NetBeans IDE.</li>
<li>Expand the Web Pages and WEB-INF nodes of your project.</li>
<li>Double-click sun-web.xml.</li>
<li>In the editor pane, click Edit As XML.</li>
<li>Edit the context root, which is enclosed by the context-root element.</li>
</ol>
<p>You can deploy a WAR file to the Application Server in a 4 ways:</p>
<ul>
<li> Copying the WAR into the domain-dir/autodeploy/ directory.</li>
<li>Using the Admin Console.</li>
<li>By running asadmin or ant to deploy the WAR.</li>
<li>Using NetBeans IDE.</li>
</ul>
<p><strong><em>Deploying a Packaged Web Module</em></strong><br />
If you have deployed the hello1 application, before proceeding with this section, undeploy the application by following one of the procedures described in <a href="http://java.sun.com/javaee/5/docs/tutorial/doc/bnadx.html#bnaen">Undeploying Web Modules</a>.</p>
<p><strong><em>Deploying with the Admin Console</em></strong></p>
<ol>
<li>Expand the Applications node.</li>
<li>Select the Web Applications node.</li>
<li>Click the Deploy button.</li>
<li>Select the radio button labeled “Package file to be uploaded to the Application Server.”</li>
<li>Type the full path to the WAR file (or click on Browse to find it), and then click the OK button.</li>
<li>Click Next.</li>
<li>Type the application name.</li>
<li>Type the context root.</li>
<li>Select the Enabled box.</li>
<li>Click the Finish button.</li>
</ol>
<p><strong><em>Deploying with asadmin</em></strong><br />
To deploy a WAR with asadmin, open a terminal window or command prompt and execute<br />
=&#62; <em><strong>asadmin</strong> </em>deploy full-path-to-war-file</p>
<p><strong><em> Deploying with Ant</em></strong><br />
To deploy a WAR with the Ant tool, open a terminal window or command prompt in the directory where you built and packaged the WAR, and execute<br />
=&#62; <em><strong>ant </strong></em>deploy</p>
<p><strong><em>Deploying with NetBeans IDE</em></strong><br />
To deploy a WAR with NetBeans IDE, do the following:</p>
<ol>
<li>Select File?Open Project.</li>
<li>In the Open Project dialog, navigate to your project and open it.</li>
<li>In the Projects tab, right-click the project and select Undeploy and Deploy.</li>
</ol>
<p><strong>Testing Deployed Web Modules</strong></p>
<ul>
<li> By default, the application is deployed to host localhost on port 8080.</li>
<li>The context root of the web application is hello1 suppose.</li>
</ul>
<p>To test the application, follow these steps:</p>
<ol>
<li> Open a web browser.</li>
<li>Enter the following URL in the web address box : <em>http://localhost:8080/hello1</em></li>
<li>Enter your name, and click Submit.</li>
</ol>
<p><strong>Listing Deployed Web Modules</strong><br />
To use the Admin Console :</p>
<ol>
<li>Open the URL http://localhost:4848/asadmin in a browser.</li>
<li>Expand the nodes Applications?Web Applications.</li>
</ol>
<p>Use the asadmin command as<em><strong> asadmin</strong> </em>list-components</p>
<p><strong>Updating Web Modules</strong></p>
<ol>
<li> Recompile any modified classes.</li>
<li>If you have deployed a packaged web module, update any modified components in the WAR.</li>
<li>Redeploy the module.</li>
<li>Reload the URL in the client.</li>
</ol>
<p><strong>Dynamic Reloading</strong></p>
<ul>
<li> If dynamic reloading is enabled, you do not have to redeploy an application or module when you change its code or deployment descriptors.</li>
<li>This capability is useful in a development environment, because it allows code changes to be tested quickly.</li>
<li>Not recommended for a production environment, however, because it may degrade performance.</li>
</ul>
<p>To enable dynamic reloading, use the Admin Console:</p>
<ol>
<li> Select the Applications Server node.</li>
<li>Select the Advanced tab.</li>
<li>Check the Reload Enabled box to enable dynamic reloading.</li>
<li>Enter a number of seconds in the Reload Poll Interval field to set the interval at which applications and modules are checked for code changes and dynamically reloaded.</li>
<li>Click the Save button.</li>
</ol>
<p>In addition, to load new servlet files or reload deployment descriptor changes, you must do the following:</p>
<ol>
<li> Create an empty file named <em>.reload</em> at the root of the module :<br />
<em>domain-dir/applications/j2ee-modules/context-root/.reload</em></li>
<li>Explicitly update the .reload file’s time stamp each time you make these changes. On UNIX, execute<br />
<em><strong>touch</strong> .reload</em></li>
</ol>
<p>For JSP pages, changes are reloaded automatically at a frequency set in the Reload Poll Interval field. To disable dynamic reloading of JSP pages, set the Reload Poll Interval field value to –1.</p>
<p><strong>Undeploying Web Modules</strong><br />
To use <strong><em>NetBeans IDE</em></strong>:</p>
<ol>
<li>Ensure the Sun Java System Application Server is running.</li>
<li>In the Runtime window, expand the Sun Java System Application Server instance and the node containing the application or module.</li>
<li>Right-click the application or module and choose Undeploy.</li>
</ol>
<p>To use the <strong><em>Admin Console:</em></strong></p>
<ol>
<li> Open the URL http://localhost:4848/asadmin in a browser.</li>
<li>Expand the Applications node.</li>
<li>Select Web Applications.</li>
<li>Click the check box next to the module you wish to undeploy.</li>
<li>Click the Undeploy button.</li>
</ol>
<p>Use the <strong><em>asadmin command </em></strong>as <em>&#8220;<strong>asadmin</strong> undeploy context-root</em>&#8220;<br />
To use the <em><strong>Ant tool</strong></em>, execute the following command in the directory where you built and packaged the WAR:<br />
&#8220;<em><strong>ant </strong>undeploy&#8221;</em></p>
<h2><strong>Configuring Web Applications</strong></h2>
<p><strong>Mapping URLs to Web Components</strong><br />
When a request is received by the web container it must determine which web component should handle the request. It does so by mapping the URL path contained in the request to a web application and a web component.</p>
<p>A URL path contains the context root and an alias<br />
&#8220;<em>http://host:port/context-root/alias&#8221;</em></p>
<p><strong>The Component Alias</strong></p>
<ol>
<li>The <em>alias</em> identifies the web component that should handle a request.</li>
<li>The <em>alias path</em> must <em>start with a forward slash (/)</em> and <em>end with a string or a wildcard expression</em> with an extension (for example, *.jsp).</li>
<li>Since web containers automatically map an alias that ends with *.jsp, you do not have to specify an alias for a JSP page unless you wish to refer to the page by a name other than its file name.</li>
</ol>
<p><strong>Declaring Welcome Files</strong></p>
<ol>
<li> The <em>welcome files</em> mechanism allows you to specify a list of files that the web container will use for appending to a request for a URL (called a <em>valid partial request</em>) that is not mapped to a web component.</li>
<li>If a web container receives a valid partial request, the web container examines the welcome file list and appends to the partial request each welcome file in the order specified and checks whether a static resource or servlet in the WAR is mapped to that request URL. The web container then sends the request to the first resource in the WAR that matches.</li>
<li>If no welcome file is specified, the Application Server will use a file named index.XXX, where XXX can be html or jsp, as the default welcome file. If there is no welcome file and no file named index.XXX, the Application Server returns a directory listing.</li>
</ol>
<p>To specify a welcome file in the web application deployment descriptor, do the following:</p>
<ul>
<li> Open <em>web.xml</em></li>
<li>Specify the JSP pages using <em>welcome-file</em> elements and include these elements inside a <em>welcome-file-list</em> element. The welcome-file element defines the JSP page to be used as the welcome page.</li>
</ul>
<p><strong> Setting Initialization Parameters</strong><br />
You can pass initialization parameters to the context or to a web component.</p>
<p>To add a context parameter, do the following:</p>
<ol>
<li> Open <em>web.xml</em>.</li>
<li>Using the following elements to add a context parameter
<ul>
<li>A param-name element that specifies the context object</li>
<li>A param-value element that specifies the parameter to pass to the context object</li>
<li>A context-param element that encloses the previous two elements</li>
</ul>
</li>
</ol>
<p>To add a web component initialization parameter, do the following:</p>
<ol>
<li>Open <em>web.xml.</em></li>
<li>Using the following elements to add a context parameter
<ul>
<li>A param-name element that specifies the name of the initialization parameter</li>
<li>A param-value element that specifies the value of the initialization parameter</li>
<li>An init-param element that encloses the previous two elements</li>
</ul>
</li>
</ol>
<p><strong>Mapping Errors to Error Screens</strong><br />
When an error occurs during execution of a web application, you can have the application display a specific error screen according to the type of error.</p>
<p>To set up error mappings, do the following:</p>
<ol>
<li> Open web.xml</li>
<li>Using the following elements
<ul>
<li>An exception-type element specifying either the exception or the HTTP status code that will cause the error page to be opened.</li>
<li>A location element that specifies the name of a web resource to be invoked when the status code or exception is returned. The name should have a leading forward slash (/).</li>
<li>An error-page element that encloses the previous two elements.<br />
You can have multiple error-page elements in your deployment descriptor.</li>
</ul>
</li>
</ol>
<p><strong>Declaring a Reference to a Resource</strong></p>
<ol>
<li>The @Resource annotation is used to declare a reference to a resource such as a data source, an enterprise bean, or an environment entry.</li>
<li>This annotation is equivalent to declaring a resource-ref element in the deployment descriptor.</li>
<li>The @Resource annotation is specified on a class, method or field.</li>
<li>The container is responsible for injecting references to resources declared by the @Resource annotation and mapping it to the proper JNDI resources.</li>
</ol>
<p><strong><em> Example</em></strong></p>
<div>
<table style="height:116px;" border="0" width="297">
<tbody>
<tr>
<td><em><strong>@Resource</strong> javax.sql.DataSource catalogDS;</em></p>
<p><em>public getProductsByCategory() {<br />
// get a connection and execute the query<br />
Connection conn = catalogDS.getConnection();<br />
..</em></p>
<p><em> }</em></td>
</tr>
</tbody>
</table>
</div>
<p>If you have multiple resources that you need to inject into one component, you need to use the @Resources annotation to contain them, as shown by the following example</p>
<div>
<table style="height:94px;" border="0" width="227">
<tbody>
<tr>
<td><em><strong>@Resources</strong> ({<br />
@Resource (name=&#8221;myDB&#8221; type=java.sql.DataSource),<br />
@Resource(name=&#8221;myMQ&#8221; type=javax.jms.ConnectionFactory)<br />
})</em></td>
</tr>
</tbody>
</table>
</div>
<p><strong>Declaring a Reference to a Web Service</strong></p>
<ol>
<li> The @WebServiceRef annotation provides a reference to a web service.</li>
<li>WebServiceRef uses the wsdlLocation element to specify the URI of the deployed service’s WSDL file.</li>
</ol>
<p><em><strong>Example</strong></em></p>
<div>
<table style="height:98px;" border="0" width="297">
<tbody>
<tr>
<td><em>&#8230;<br />
import javax.xml.ws.WebServiceRef;<br />
&#8230;<br />
public class ResponseServlet extends HTTPServlet {<br />
@WebServiceRef(wsdlLocation=<br />
&#8220;http://localhost:8080/helloservice/hello?wsdl&#8221;)<br />
static HelloService service;</em></td>
</tr>
</tbody>
</table>
</div>
<p><strong>REFERENCES</strong></p>
<ol>
<li>http://java.sun.com/javaee/5/docs/tutorial/doc/geysj.html</li>
<li>http://java.sun.com/javaee/5/docs/tutorial/doc/bnadx.html</li>
<li>http://java.sun.com/javaee/5/docs/tutorial/doc/</li>
</ol>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[PM with J2EE experince]]></title>
<link>http://spillerlaszlo.wordpress.com/?p=2178</link>
<pubDate>Thu, 24 Sep 2009 15:22:09 +0000</pubDate>
<dc:creator>Spiller László</dc:creator>
<guid>http://spillerlaszlo.wordpress.com/?p=2178</guid>
<description><![CDATA[Duties: Developing connected services for iGO My way GPS navigation software. Requirements: 3-4 year]]></description>
<content:encoded><![CDATA[Duties: Developing connected services for iGO My way GPS navigation software. Requirements: 3-4 year]]></content:encoded>
</item>
<item>
<title><![CDATA[Quartz Job]]></title>
<link>http://bittersweetjava.wordpress.com/2009/09/23/quartz-job/</link>
<pubDate>Wed, 23 Sep 2009 18:32:23 +0000</pubDate>
<dc:creator>.|2ic|K</dc:creator>
<guid>http://bittersweetjava.wordpress.com/2009/09/23/quartz-job/</guid>
<description><![CDATA[For one of the applications that I&#8217;m maintaining, I was performing several manual validations ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>For one of the applications that I&#8217;m maintaining, I was performing several manual validations on the tables a few times a day; in order to facilitate this tasks, I created a stored procedure to handle them and then send an email with the results using MSSQL mail service.<br />
Also, I wanted this procedure to be executed several times a day, that&#8217;s why I decided to use <a href="http://www.opensymphony.com/quartz/">Quartz</a> in order to create a scheduled job for my web application that will call my recently created procedure.</p>
<p>First, I created the class that will represent the Job I want to execute. This class <em>must</em> implement the class </p>
<p><strong>org.quartz.Job</strong>, overriding the method <em>execute(..)</em></p>
<p><code>package com.dashboard.util;<br />
import org.apache.log4j.Logger;<br />
import org.quartz.Job;<br />
import org.quartz.JobExecutionContext;<br />
import org.quartz.JobExecutionException;<br />
import com.dashboard.forms.DashboardForm;<br />
import com.dashboard.services.IService;<br />
import com.dashboard.services.ValuationHealthCheckService;<br />
</code><code><br />
public class ValuationHealthCheckJob implements Job {<br />
&#160;&#160;&#160;&#160;private static final Logger logger = Logger.getLogger(ValuationHealthCheckService.class);<br />
</code><code><br />
&#160;&#160;&#160;&#160;@Override<br />
&#160;&#160;&#160;&#160;public void execute(JobExecutionContext arg0) throws JobExecutionException {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DashboardForm form = new DashboardForm();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;form.setEmailTo("xxxxx.yyyyy@domain.com");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;IService service = new ValuationHealthCheckService();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;service.execute(form);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} catch (Exception e) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;logger.error(e);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}<br />
&#160;&#160;&#160;&#160;}<br />
}</code></p>
<p>As you can see, the body of the method execute is really simple. A <strong>DashboardForm</strong> class, which is simply a java bean with a field &#8220;<em>emailTo</em>&#8221; and then the creation and execution of my service class. The service class will take care of connecting to the database and execute the stored procedure that will verify the tables and send an email with the result.<br />
Here&#8217;s the <strong>ValuationHealthCheckService</strong> class:</p>
<p><code><br />
package com.dashboard.services;<br />
</code><code><br />
import java.sql.Connection;<br />
import java.sql.PreparedStatement;<br />
import java.sql.SQLException;<br />
import javax.naming.Context;<br />
import javax.naming.InitialContext;<br />
import javax.naming.NamingException;<br />
import javax.sql.DataSource;<br />
import org.apache.log4j.Logger;<br />
import com.dashboard.forms.DashboardForm;<br />
</code><code><br />
public class ValuationHealthCheckService implements IService {<br />
</code><code><br />
&#160;&#160;&#160;&#160;private static final Logger logger = Logger.getLogger(ValuationHealthCheckService.class);<br />
</code><code><br />
&#160;&#160;&#160;&#160;@Override<br />
&#160;&#160;&#160;&#160;public void execute(Object o) throws NamingException, SQLException {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DashboardForm form = (DashboardForm) o;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Connection con = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Context ctx = new InitialContext();<br />
</code><code><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/MarginDB");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;con = ds.getConnection();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;String populateAttrs = "{call p_ValuationHealthCheck(?,?)}";<br />
</code><code><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;logger.info("{call p_ValuationHealthCheck(?,?)}");<br />
</code><code><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (form.getEmailTo() == null &#124;&#124; form.getEmailTo().equals("")) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;throw new RuntimeException("You must specify at least one email recipient.");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}<br />
</code><code><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;PreparedStatement populateAttrsStmt = con.prepareStatement(populateAttrs);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;populateAttrsStmt.setString(1, form.getEmailTo());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;populateAttrsStmt.setString(2, form.getEmailCC());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;populateAttrsStmt.execute();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;con.close();<br />
&#160;&#160;&#160;&#160;}<br />
}</code></p>
<p>I&#8217;m retrieving the database connection using the <em>datasource</em> I have defined in <em>Tomcat</em>.<br />
After that, I needed to create the servlet in order to setup the schedule for the job.</p>
<p><code><br />
import java.text.ParseException;<br />
import javax.servlet.http.HttpServlet;<br />
import org.quartz.CronTrigger;<br />
import org.quartz.JobDetail;<br />
import org.quartz.Scheduler;<br />
import org.quartz.SchedulerException;<br />
import org.quartz.SchedulerFactory;<br />
import org.quartz.impl.StdSchedulerFactory;<br />
import com.dashboard.util.ValuationHealthCheckJob;<br />
<code></code><br />
public class QuartzServlet extends HttpServlet {<br />
<code></code><br />
&#160;&#160;&#160;&#160;public QuartzServlet() throws SchedulerException, ParseException {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;SchedulerFactory sf = new StdSchedulerFactory();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Scheduler sched = sf.getScheduler();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// Specify the class of the job I want to execute<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;JobDetail jd = new JobDetail("ValuationHealthCheck", "AppGroup", ValuationHealthCheckJob.class);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// Create a CRON expression<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;CronTrigger ct = new CronTrigger("cronTrigger", "cronTrigger", "<strong>0 0 15-19 * * ?</strong>");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// Add into the Scheduler the job and the trigger<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sched.scheduleJob(jd, ct);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sched.start();<br />
&#160;&#160;&#160;&#160;}<br />
<code></code><br />
}</code></p>
<p>And as a final step, I needed to define the servlet in the <strong>web.xml</strong> file.<br />
<code><br />
&#160;&#160;&#160;&#160;&#60;servlet&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;servlet-name&#62;quartz&#60;/servlet-name&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;servlet-class&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;com.dashboard.servlets.QuartzServlet<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;/servlet-class&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;load-on-startup&#62;1&#60;/load-on-startup&#62;<br />
&#160;&#160;&#160;&#160;&#60;/servlet&#62;<br />
</code></p>
<p>Just restart the Tomcat so the servlet (and our job) is loaded. From now on, our job will be executed using the cron expression we defined in the servlet: <strong>0 0 15-19</strong> . This means that the job will be executed everyday, every hour from 15 (3:00 PM) to 19 (7:00PM).</p>
<p>&#8211;</p>
<p><strong><em>Just a note</em></strong>: Make sure you have the JAR file for Quartz in the WEB-INF/lib directory. I&#8217;m using maven for my web project so you just need to include the Quartz dependency in the <em>pom.xml</em>:<br />
<code><br />
&#160;&#160;&#160;&#160;&#60;dependency&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;groupId&#62;opensymphony&#60;/groupId&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;artifactId&#62;quartz&#60;/artifactId&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;version&#62;1.6.0&#60;/version&#62;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;scope&#62;compile&#60;/scope&#62;<br />
&#160;&#160;&#160;&#160;&#60;/dependency&#62;<br />
</code></p>
<p>&#8211;</p>
<p>That&#8217;s all. This was the simplest solution I found for my problem (due to lack of time). However, I will work on the integration with Spring as soon as I have free time.<br />
<u>For more information on Quartz</u>: <a href="http://www.opensymphony.com/quartz/">http://www.opensymphony.com/quartz/</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Exception Handling in JSF]]></title>
<link>http://technicalbrainwave.wordpress.com/2009/09/21/exception-handling-in-jsf/</link>
<pubDate>Mon, 21 Sep 2009 17:21:05 +0000</pubDate>
<dc:creator>Gift Sam</dc:creator>
<guid>http://technicalbrainwave.wordpress.com/2009/09/21/exception-handling-in-jsf/</guid>
<description><![CDATA[Introduction: We the developers, exert much effort to write perfect code. Regrettably, some times we]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Introduction:</strong></p>
<p>We the developers, exert much effort to write perfect code. Regrettably, some times we may met with an exception or error conditions. While surfing the net, So many questions pointed out, how to handle the exceptions in JSF by showing a custom page instead of Java Stack trace. This article is consecrated for the peoples who wants to handle the exceptions perfectly in their application.</p>
<p>Other frameworks like Struts, provides a better way to handle exceptions by configuring &#60;global-exceptions&#62; in struts-config.xml. Like Struts, JSF 1.2 and below does not provide the notion of a global exception. Now JSF 2.0 have the features of handling exceptions. But this article is all about<em><strong> handling exceptions in JSF1.2</strong></em>.</p>
<p><strong>Better way to handle exception:</strong></p>
<p><strong> </strong>Surrounding all the Java beans by try/catch can handle all kinds of exceptions this technique is called <strong>c</strong><em><strong>hecked exceptions</strong></em>. but no coders wants all of their java bean methods to be surrounded by try/catch. Instead there is a alternate technique to handle exceptions called <em><strong>Unchecked exceptions</strong></em>. You want to implement any one of the two approaches, if not a default handler is found and  process the exception, resulting the web page in a stack trace.</p>
<p><strong>Unchecked Exceptions:</strong></p>
<p>The goal of this technique is to give you control to catch all the exceptions and let you navigate to an appropriate custom JSP page to generate the error response. To invoke this technique, create a new class that implements javax.faces.event.ActionListener interface.</p>
<blockquote><p><em><strong>Note:</strong></em> It is important that your class is a subclass of this class.</p>
<p>public class ExceptionHandlingActionListener extends ActionListenerImpl</p>
<p>implements ActionListener{..}</p></blockquote>
<p>Then, implement the public void method handleBeanAction(ActionEvent event). This method should invoke the “normal” inherited processAction(ActionEvent event) method, which catches any exceptions and return the navigational string “exceptionOccured”.</p>
<pre class="brush: css;">
public void handleBeanAction(ActionEvent event)
{
try
{
    super.processAction(event);
}
catch (Exception exception)
{
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application application = facesContext.getApplication();
    NavigationHandler navigationHandler =  application.getNavigationHandler();
    navigationHandler.handleNavigation( facesContext, null,“exceptionOccured”);
    facesContext.renderResponse();
}
}</pre>
<p>So by using the above method, when an exception occured, it will be caught in the catch block and the error occured page will be navigated to a custom jsp page.</p>
<p><strong>Configration in faces-config:</strong></p>
<blockquote><p>&#60;application&#62;<br />
&#60;action-listener&#62;<br />
com.mypackagename.ExceptionHandlingActionListener<br />
&#60;/action-listener&#62;<br />
&#60;/application&#62;</p></blockquote>
<blockquote><p>Then implement the navigation rule ,</p>
<p>&#60;navigation-rule&#62;<br />
&#60;navigation-case&#62;<br />
&#60;from-outcome&#62;<br />
exceptionCaught<br />
&#60;/from-outcome&#62;<br />
&#60;to-view-id&#62;/mypages/exceptionPage.jsp&#60;/to-view-id&#62;<br />
&#60;/navigation-case&#62;<br />
&#60;/navigation-rule&#62;</p></blockquote>
<p>Then create a custom exception page in JSP (exceptionPage.jsp). So that when the navigation string “exceptionCaught” occured, the page will be navigated to the desired custom JSP page.</p>
<p><strong>HTTP Status Code Exceptions:</strong></p>
<p><strong> </strong>In order to handle HTTP Status code errors like 404 and 500, configure in your web.xml</p>
<blockquote><p>&#60;error-page&#62;<br />
&#60;error-code&#62;404&#60;/error-code&#62;<br />
&#60;location&#62;/mypages/404.html&#60;/location&#62;<br />
&#60;/error-page&#62;</p>
<p>Likewise State 500 in the error code, to handle HTTP Status code error 500</p>
<p><em><strong>Note:</strong></em></p>
<p>In this handling the response page must be an <em><strong>HTML page</strong></em>. So that we can avoid reentrant error in processing the response.</p></blockquote>
<p><strong>Delegating FacesServlet:</strong><br />
An other way to handle exception is to delegating FacesServlet. To say simple, wrapping the FacesServlet by implementing our own custom FacesServlet. Delegating FacesServlet will work only for the JSF1.1.01 and above. Thanks for the resources provided in the site <a href="http://www.jroller.com/mert/entry/handling_errors_with_an_errror">jroller</a>.</p>
<p><strong>FacesServletWrapper.java</strong></p>
<pre class="brush: css;">
package com.mypackage;
import java.io.IOException;
import javax.faces.webapp.FacesServlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class FacesServletWrapper extends HttpServlet
{
    private FacesServlet facesServletDelegate;
    private static final String ERROR_PAGE = &#34;serverErrorPage&#34;;
    private String serverErrorPage;
public void init(ServletConfig servletConfig) throws ServletException
{
    facesServletDelegate= new FacesServlet();
    facesServletDelegate.init(servletConfig);
    serverErrorPage = servletConfig.getInitParameter(ERROR_PAGE);
}
public void destroy()
{
    facesServletDelegate.destroy();
}
public ServletConfig getServletConfig()
{
    return facesServletDelegate.getServletConfig();
}
public String getServletInfo()
{
    return facesServletDelegate.getServletInfo();
}
public void service(ServletRequest request, ServletResponse response)
            throws ServletException, IOException
{
    try
    {
        facesServletDelegate.service(request,response);
    }
    catch(Throwable e)
    {
        redirectToServerErrorPage((HttpServletRequest) request,
                           (HttpServletResponse) response);
    }
}
private void redirectToServerErrorPage(HttpServletRequest request,
             HttpServletResponse response) throws IOException
{
    if (!serverErrorPage.equals(&#34;&#34;))
    {
        response.sendRedirect(request.getContextPath() + serverErrorPage);
    }
}</pre>
<p><strong>Configuration in web.xml:</strong></p>
<blockquote><p><em><strong> Note:</strong></em> As stated below, replace the FacesServlet servlet description with the FacesServletWrapper</p>
<p>&#60;servlet&#62;<br />
&#60;servlet-name&#62;FacesServlet&#60;/servlet-name&#62;<br />
&#60;servlet-class&#62;com.mypackage.FacesServletWrapper&#60;/servlet-class&#62;<br />
&#60;init-param&#62;<br />
&#60;param-name&#62;serverErrorPage&#60;/param-name&#62;<br />
&#60;param-value&#62;/faces/mypages/serverErrorPage.jsp&#60;/param-value&#62;<br />
&#60;/init-param&#62;<br />
&#60;load-on-startup&#62;1&#60;/load-on-startup&#62;<br />
&#60;/servlet&#62;</p>
<p>Once replacing the FacesServlet servlet description with the FacesServletWrapper, dont forget to specify the servlet-mapping description as stated below</p>
<p>&#60;servlet-mapping&#62;<br />
&#60;servlet-name&#62;FacesServlet&#60;/servlet-name&#62;<br />
&#60;url-pattern&#62;/faces/*&#60;/url-pattern&#62;<br />
&#60;/servlet-mapping&#62;</p></blockquote>
<p>The preceding code, wrapping the FacesServlet works perfectly with Tomcat. But if anyone uses Glassfish(Sun Java System Application Server). You may get an exception some thing like the below.</p>
<blockquote><p>java.lang.RuntimeException:  Exception in handleBeforeEvent.</p></blockquote>
<p>If you met with the same kind of exception. Here is the solution to resolve this error, <em><strong>implement servlet interface instead of extending HttpServlet</strong></em>. So I hope this article clearly explains, the several ways to handle exceptions in JSF. <em><strong>If you find this article is quite useful, Dont forget to share with me by your valuable comments</strong></em>. Have a joyous code day.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[R12 – socket to servlet mode conversion]]></title>
<link>http://learnwithme11g.wordpress.com/2009/09/20/r12-%e2%80%93-socket-to-servlet-mode-conversion/</link>
<pubDate>Sun, 20 Sep 2009 06:42:59 +0000</pubDate>
<dc:creator>learnwithme11g</dc:creator>
<guid>http://learnwithme11g.wordpress.com/2009/09/20/r12-%e2%80%93-socket-to-servlet-mode-conversion/</guid>
<description><![CDATA[R12 – socket to servlet mode conversion : Action Steps ============= 1) Source the Env file 2) Stop ]]></description>
<content:encoded><![CDATA[R12 – socket to servlet mode conversion : Action Steps ============= 1) Source the Env file 2) Stop ]]></content:encoded>
</item>
<item>
<title><![CDATA[R12 - servelet to socket mode conversion]]></title>
<link>http://learnwithme11g.wordpress.com/2009/09/20/r12-servelet-to-socket-mode-conversion/</link>
<pubDate>Sun, 20 Sep 2009 06:08:44 +0000</pubDate>
<dc:creator>learnwithme11g</dc:creator>
<guid>http://learnwithme11g.wordpress.com/2009/09/20/r12-servelet-to-socket-mode-conversion/</guid>
<description><![CDATA[R12 &#8211; servelet to socket mode conversion Action Steps ============ 1) Source the Env file 2) S]]></description>
<content:encoded><![CDATA[R12 &#8211; servelet to socket mode conversion Action Steps ============ 1) Source the Env file 2) S]]></content:encoded>
</item>
<item>
<title><![CDATA[Java, MySQL Türkçe Karakter Sorunu]]></title>
<link>http://ferhanakman.wordpress.com/2009/09/18/java-mysql-turkce-karakter-sorunu/</link>
<pubDate>Fri, 18 Sep 2009 20:29:38 +0000</pubDate>
<dc:creator>ferhanakman</dc:creator>
<guid>http://ferhanakman.wordpress.com/2009/09/18/java-mysql-turkce-karakter-sorunu/</guid>
<description><![CDATA[Şuan yaptığım projede, JSP sayfası içerisinde, textboxlar yardımı ile  girdi olarak aldığım inputlar]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;"><img class="alignleft" style="border:1px solid initial;" src="http://t1.gstatic.com/images?q=tbn:eaxF0173BXpm8M:http://www.nothing2hide.net/blog/wp-content/uploads/2008/05/mysql.gif" alt="" width="126" height="84" />Şuan yaptığım projede, JSP sayfası içerisinde, textboxlar yardımı ile  girdi olarak aldığım inputlarımı Servletler aracılığı ile mysql database&#8217;ime atıyorum. Fakat Türkçe karakter sorunu yaşadım. Internetten araştırdığımda bir kaç farklı yol buldum fakat hiç birisi derdime derman olmadı. Bulduğum yollardan bazılarını harmanlayarak kullanınca en sonun Türkçe karakter sorunumu aşabildim:)</p>
<p style="text-align:left;">Birilerinin işine yarar ümidi ile uyguladığım adımları paylaşayım;<img style="float:right;border:0 initial initial;" src="http://t0.gstatic.com/images?q=tbn:7FCQBd0_zAdsbM:http://www.webdestekli.com/moodle/file.php/1/java.jpg" alt="" width="117" height="95" /><br />
1- Öncelikle mysql&#8217;den karakter setini UTF8 seçiyoruz.<br />
2- Java class&#8217;ı tarafında, Connection&#8217;ı tanımlarken normal adresten daha fazlasını kullanıyoruz;<br />
normal adres: <span style="color:#3366ff;"> jdbc:mysql://localhost:[portnumarası]/[db ismi]<br />
<span style="color:#000000;">kullanılması</span><span style="color:#000000;"> gereken:<br />
<span style="color:#3366ff;">jdbc:mysql://localhost:[portnumarası]/[db ismi]</span><strong><span style="color:#3366ff;">?useUnicode=true&#38;characterEncoding=UTF-8</span></strong></span></span></p>
<p style="text-align:left;"><span style="color:#3366ff;"><span style="color:#000000;"><strong><span style="color:#3366ff;"><span style="font-weight:normal;"><span style="color:#000000;">3 - Verileri JSP sayfasından verileri çekmeden önce;  <span style="color:#3366ff;">request.setCharacterEncoding(&#8220;ISO-8859-9&#8243;); <span style="color:#000000;">yazıyoruz..</span><br />
</span></span></span></span></strong><br />
<span style="color:#000000;">artık database&#8217;imize girdiğimiz Türkçe karakterler olması gerektiği gibi görüntülenecek.</span><br />
</span></span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[HƯỚNG DẪN TẠO MỘT SERVLET BẰNG ECLIPSE VÀ TOMCAT]]></title>
<link>http://dbglory.wordpress.com/2009/09/16/h%c6%b0%e1%bb%9bng-d%e1%ba%abn-t%e1%ba%a1o-m%e1%bb%99t-servlet-b%e1%ba%b1ng-eclipse-va-tomcat/</link>
<pubDate>Wed, 16 Sep 2009 18:48:36 +0000</pubDate>
<dc:creator>dbglory</dc:creator>
<guid>http://dbglory.wordpress.com/2009/09/16/h%c6%b0%e1%bb%9bng-d%e1%ba%abn-t%e1%ba%a1o-m%e1%bb%99t-servlet-b%e1%ba%b1ng-eclipse-va-tomcat/</guid>
<description><![CDATA[Chú ý: bài viết này dành cho các newbie nào muốn sử dụng công cụ Eclipse để tạo servlet. ( tất nhiên]]></description>
<content:encoded><![CDATA[Chú ý: bài viết này dành cho các newbie nào muốn sử dụng công cụ Eclipse để tạo servlet. ( tất nhiên]]></content:encoded>
</item>
<item>
<title><![CDATA[Document Management Consultant]]></title>
<link>http://spillerlaszlo.wordpress.com/?p=2165</link>
<pubDate>Mon, 14 Sep 2009 14:03:52 +0000</pubDate>
<dc:creator>Spiller László</dc:creator>
<guid>http://spillerlaszlo.wordpress.com/?p=2165</guid>
<description><![CDATA[Microsoft szerver operációs rendszerek (Windows 2000 Server, Windows 2003 Server) UNIX operációs ren]]></description>
<content:encoded><![CDATA[Microsoft szerver operációs rendszerek (Windows 2000 Server, Windows 2003 Server) UNIX operációs ren]]></content:encoded>
</item>
<item>
<title><![CDATA[Java Knowledge Bank - 1]]></title>
<link>http://meghsoft.wordpress.com/2009/09/13/java-knowledge-bank-1/</link>
<pubDate>Sun, 13 Sep 2009 17:46:43 +0000</pubDate>
<dc:creator>meghsoft</dc:creator>
<guid>http://meghsoft.wordpress.com/2009/09/13/java-knowledge-bank-1/</guid>
<description><![CDATA[Q : Give a few reasons for using Java? A : Java is a fun language. Let’s look at some of the reasons]]></description>
<content:encoded><![CDATA[Q : Give a few reasons for using Java? A : Java is a fun language. Let’s look at some of the reasons]]></content:encoded>
</item>

</channel>
</rss>
