tag:blogger.com,1999:blog-24279073168756719002024-03-14T01:01:11.219-07:00My Software Development BlogProgramming Made Easy
by BijayBijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-2427907316875671900.post-85866767295727142652024-02-23T17:59:00.000-08:002024-03-08T14:26:13.628-08:00Test PageTest page Here
<input type="text" id="lname" name="lname"><br>
<button id="mybutton" type="button" onclick="alert('Clicked!')">Click Me!</button>Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com0tag:blogger.com,1999:blog-2427907316875671900.post-61970100670488771452018-05-18T00:10:00.001-07:002024-02-23T17:56:55.026-08:00Testing A Java Bean For Code Coverage in SonarQube<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-family: Georgia, Times New Roman, serif;"><b><br /></b>
<b>Here is a generic way of testing a java bean to provide 100% code coverage on sonarqube.</b></span><br />
<b><span style="font-family: Georgia, Times New Roman, serif;">Remember, if beans are trivial, please use this approach, otherwise write proper test cases.</span></b><br />
<span style="font-family: Georgia, Times New Roman, serif;"><b><br /></b>
<b><br /></b>
<b>Complete Source code is here -<br />https://gist.github.com/deodeveloper/405bfbaf8ad94a37304dbfe8949f5757</b></span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><b><br /></b>
<b><br /></b><b>Sample Source code -</b></span><br />
<b><br /></b>
<b>import java.lang.reflect.Field;</b><br />
<b>import java.lang.reflect.InvocationTargetException;</b><br />
<b>import org.apache.commons.beanutils.PropertyUtils;</b><br />
<b><br /></b>
<b><span style="font-family: "courier new" , "courier" , monospace;">public class BeanTester {</span></b><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b><br /></b></span>
<span style="font-family: "courier new" , "courier" , monospace;"><b>public static <T> void testBean(Class<T>... beanClasses) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> for (Class<T> beanClass : beanClasses) {</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> T bean = beanClass.newInstance();</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> Field[] declaredFields = beanClass.getDeclaredFields();</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> for (Field f : declaredFields) {</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> PropertyUtils.getProperty(bean, f.getName());</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> Class<?> fieldType = f.getType();</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> PropertyUtils.setProperty(bean, f.getName(),</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> !fieldType.isPrimitive() ? fieldType.newInstance() :</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> defaultValue(fieldType));</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> }</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> }</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b> }</b></span><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></b>
<b><span style="font-family: "courier new" , "courier" , monospace;"> public static <T> T defaultValue(Class<T> type) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> if (type == boolean.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Boolean.FALSE;</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else if (type == char.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Character.valueOf('\0');</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else if (type == byte.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Byte.valueOf((byte) 0);</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else if (type == short.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Short.valueOf((short) 0);</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else if (type == int.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Integer.valueOf(0);</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else if (type == long.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Long.valueOf(0L);</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else if (type == float.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Float.valueOf(0f);</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else if (type == double.class) {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return (T) Double.valueOf(0d);</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> } else {</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> return null;</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> }</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"> }</span></b><br />
<br />
<b><span style="font-family: "courier new" , "courier" , monospace;">}</span></b><br />
<b><br /></b>
<b><span style="font-family: "courier new" , "courier" , monospace;">u</span><span style="font-family: "courier new" , "courier" , monospace;">sage example - testBean(Person.class)</span></b><br />
<b></b>dependencies used:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><dependency></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><groupId>commons-beanutils</groupId></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><artifactId>commons-beanutils</artifactId></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span><version>1.9.3</version></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span></dependency></span><br />
<br />
<br />
<br />
<br /></div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com1tag:blogger.com,1999:blog-2427907316875671900.post-76484824401220934162018-03-11T22:45:00.001-07:002018-03-12T10:32:12.842-07:00Vertx Programming Style : Your Reactive Web Companion REST API Explained<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Vertx provides a lot of options to program in a light weight environment, like node.js . However, It could be little confusing for new users to choose which method to adopt for creating REST API.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">There are different models to adopt while programming in vertx. They are explained below with easy to understand diagrams.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">P.S - The heart of vertx programming is a reference to <b>vertx object</b> which could be obtained statically or as an inherited member with a verticle that extends the AbstractVerticle class. Now you know where to get the vertx object. Let's dive further.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Different Models of programming in vertx falls into the following categories as below, I am adding some funny names to each model :) :-</span><br />
<br />
<ol style="text-align: left;">
<li><span style="font-family: "verdana" , sans-serif;">FaceToFace Approach</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Matchmaker Approach</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Matching Coach Approach</span></li>
</ol>
<br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>Model 1 - FaceToFace Approach</b>:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">As shown in the diagram, in this model client sends the events in forms of http requests which are buffered to server verticle via a <b>Router</b>. A router could be obtained by using </span><span style="font-family: "courier new" , "courier" , monospace;">Router.router(vertx)</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;">Now we can configure the router to handle http requests. Careful, router handlers are synchronous call. To run blocking calls or any async operations, please use executeBlocking or adopt Model#2</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>Model #2 - Matchmaker Approach</b>:</span><br />
<span style="font-family: "verdana" , sans-serif;">As the name suggests, you can't talk to the other person directly, you will have to go through the dating match maker which is the event bus. This is model is useful when you have a lot of micro services running on different machines or you want to modularize your code in a single machine. A message has header, body, address and by calling message.reply(Object), the receiver verticle can send response back to the sender.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2W5GqMARLJDGL84CXV65JicIm-AyC29fOt7HZs9r15wQ1youlsZO7p8bRdSkS3XSDqA39U2BNWmLBkrbDQod7vm7hhxKHHkxFqOUegJqDT3BFNLxG7_1OTBEpJSDo8c-poTmKrkHjQGo/s1600/vertx+model+3.jpg" imageanchor="1"><img border="0" height="440" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2W5GqMARLJDGL84CXV65JicIm-AyC29fOt7HZs9r15wQ1youlsZO7p8bRdSkS3XSDqA39U2BNWmLBkrbDQod7vm7hhxKHHkxFqOUegJqDT3BFNLxG7_1OTBEpJSDo8c-poTmKrkHjQGo/s640/vertx+model+3.jpg" width="640" /></a></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>Model 3: Matching Coach Approach</b>:</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;">Here The matchmaker becomes a coach too who will help you how to connect other verticle. It helps by code generation to bind service with event bus so that it would be easier to call service methods.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The main idea is a service name <b>Service (java interface)</b> and corresponding implementation <b>Service Implementation </b>to be exposed as a REST API. But it can't be that straight forward in vertx as in spring web or other frameworks. For Service interface to be exposed, you need to create a AsyncService interface and it's implementation which will mimic Service methods but the signatures will be little different.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Example: In Service interface, you have a method as below:</span><br />
<pre style="background-color: #2b2b2b; color: #a9b7c6; font-family: 'Menlo'; font-size: 10.5pt;"><span style="color: #cc7832;">public </span>User <span style="color: #ffc66d;">getUser</span>(<span style="color: #cc7832;">final </span>String verificationToken) {...}</pre>
<br />
<span style="font-family: "verdana" , sans-serif;">In async service interface, the same looks like, </span><br />
<pre style="background-color: #2b2b2b; color: #a9b7c6; font-family: 'Menlo'; font-size: 10.5pt;"><span style="color: #cc7832;">void </span><span style="color: #ffc66d;">getUser</span>(String verificationToken<span style="color: #cc7832;">, </span><span style="color: mediumaquamarine;">Handler</span><<span style="color: mediumaquamarine;">AsyncResult</span><User>> resultHandler)</pre>
<br />
<span style="font-family: "verdana" , sans-serif;">Here we adding an extra argument to the method in form of a vertx Handler that returns an AsyncResult which makes it possible for non-blocking call. Also the return type is void. The result could obtained from the client side using the resultHandler callback.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI2yUn7Lp2NTOAdV8tg0n1RdBxjxA30gSQyeUl3SUAMpKjc9G8CYUFfteaYmHJ9sKFlqYmHIGnzgQwqmipo17aInsF5wUGFFhaw5HmRvQSWKOrgmLiokDz65eJyXUmkJkrOEEnhOHMB0o/s1600/vertx+model+1-2.jpg" imageanchor="1"><img border="0" height="440" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI2yUn7Lp2NTOAdV8tg0n1RdBxjxA30gSQyeUl3SUAMpKjc9G8CYUFfteaYmHJ9sKFlqYmHIGnzgQwqmipo17aInsF5wUGFFhaw5HmRvQSWKOrgmLiokDz65eJyXUmkJkrOEEnhOHMB0o/s640/vertx+model+1-2.jpg" width="640" /></a></span><br />
<br />
Please leave your comments below.<br />
<br />
Happy Coding!</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com2tag:blogger.com,1999:blog-2427907316875671900.post-11336067285382943742017-10-19T08:27:00.002-07:002017-10-19T08:44:39.500-07:00URLify in java 8 style functional flavor<div dir="ltr" style="text-align: left;" trbidi="on">
<br class="Apple-interchange-newline" />
<h2 style="text-align: left;">
Write a method to replace all spaces in a string with '%20'</h2>
<br />
Instead of using str.replaceAll("\\s", "%20"), here is a function. <span style="font-family: times;">This exercise is to help learning.</span><br />
<br /><br /><br class="Apple-interchange-newline" /><table class="highlight tab-size js-file-line-container" data-tab-size="8" style="background-color: white; border-collapse: collapse; border-spacing: 0px; box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 14px; tab-size: 8;"><tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="1" id="file-urlify-java-L1" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC1" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">public</span> <span class="pl-smi" style="box-sizing: border-box;">String</span> URLifyJava8(<span class="pl-smi" style="box-sizing: border-box;">String</span> str) {</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="2" id="file-urlify-java-L2" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC2" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">return</span> str<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>chars()</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="3" id="file-urlify-java-L3" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC3" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> .mapToObj(c <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">-</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">></span> (<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">char</span>) c)</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="4" id="file-urlify-java-L4" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC4" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> .flatMap(c <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">-</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">></span> <span class="pl-smi" style="box-sizing: border-box;">Character</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>isWhitespace(c)</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="5" id="file-urlify-java-L5" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC5" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">?</span> <span class="pl-s" style="box-sizing: border-box; color: #032f62;"><span class="pl-pds" style="box-sizing: border-box;">"</span>%20<span class="pl-pds" style="box-sizing: border-box;">"</span></span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>chars()<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>mapToObj(ch <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">-</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">></span> (<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">char</span>) ch) <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">:</span> <span class="pl-smi" style="box-sizing: border-box;">Stream</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>of(c))</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="6" id="file-urlify-java-L6" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC6" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> .collect(<span class="pl-smi" style="box-sizing: border-box;">Collector</span></td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="7" id="file-urlify-java-L7" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC7" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> .of(<span class="pl-smi" style="box-sizing: border-box;">StringBuilder</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">::</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">new</span>, StringBuilder::append,</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="8" id="file-urlify-java-L8" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC8" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> (r1, r2) <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">-</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">></span> {</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="9" id="file-urlify-java-L9" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC9" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> r1<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>append(r2);</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="10" id="file-urlify-java-L10" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC10" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">return</span> r1;</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="11" id="file-urlify-java-L11" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC11" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> },</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="12" id="file-urlify-java-L12" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC12" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> <span class="pl-smi" style="box-sizing: border-box;">StringBuilder</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">::</span>toString, <span class="pl-smi" style="box-sizing: border-box;">Collector</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span><span class="pl-smi" style="box-sizing: border-box;">Characteristics</span><span class="pl-c1" style="box-sizing: border-box; color: #005cc5;"><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>CONCURRENT</span>));</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="13" id="file-urlify-java-L13" style="box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="file-urlify-java-LC13" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"> }</td></tr>
</tbody></table>
<table class="highlight tab-size js-file-line-container" data-tab-size="8" style="background-color: white; border-collapse: collapse; border-spacing: 0px; box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 14px; tab-size: 8;"><tbody style="box-sizing: border-box;">
</tbody></table>
<table class="highlight tab-size js-file-line-container" data-tab-size="8" style="background-color: white; border-collapse: collapse; border-spacing: 0px; box-sizing: border-box; color: #24292e; font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 14px; tab-size: 8;"><tbody style="box-sizing: border-box;">
</tbody></table>
</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com53tag:blogger.com,1999:blog-2427907316875671900.post-2511217683479129392013-06-06T17:45:00.003-07:002013-06-06T17:45:58.968-07:00JQuery XML find method problem - Webkit and chrome fix<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<br />
If you have xml element tag like this <gml:featureMember>, then jQuery(xml).find("gml\\:featureMember").each(function(){}); will not work across all the browsers, it works in IE and firefox.<br />
<br />
<br />
To fix it, use as below<br />
<br /><pre class="javascript" style="-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; -webkit-text-stroke-width: 0px; background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; color: #110000; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16px !important; margin: 0px !important; orphans: auto; overflow: visible !important; padding: 0px 4px !important; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre !important; widows: auto; width: auto !important; word-spacing: 0px; word-wrap: break-word;">$<span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span>xml<span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">)</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">find</span><span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #3366cc; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">"gml\\:featureMember,featureMember"</span><span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">)</span>.<span style="border: 0px; color: #660066; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">each</span><span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #000066; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: bold; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">function</span><span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">)</span> <span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">{</span>
<span style="border: 0px; color: #006600; font-family: inherit; font-size: inherit; font-style: italic; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">// Do stuff</span>
<span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span style="border: 0px; color: #009900; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span style="border: 0px; color: #339933; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">;</span></pre>
<pre class="javascript" style="-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; -webkit-text-stroke-width: 0px; background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; color: #110000; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16px !important; margin: 0px !important; orphans: auto; overflow: visible !important; padding: 0px 4px !important; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre !important; widows: auto; width: auto !important; word-spacing: 0px; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span></pre>
<pre class="javascript" style="-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; -webkit-text-stroke-width: 0px; background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; color: #110000; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16px !important; margin: 0px !important; orphans: auto; overflow: visible !important; padding: 0px 4px !important; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre !important; widows: auto; width: auto !important; word-spacing: 0px; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span></pre>
<br />
This works across all the browser.<pre class="javascript" style="-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; -webkit-text-stroke-width: 0px; background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; color: #110000; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16px !important; margin: 0px !important; orphans: auto; overflow: visible !important; padding: 0px 4px !important; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre !important; widows: auto; width: auto !important; word-spacing: 0px; word-wrap: break-word;"><span style="border: 0px; color: #339933; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span></pre>
</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com2tag:blogger.com,1999:blog-2427907316875671900.post-52862330752304679302013-01-25T15:14:00.001-08:002013-10-23T18:33:20.373-07:00Accept Self signed certificate in JAVA<div dir="ltr" style="text-align: left;" trbidi="on">
<br>
<h2 style="text-align: left;">
Accept Self signed certificate in JAVA.</h2>
Have you ever faced problem with <span style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px;">SSLHandshakeException ?</span><br>
<span style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px;"><br></span>
This is because you are trying to use a website which uses an non-standard https certificate which are not registered on JRE. If you want a self signed certificate web request to be accepted, here is the code.<br>
<br>
<br>
<pre class="lang-java prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> java</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">URL</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> java</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">security</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SecureRandom</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> java</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">security</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">cert</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">CertificateException</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> java</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">security</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">cert</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">X509Certificate</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> javax</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ssl</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">HostnameVerifier</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> javax</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ssl</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">HttpsURLConnection</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> javax</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ssl</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">KeyManager</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> javax</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ssl</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SSLContext</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> javax</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ssl</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SSLSession</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> javax</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ssl</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">TrustManager</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">import</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> javax</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ssl</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">X509TrustManager</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">public</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">class</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SSLTest</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">public</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">static</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">void</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> main</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">String</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">[]</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> args</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">throws</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Exception</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// configure the SSLContext with a TrustManager</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SSLContext</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> ctx </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SSLContext</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">getInstance</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"TLS"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
ctx</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">init</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">KeyManager</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">[</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">0</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">],</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">TrustManager</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">[]</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">DefaultTrustManager</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">()},</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SecureRandom</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">());</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SSLContext</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">setDefault</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">ctx</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
URL url </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> URL</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"https://mms.nw.ru"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">HttpsURLConnection</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> conn </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">HttpsURLConnection</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> url</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">openConnection</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">();</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
conn</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">setHostnameVerifier</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">HostnameVerifier</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">()</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">@Override</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">public</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">boolean</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> verify</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">String</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> arg0</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">SSLSession</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> arg1</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">return</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">true</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">});</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">System</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">out</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">println</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">conn</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">getResponseCode</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">());</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
conn</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">disconnect</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">();</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">private</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">static</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">class</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">DefaultTrustManager</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">implements</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> X509TrustManager </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">@Override</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">public</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">void</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> checkClientTrusted</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">X509Certificate</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">[]</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> arg0</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">String</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> arg1</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">throws</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">CertificateException</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">@Override</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">public</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">void</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> checkServerTrusted</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">X509Certificate</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">[]</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> arg0</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">String</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> arg1</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">throws</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">CertificateException</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">@Override</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">public</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> X509Certificate</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">[]</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> getAcceptedIssuers</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">()</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">return</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">null</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span></code></pre>
</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com0tag:blogger.com,1999:blog-2427907316875671900.post-8496926200212391432013-01-04T08:52:00.001-08:002013-01-04T12:17:36.634-08:00Convert EPGS to WGS84 using open layer<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- <script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/OpenLayers/Util.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/OpenLayers/BaseTypes/Class.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/OpenLayers/Ajax.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/OpenLayers/BaseTypes.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/OpenLayers/Projection.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/proj4js/lib/proj4js-compressed.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/proj4js/lib/defs/EPSG102711.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/proj4js/lib/projCode/tmerc.js"></script>
<script type="text/javascript" src="http://www.pseg.com/outagemap/openlayers/lib/OpenLayers/BaseTypes/LonLat.js"></script> -->
<br />
This is useful when you want to convert your EPSG to google or bing map co-ordinate.<br />
<br />
<br />
var projWGS84 = new OpenLayers.Projection("EPSG:4326");<br />
<br />
var proj900913 = new OpenLayers.Projection("EPSG:102711");<br />
<br />
var orinialPoint = new OpenLayers.LonLat(609638.467487335, 691427.100266891);<br />
<br />
var newPoint = orinialPoint.transform(proj900913, projWGS84);<br />
<br />
<br />
<pre style="left: -1000px; position: fixed;">var projWGS84 = new OpenLayers.Projection("EPSG:4326");
var proj900913 = new OpenLayers.Projection("EPSG:102711");
var orinialPoint = new OpenLayers.LonLat(609638.467487335, 691427.100266891);
var newPoint = orinialPoint.transform(proj900913, projWGS84);
</pre>
<pre style="left: -1000px; position: fixed;">var projWGS84 = new OpenLayers.Projection("EPSG:4326");
var proj900913 = new OpenLayers.Projection("EPSG:102711");
var orinialPoint = new OpenLayers.LonLat(609638.467487335, 691427.100266891);
var newPoint = orinialPoint.transform(proj900913, projWGS84);
var projWGS84 = new OpenLayers.Projection("EPSG:4326");
var proj900913 = new OpenLayers.Projection("EPSG:102711");
var orinialPoint = new OpenLayers.LonLat(609638.467487335, 691427.100266891);
var newPoint = orinialPoint.transform(proj900913, projWGS84);
</pre>
<br />
<pre style="left: -1000px; position: fixed;">var projWGS84 = new OpenLayers.Projection("EPSG:4326");
var proj900913 = new OpenLayers.Projection("EPSG:102711");
var orinialPoint = new OpenLayers.LonLat(609638.467487335, 691427.100266891);
var newPoint = orinialPoint.transform(proj900913, projWGS84);
</pre>
<br />
Now you can use this newPoint on your preferred map.</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com3tag:blogger.com,1999:blog-2427907316875671900.post-64501733660240553462012-11-21T13:46:00.000-08:002013-02-22T06:24:23.132-08:00Google Guice Quick Reference<div dir="ltr" style="text-align: left;" trbidi="on">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Calibri","sans-serif";
mso-bidi-font-family:"Times New Roman";}
</style>
<![endif]-->
<br />
<h2 align="center" class="MsoNormal" style="text-align: center;">
Google Guice Quick Reference</h2>
<div class="MsoNormal">
<u><b style="mso-bidi-font-weight: normal;"><span style="font-size: 18.0pt; line-height: 115%;"> </span></b>bold marked words in code are derived from guice library</u></div>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<br />
<div align="center" class="MsoNormal" style="text-align: center; text-indent: .5in;">
Google
Guice Cheat Sheet </div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 18.0pt; line-height: 115%;">Basic @Inject</span></b></div>
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="mso-list: l0 level1 lfo1;">Service Consumer Class</li>
</ol>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@<b style="mso-bidi-font-weight: normal;">Inject</b></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> processor</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">,</span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span></pre>
<pre style="background: #EEEEEE; margin-left: .25in; text-indent: .25in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">this</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">processor </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> processor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">this</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span class="pun"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<ol start="2" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="mso-list: l0 level1 lfo1;">Guice Configuration Class </li>
</ol>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">AbstractModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Override</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> configure</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">// <span style="background: yellow; mso-highlight: yellow;">Class binding</span></span></span><span class="pln"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"></span></span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> <span style="mso-spacerun: yes;"> </span><b style="mso-bidi-font-weight: normal;">bind</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">in</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066;">Singleton</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PaypalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">//or <span style="background: yellow; mso-highlight: yellow;">instance binding</span></span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">toInstance</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(new </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PaypalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">());</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<ol start="3" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="mso-list: l0 level1 lfo1;">Client Class</li>
</ol>
<pre style="background: #EEEEEE; margin-left: .25in;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></pre>
<pre style="background: #EEEEEE;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Injector</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> injector </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Guice</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">createInjector</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingModule</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">());</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="com"><span style="color: #880000; font-family: "Lucida Console"; font-size: 9.0pt;">/*</span></span><span style="color: #880000; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="com"> * Now that we've got the injector, we can build objects.</span>
<span class="com"> */</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> billingService= injector</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">getInstance</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span></pre>
<pre style="background: #EEEEEE;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></pre>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 18.0pt; line-height: 115%;">Extention @Inject</span></b></div>
<div class="MsoNormal" style="margin-left: .25in;">
1<span style="font-size: 14.0pt; line-height: 115%;">.<b style="mso-bidi-font-weight: normal;">Linked Binding</b></span>
– Link <span style="background: white; color: black; font-family: "Lucida Console"; font-size: 9.0pt; line-height: 115%;">DatabaseTransactionLog to </span><span style="background: white; color: black; font-family: "Arial","sans-serif"; font-size: 10.0pt; line-height: 115%;">subclass </span><span style="background: white; color: black; font-family: "Lucida Console"; font-size: 9.0pt; line-height: 115%;">MySqlDatabaseTransactionLog.
You can <b style="mso-bidi-font-weight: normal;">chain</b> this linking. Injector
will return instance of MySqlDatabaseTransactionLog</span></div>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">AbstractModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Override</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> configure</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> <span style="background: yellow; mso-highlight: yellow;">bind</span></span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">(</span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">DatabaseTransactionLog</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">.</span></span><span class="kwd"><span style="background: yellow; color: #000088; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">class</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">).</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">to</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">(</span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">MySqlDatabaseTransactionLog</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">.</span></span><span class="kwd"><span style="background: yellow; color: #000088; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">class</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .25in;">
2.<b style="mso-bidi-font-weight: normal;"><span style="font-size: 14.0pt; line-height: 115%;">Binding Annotation</span></b>
–</div>
<div class="MsoNormal" style="margin-left: .5in; mso-list: l1 level1 lfo6; text-indent: -.25in;">
<span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;"><span style="mso-list: Ignore;">Ø<span style="font: 7.0pt "Times New Roman";">
</span></span></span>2a . <b style="mso-bidi-font-weight: normal;">@Named</b></div>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Inject</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@<b style="mso-bidi-font-weight: normal;">Named</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"PayPal"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> processor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .25in; text-indent: .25in;">
- Guice
Configuration </div>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotatedWith</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Names</span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">named</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"PayPal"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">))</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PayPalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .25in;">
<br /></div>
<div class="MsoNormal" style="margin-left: .75in; mso-list: l5 level1 lfo5; text-indent: -.25in;">
<span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;"><span style="mso-list: Ignore;">Ø<span style="font: 7.0pt "Times New Roman";">
</span></span></span>2b.<span style="font-size: 12.0pt; line-height: 115%;">Custom Annotation @PayPal</span></div>
<div class="MsoNormal" style="margin-left: 45.8pt;">
a.Client Guice Configuration</div>
<pre style="background: #EEEEEE; margin-left: 45.8pt;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">import</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> com</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">google</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">inject</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BindingAnnotation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">import</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> java</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">lang</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Target</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">import</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> java</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">lang</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Retention</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">import</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">static</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> java</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">lang</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RetentionPolicy</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">RUNTIME</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">import</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">static</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> java</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">lang</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">ElementType</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">PARAMETER</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">import</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">static</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> java</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">lang</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">ElementType</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">FIELD</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">import</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">static</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> java</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">lang</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">ElementType</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">METHOD</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="lit"><b style="mso-bidi-font-weight: normal;"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@BindingAnnotation</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></b></span><span class="lit"><b style="mso-bidi-font-weight: normal;"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Target</span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">({</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> FIELD</span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> PARAMETER</span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> METHOD </span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">})</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></b></span><span class="lit"><b style="mso-bidi-font-weight: normal;"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Retention</span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">RUNTIME</span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></b></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="lit"><span style="background: yellow; color: #006666; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">@<b style="mso-bidi-font-weight: normal;">interface</b></span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> </span></b></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">PayPal</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: 45.8pt;">
b.Service Consumer</div>
<pre style="background: #EEEEEE; margin-left: 45.8pt;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Inject</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="lit"><span style="background: yellow; color: #006666; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">@PayPal</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> processor)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .5in; text-indent: 9.8pt;">
c. Client</div>
<pre style="background: #EEEEEE; margin-left: 45.8pt;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">annotatedWith</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">(</span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">PayPal</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">.</span></span><span class="kwd"><span style="background: yellow; color: #000088; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">class</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PayPalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .5in; text-indent: 9.8pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 45.8pt; mso-list: l3 level1 lfo4; text-indent: -.25in;">
<span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;"><span style="mso-list: Ignore;">Ø<span style="font: 7.0pt "Times New Roman";">
</span></span></span>2c<b style="mso-bidi-font-weight: normal;">.@</b><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; line-height: 115%;">Provides –</span></b><span style="font-size: 12.0pt; line-height: 115%;">create</span><b style="mso-bidi-font-weight: normal;"> </b>an object with some code instade of
single line toInstance method</div>
<div class="MsoNormal" style="margin-left: 45.8pt; text-indent: 9.8pt;">
Guice
Configuration </div>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">AbstractModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span></pre>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span></span></span><span class="pun"><span style="color: #666600;">// Add any subannotation if required like @PayPal</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@<b style="mso-bidi-font-weight: normal;">Provides</b></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> provideTransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLog</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLog </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">setJdbcUrl</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"jdbc:mysql://localhost/pizza"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">setThreadPoolSize</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">30</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">return</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: 45.8pt; mso-list: l4 level1 lfo3; text-indent: -.25in;">
<span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;"><span style="mso-list: Ignore;">Ø<span style="font: 7.0pt "Times New Roman";">
</span></span></span><span style="font-size: 12.0pt; line-height: 115%;">2d.Provider
Binding</span> – Alternative to @Provides by moving instance production logic
to a separate class</div>
<div class="MsoNormal" style="margin-left: 45.8pt; text-indent: 9.8pt;">
a.Guice
Configuration </div>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">AbstractModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Override</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> configure</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">toProvider</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLogProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: 45.8pt; text-indent: 9.8pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 45.8pt; text-indent: 9.8pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 45.8pt; text-indent: 9.8pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 45.8pt; text-indent: 9.8pt;">
b.Provider as
instance creation class</div>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">interface</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Provider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"><</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">T</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> T </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">get</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLogProvider</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">implements</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Provider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"><</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span>
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">get</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLog</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLog </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">setConnection</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">connection</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">return</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: 45.8pt; text-indent: 9.8pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 45.8pt; mso-list: l2 level1 lfo2; text-indent: -.25in;">
<span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;"><span style="mso-list: Ignore;">Ø<span style="font: 7.0pt "Times New Roman";">
</span></span></span>2e. @<b style="mso-bidi-font-weight: normal;">ImplementedBy</b>
and @<b style="mso-bidi-font-weight: normal;">ProvidedBy – </b>Provides default
implementation, can be overriden by the bind() method in guice configuration
module.</div>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@<b style="mso-bidi-font-weight: normal;">ImplementedBy</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PayPalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">interface</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">{…}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .5in; text-indent: 9.8pt;">
Equivalient to </div>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 45.8pt;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PayPalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .5in; text-indent: 9.8pt;">
<br /></div>
<pre style="background: #EEEEEE; margin-left: 1.0in;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@ProvidedBy</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLogProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">interface</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{…}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .5in; text-indent: 9.8pt;">
Equivalent to </div>
<pre style="background: #EEEEEE;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">toProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLogProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="margin-left: .5in; text-indent: 9.8pt;">
<br /></div>
<div class="MsoNormal" style="margin-left: 45.8pt; mso-list: l2 level1 lfo2; text-indent: -.25in;">
<span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;"><span style="mso-list: Ignore;">Ø<span style="font: 7.0pt "Times New Roman";">
</span></span></span>2f. Inject into an existing instance – (for
objects that are already instatiated not by guice)useful in servlets or instances
that you can’t instantiate or already instatiated by container</div>
<pre style="background: #EEEEEE; margin-left: .5in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Injector</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> injector </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Guice</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">createInjector</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(...);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span>
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> creditCardProcessor </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PayPalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> injector</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">injectMembers</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">creditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="text-indent: 9.8pt;">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 18.0pt; line-height: 115%;">Injecting by Providers (alternative
to direct @Inject)</span></b></div>
<div class="MsoNormal">
Usability Criteria - Whenever you need to scope mixing (like
accessing a request scoped object in session scope or singleton scope) or get
instances on demand (lazy loading) or inject more than one instances per type.</div>
<div class="MsoNormal">
Below instead of injecting directly CreditcardProcessor, we
use Provider< CreditcardProcessor > and its get() method call provides an
instance when required. You can call the get() method to provide as many
instances you like and wherever you need inside the code</div>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">implements</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingService</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="background: yellow; color: #000088; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">private</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> </span></span><span class="kwd"><span style="background: yellow; color: #000088; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">final</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> </span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">Provider</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"><</span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">CreditCardProcessor</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">></span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> processorProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">private</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">final</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Provider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"><</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLogProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Inject</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">(</span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">Provider</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"><</span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">CreditCardProcessor</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">></span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> processorProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Provider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"><</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLogProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="background: yellow; color: #000088; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">this</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">.</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">processorProvider </span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">=</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> processorProvider</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">this</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">transactionLogProvider </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLogProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Receipt</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> chargeOrder</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PizzaOrder</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> order</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCard</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> creditCard</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">CreditCardProcessor</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> processor </span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">=</span></span><span class="pln"><span style="background: yellow; color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;"> processorProvider</span></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">.</span></span><span class="kwd"><b style="mso-bidi-font-weight: normal;"><span style="background: yellow; color: #000088; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">get</span></b></span><span class="pun"><span style="background: yellow; color: #666600; font-family: "Lucida Console"; font-size: 9.0pt; mso-highlight: yellow;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLog </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> transactionLogProvider</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><b style="mso-bidi-font-weight: normal;"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">get</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="com"><span style="color: #880000; font-family: "Lucida Console"; font-size: 9.0pt;">/* use the processor and transaction log here */</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Guice configuration </div>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">AbstractModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Override</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> configure</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">// <span style="background: yellow; mso-highlight: yellow;">Class binding</span></span></span><span class="pln"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"></span></span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> <span style="mso-spacerun: yes;"> </span><b style="mso-bidi-font-weight: normal;">bind</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">TransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">DatabaseTransactionLog</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">in</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066;">Singleton</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">to</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PaypalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">//or <span style="background: yellow; mso-highlight: yellow;">instance binding</span></span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">bind</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">toInstance</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(new </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PaypalCreditCardProcessor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">());</span></span></pre>
<pre style="background: #EEEEEE; margin-left: 26.2pt; text-indent: 9.8pt;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></pre>
<pre style="background: #EEEEEE; margin-left: .25in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 18.0pt; line-height: 115%;">AOP with GUICE</span></b></div>
<div class="MsoNormal">
Two concepts – <b style="mso-bidi-font-weight: normal;">Matcher</b>
and <b style="mso-bidi-font-weight: normal;">MethodInterceptors</b></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;">Matchers </b>matches
classes to apply pointcuts (cross cutting concerns), <b style="mso-bidi-font-weight: normal;">MethodInterceptors </b>implement the cross cutting concern. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Example in steps – stop pizza orders on weekends</div>
<div class="MsoNormal">
1.create an annotation or use builtin @Named annotation</div>
<pre style="background: #EEEEEE;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Retention</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RetentionPolicy</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">RUNTIME</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Target</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">ElementType</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">METHOD</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@interface</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">NotOnWeekends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
2.Annotate the method where you want to introduce pointcut</div>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">implements</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">BillingService</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@NotOnWeekends</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Receipt</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> chargeOrder</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">PizzaOrder</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> order</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">CreditCard</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> creditCard</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">...</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
3.Implement MethodInterceptors</div>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">WeekendBlocker</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">implements</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MethodInterceptor</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Object</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> invoke</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MethodInvocation</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> invocation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">)</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">throws</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Throwable</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Calendar</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> today </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">GregorianCalendar</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">if</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">today</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">getDisplayName</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">DAY_OF_WEEK</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> LONG</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> ENGLISH</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">startsWith</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"S"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">))</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">throw</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">IllegalStateException</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> invocation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">getMethod</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">().</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">getName</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">+</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">" not allowed on weekends!"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">return</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> invocation</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">proceed</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
4.Wire or configure all</div>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">NotOnWeekendsModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">AbstractModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> configure</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> <b style="mso-bidi-font-weight: normal;">bindInterceptor</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Matchers</span></span>.<b style="mso-bidi-font-weight: normal;">only</b>(<span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">RealBillingService.</span></span><span class="kwd"><span style="color: #000088;">class</span></span>), <span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Matchers</span></b></span><span class="pun"><b style="mso-bidi-font-weight: normal;"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></b></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotatedWith</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">NotOnWeekends</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">),</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">WeekendBlocker</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">());</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
You can use <span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; line-height: 115%;">Matchers</span></span>.<b style="mso-bidi-font-weight: normal;">any()</b> or <span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt; line-height: 115%;">Matchers.subclassesof(BillingService.class)</span></span></div>
<div class="MsoNormal">
or if you want the interceptor to be injected with some
objects</div>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">NotOnWeekendsModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">AbstractModule</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> configure</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">WeekendBlocker</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> weekendBlocker </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">=</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">WeekendBlocker</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">();</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> <b style="mso-bidi-font-weight: normal;">requestInjection</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">weekendBlocker</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> bindInterceptor</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Matchers</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">any</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(),</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Matchers</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">annotatedWith</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">NotOnWeekends</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">),</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> weekendBlocker</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 18.0pt; line-height: 115%;">Bootstrap for Injecting in http servlets
–</span></b></div>
<div class="MsoNormal">
<span style="font-size: 18.0pt; line-height: 115%;">Bootstrap guice
servlet – </span></div>
<div class="MsoNormal">
1.</div>
<pre style="background: #EEEEEE;"><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE;"><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><listener></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><listener-class></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">com.example.MyGuiceServletConfig</span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></listener-class></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></listener></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
2.</div>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MyGuiceServletConfig</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">GuiceServletContextListener</span></b></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Override</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Injector</span></b></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> <b style="mso-bidi-font-weight: normal;">getInjector</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">return</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Guice</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">createInjector</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">ServletModule</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">());</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
or You can subclass ServletModule class like above</div>
<pre style="background: #EEEEEE;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Guice</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">createInjector</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(...,</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">ServletModule</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Override</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> <b style="mso-bidi-font-weight: normal;">configureServlets</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span></pre>
<pre style="background: #EEEEEE; text-indent: .5in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">filter</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"/*"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">through</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MyFilter</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> <b style="mso-bidi-font-weight: normal;">serve</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"*.html"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="kwd"><b style="mso-bidi-font-weight: normal;"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">with</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MyServlet</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
3.</div>
<pre style="background: #EEEEEE;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><filter></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><filter-name></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">guiceFilter</span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></filter-name></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><filter-class></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">com.google.inject.servlet.<b style="mso-bidi-font-weight: normal;">GuiceFilter</b></span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></filter-class></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></filter></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><filter-mapping></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><filter-name></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">guiceFilter</span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></filter-name></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><url-pattern></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">/*</span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></url-pattern></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="tag"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"></filter-mapping></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal">
<br /></div>
<ol start="4" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="mso-list: l0 level1 lfo1;">Injecting inside servlet
if ServletModdule class is installed as above</li>
</ol>
<pre style="background: #EEEEEE;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Singleton</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
</span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">public</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MyServlet</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">extends</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">HttpServlet</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<pre style="background: #EEEEEE;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Inject</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">private</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Injector</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> injector</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span></pre>
<pre style="background: #EEEEEE;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">...</span></pre>
<pre style="background: #EEEEEE;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Or Inside servlet init() method, use the bootstrap class</div>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>public void init(ServletConfig config) throws ServletException {</span></span></pre>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>super.init(config);</span></span></pre>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>ServletContext servletContext = config.getServletContext();</span></span></pre>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Injector injector =</span></span></pre>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>(<b style="mso-bidi-font-weight: normal;">Injector</b>) servletContext.getAttribute(<b style="mso-bidi-font-weight: normal;">Injector.class.getName());</b></span></span></pre>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><b style="mso-bidi-font-weight: normal;">injector</b>.<b style="mso-bidi-font-weight: normal;">injectMembers</b>(this);</span></span></pre>
<pre style="background: #EEEEEE;"><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}</span></span></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
You can inject ServletContext. You can inject Request
parameters by, </div>
<pre style="background: #EEEEEE;"><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Inject</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@RequestParameters</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Map</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"><</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">String</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">,</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">String</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">[]></span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">params</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">;</span></span></pre>
<pre style="background: #EEEEEE;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<pre style="background: #EEEEEE;"><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span></pre>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Calibri","sans-serif";
mso-bidi-font-family:"Times New Roman";}
</style>
<![endif]--><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;"></span></span><br />
<div class="MsoNormal">
<br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Calibri","sans-serif";
mso-bidi-font-family:"Times New Roman";}
</style>
<![endif]-->
<br />
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 16.0pt; line-height: 115%;">GUICE with JERSEY REST Service</span></b></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;">Setup – </b></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
Step 1 – Use maven dependency
<span style="mso-spacerun: yes;"> </span>jersey-guice with google guice as shown
below. </div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 2;"> </span></span><span style="color: #3f5fbf; font-family: Consolas; font-size: 10.0pt;"><!-- Google <u>Guice</u>
--></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 2;"> </span></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"><</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">dependency</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 3;"> </span><groupId>com.google.inject</groupId></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 3;"> </span><artifactId>guice</artifactId></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 3;"> </span><version>3.0</version></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 2;"> </span></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"></</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">dependency</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 2;"> </span></span><span style="color: #3f5fbf; font-family: Consolas; font-size: 10.0pt;"><!-- Jersey <u>Guice</u>
Module --></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 2;"> </span></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"><</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">dependency</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 3;"> </span></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"><</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">groupId</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="color: black; font-family: Consolas; font-size: 10.0pt;">com.sun.jersey.contribs</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"></</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">groupId</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 3;"> </span></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"><</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">artifactId</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="color: black; font-family: Consolas; font-size: 10.0pt;">jersey-<u>guice</u></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"></</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">artifactId</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 3;"> </span></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"><</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">version</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="color: black; font-family: Consolas; font-size: 10.0pt;">1.15</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"></</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">version</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: Consolas; font-size: 10.0pt;"><span style="mso-tab-count: 2;"> </span></span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;"></</span><span style="color: #3f7f7f; font-family: Consolas; font-size: 10.0pt;">dependency</span><span style="color: teal; font-family: Consolas; font-size: 10.0pt;">></span><span style="font-family: Consolas; font-size: 10.0pt;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
Step 2 - Follow the same
setup as web application, but Instead of creating injector from ServletModule
class, use JerseyServletModule and use jersey GuiceContainer class to bind to
request that will be server by Jersey as REST resources as shown below.</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<pre style="background: #EEEEEE;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">Guice</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">createInjector</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(...,</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">new</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="background: yellow; color: #660066; font-size: 16.0pt; mso-highlight: yellow;">Jersey</span></b></span><span class="typ"><b style="mso-bidi-font-weight: normal;"><span style="background: yellow; color: #660066; font-family: "Lucida Console"; font-size: 16.0pt; mso-highlight: yellow;">ServletModule</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="lit"><span style="color: #006666; font-family: "Lucida Console"; font-size: 9.0pt;">@Override</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">protected</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">void</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> <b style="mso-bidi-font-weight: normal;">configureServlets</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">()</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">{</span></span></pre>
<pre style="background: #EEEEEE; text-indent: .5in;"><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">filter</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"/*"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="pln"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">through</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MyFilter</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> <b style="mso-bidi-font-weight: normal;">serve</b></span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="str"><span style="color: #008800; font-family: "Lucida Console"; font-size: 9.0pt;">"*.html"</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">).</span></span><span class="kwd"><b style="mso-bidi-font-weight: normal;"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">with</span></b></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">(</span></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 9.0pt;">MyServlet</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">.</span></span><span class="kwd"><span style="color: #000088; font-family: "Lucida Console"; font-size: 9.0pt;">class</span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">);</span></span></pre>
<pre style="background: #EEEEEE; text-indent: .5in;"><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black;">serve("/rest/*").with(</span></b></span><span class="typ"><span style="color: #660066; font-family: "Lucida Console"; font-size: 16.0pt;">GuiceContainer</span></span><span class="pln"><b style="mso-bidi-font-weight: normal;"><span style="color: black;">.class);</span></b></span></pre>
<pre style="background: #EEEEEE; text-indent: .5in;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;">
<span class="pln"> </span></span><span class="pun"><span style="color: #666600; font-family: "Lucida Console"; font-size: 9.0pt;">}</span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt;"></span></pre>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
That’s it, then you are
read to inject guice dependency to REST services by jersey framework.<br />
JSP injection - look here<br />
<a href="http://turbomanage.wordpress.com/2009/12/11/how-to-inject-guice-objects-in-a-jsp/">http://turbomanage.wordpress.com/2009/12/11/how-to-inject-guice-objects-in-a-jsp/</a><br />
</div>
</div>
</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com12tag:blogger.com,1999:blog-2427907316875671900.post-45387833967385451862012-10-21T10:02:00.002-07:002015-11-04T13:52:45.406-08:00Apache Common Chain Usage Made Easy<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h3 style="text-align: left;">
Apache Common Chain Usage - </h3>
<h4 style="text-align: left;">
Tasks </h4>
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">1. create a class that executes the job. This class inherits Command class and overrides execute method.</span><br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;"> (execute method returns false for the execution chain to continue or true to stop the chain further processing)</span><br />
<br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">2. Create a class that inherits ContextBase </span><br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">(it is a glue in the chain (between each command executor) .Command classes suck data from this glue )</span><br />
<br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">3.Create a class inherits Filter and implement execute and postprocess method.</span><br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;"> (It is similar to command class, but used as a exception handler and fall back situation)</span><br />
<br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">4.Write the chain xml file</span><br />
<br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">5.Load the chain xml file in a web app by modifying web.xml. Add xml file path to application startup parameter and add commons chain listener, ChainLister class</span><br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">(Method 1 explained below) </span><br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;"><br /></span>
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">6.Write client code to execute the chain where the Catalog will be an injected object or get the catalog object in a web application using by retrieving the value of catalog attribute from application context.</span><br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;"><br /></span>
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">7. For adding a chain to struts 1.3 request processor, (section struts use)</span><br />
<div style="text-align: left;">
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">- Create a class inheriting command. </span></div>
<div style="text-align: left;">
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">(Use the ServletActionContext as the context within execute method to get the data.)</span></div>
<div style="text-align: left;">
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">-Create xml section of the chain</span></div>
<div style="text-align: left;">
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">-Create a xml file and add it as an init parameter of ActionServlet</span></div>
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;">(See Struts 1.3 package example app named cookbook) </span><br />
<span style="font-family: "segoe ui" , "lucida grande" , "verdana" , sans-serif;"></span><br />
<br />
Key Classes -<br />
<pre><code>Package - org.apache.commons.chain</code></pre>
<pre><code> </code></pre>
<pre><code>Classes - </code></pre>
<pre><code>- <span style="color: red;"><b>Command </b></span>, <span style="color: red;"><b>ContextBase </b></span>(main classes), <span style="color: red;"><b>Filter </b></span>(user for exception handling and post process)</code></pre>
<pre><code><code>- Catalog, <code>config.ConfigParser, <code>impl.CatalogFactoryBase</code></code></code> (utility classes for loading)</code></pre>
<pre><code> </code></pre>
<pre><code><code>ContextBase (used as a glue to bind commands)</code> </code> </pre>
<br />
<h3 style="text-align: left;">
Sample implementation - </h3>
<h4 style="text-align: left;">
Command - </h4>
<pre>public class ProfileCheck implements <span style="color: red;">Command </span>{
public Profile newProfile(Context context) { return new Profile(); }
public boolean execute(Context context) throws Exception {
Object profile = context.get(Profile.PROFILE_KEY);
if (null == profile) {
profile = newProfile(context);
context.put(Profile.PROFILE_KEY, profile);
}
return false;
}
}</pre>
<pre> </pre>
<h4 style="text-align: left;">
Context - </h4>
<pre>public class MailReaderContext extends <span style="color: red;">ContextBase </span>{Prop
public static String LOCALE_KEY = "locale";
private Locale locale;
public Locale getLocale() {
return locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
} </pre>
<h4 style="text-align: left;">
</h4>
<h4 style="text-align: left;">
Client code (method) - </h4>
<pre>boolean executeCatalogCommand (Catalog <code><code>sampleCatalog</code></code>) { </pre>
<pre><code><code>Command command = <span style="color: red;">sampleCatalog.getCommand("</span></code></code><code><code><span style="color: red;">LocaleChange");</span>
Context ctx = new </code></code><code><code>MailReaderContext();
command.execute(ctx);</code> </code></pre>
<pre><code>}</code></pre>
<pre></pre>
<h4 style="text-align: left;">
Filter (extra for exception handling)- </h4>
<pre><code>public class SellVehicleExceptionHandler implements Filter {
public boolean <span style="color: red;">execute</span>(Context context) throws Exception {
System.out.println("Filter.execute() called.");
return false;
}
public boolean <span style="color: red;">postprocess</span>(Context context,
Exception exception) {
if (exception == null) return false;
System.out.println("Exception "
+ exception.getMessage()
+ " occurred.");
return true;
}
}</code></pre>
<h3 style="text-align: left;">
Format of chain config file - </h3>
<?xml version="1.0" ?><br />
<pre><catalog></pre>
<pre> </pre>
<pre> <chain name="LocaleChange">
<command
className="org.apache.commons.chain.mailreader.commands.ProfileCheck"/>
<command
className="org.apache.commons.chain.mailreader.commands.LocaleChange"/>
</chain><code> </code></pre>
<pre><code> </code></pre>
<pre><code> <chain name="sell-vehicle">
<command id="ExceptionHandler"
className =
"com.jadecove.chain.sample.SellVehicleExceptionHandler"/>
<command id="GetCustomerInfo"
className="com.jadecove.chain.sample.GetCustomerInfo"/></code> </pre>
<pre> </chain></pre>
<pre> <command
name="LogonUser"
className="org.apache.commons.chain.mailreader.commands.LogonUser"/></pre>
<pre><code> </code> </catalog></pre>
<br />
<h3 style="text-align: left;">
Loading catalog : </h3>
<h4 style="text-align: left;">
<span style="font-family: inherit;"><span style="font-family: inherit;">Method 1 (loading in web application) - </span></span></h4>
<div style="text-align: left;">
<span style="font-family: inherit;"><span style="font-family: inherit;">In web application, load by adding thus listener to web.xml</span></span></div>
<pre><!-- Commons Chain listener to load catalogs -->
<context-param>
<param-name>org.apache.commons.chain.CONFIG_CLASS_RESOURCE</param-name>
<param-value><span style="color: red;">resources/catalog.xml</span></param-value>
</context-param>
<listener>
<listener-class><span style="color: red;">org.apache.commons.chain.web.ChainListener</span></listener-class>
</listener></pre>
<pre> </pre>
<div style="text-align: left;">
<span style="font-family: inherit;"><span style="font-family: inherit;"> Access in code as - </span></span></div>
<pre><span style="color: red;">Catalog catalog = (Catalog) request.getSession()
.getServletContext().getAttribute("catalog");</span></pre>
<div style="text-align: left;">
<br /></div>
<h3 style="text-align: left;">
<span style="font-family: inherit;"> </span></h3>
<h4 style="text-align: left;">
Method 2 (general)- </h4>
<pre><code>new </code><code><code>ConfigParser().</code></code><code><code>parser.parse(this.getClass().getResource(</code></code><code><code><code>"/com/jadecove/chain/sample/chain-config.xml"</code>));</code></code></pre>
<pre><code><code>Catalog </code>catalog = CatalogFactoryBase.getInstance().getCatalog();</code></pre>
<pre style="text-align: left;"><code><code>
</code></code></pre>
<br />
<h3 style="text-align: left;">
Struts use - </h3>
<h4 style="text-align: left;">
Command class - </h4>
<pre><code>public class CheckUser implements Command {
public boolean execute(Context ctx) throws Exception {
ServletActionContext context = (<span style="color: red;">ServletActionContext</span>) ctx;
Object user = context.getSessionScope().get(Constants.USER_KEY);
if (user == null &&
context.getParameterMap().containsKey("checkUser")) {
HttpServletResponse response =
((ServletActionContext) ctx).getResponse();
response.sendError(403, "User not logged in.");
return true;
}
return false;
}
}</code></pre>
<pre><span style="font-family: "arial" , "helvetica" , sans-serif;"><code> </code></span></pre>
<h4 style="text-align: left;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><code>xml section - (</code></span><code><span style="color: red;"><span style="font-size: small;"><b>custom-chain-config.xml</b></span></span></code><span style="font-family: "arial" , "helvetica" , sans-serif;"><code>)</code></span></h4>
<pre><code><code><?xml version="1.0" ?>
<catalog name="struts">
<chain name="<span style="color: red;">servlet-standard-preprocess</span>">
<command className="com.jadecove.chain.commands.CheckUser"/>
</chain>
</catalog></code> </code></pre>
<h4 style="text-align: left;">
Add to web.xml </h4>
<pre><code><!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config.xml,
/WEB-INF/struts-config-registration.xml
</param-value>
</init-param>
<init-param>
<param-name>chainConfig</param-name>
<param-value>
/WEB-INF/chain-config.xml,
<span style="color: red;"><span style="font-size: small;"><b>/WEB-INF/custom-chain-config.xml</b></span></span>
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet></code></pre>
<br />
<br />
<br />
<img alt="Figure 1" src="http://onjava.com/onjava/2005/03/02/graphics/figure_1.gif" height="363" width="436" /></div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com0tag:blogger.com,1999:blog-2427907316875671900.post-9247141280964194362012-09-09T11:37:00.000-07:002012-10-22T21:37:52.821-07:00Using Apache Digester with Example -Make Easy Configuration<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Address Problem - Hard Coding , Need to create custom configuration for your application like struts configuration file to vary application behavior just by changing the file. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Apache Digester can do it for you easily.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Transforming an XML document into a corresponding hierarchy of
Java bean objects is a fairly easy using Apache Digester. See Digester in action below.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Digester introduces three important concepts: </div>
<ol style="text-align: left;">
<li>element matching patterns</li>
<li>processing rules</li>
<li> the object stack.</li>
</ol>
<i style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Element matching patterns</i><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> associate XML elements with processing rules.</span><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Example :</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
What you have - </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
1.Java Classes</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
2.XML files containing data</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
You have java classes and corresponding xml files. You want java classses instances to be created from xml data. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
What extra code you need to write. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Step by step tasks </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
1. Add Apache Digester 3 jar file, Commons logging jar, Beanutils jar,cglib jar in your class path</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
2.If don't have the java classes, create java classes for corresponding xml file.Or if don't have xml files, create it as per the java classes.Note- property name,hierarchy in xml and java class should match, otherwise you need to provide mapping in your digester xml rule not mentioned here.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
3.Create a digester rule xml file as mentioned in the example below</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
4.Use few lines of to load java objects from xml</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Now In Action -<br />
<br />
Here is my eclipse project structure :<br />
<br />
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdQAAAIYCAIAAABbh4ppAAAgAElEQVR4nOy9W3gU15nvvb6L3OtinuyZfbNnnDiDk4wHsGFMT8KevZ89A558e8fJHmKHxDY+pGPiSbBjfz7EEAssiC1D3AYEOMEgJ5YtMGAQphEH2RzFMZwRMs1BQoCOLbXUqLu6q6X6LqoPtY5V3ZK6ulv/3/M+tmrVOrxrNfXvVW+trkVCAAAA8g5x2wEAABiPCMT34sWL1aC0wGcKgLtcvHhRJb7pS3RgMAYrGVN8/ACA/MBfgxnxNZW3dyDaOxBt7RyAlYyZn2nvQBQqDIC7WK++pPiaytvVN3i1PQQrVevqGzQNEgyAW6QvPRJKKW978M6XN3th48Hag3fag3egv8AtKioqBgcH3fbCNcxLLyO+bV0DF1t7YOPH2roGMAUGI6Sh4qsNFV/NthTENym+1dXVLR39Z691mbZj1YOMpU/BSsxaOvpbOvqhvyA3Giq+OjzUV5jiO1fJmDbthOrq6oz4/iXQadqOVQ/G4om0Xaibu2PVg+mzMFtb/gghk97Y6rYbzg36O96o2XZQbU4qMZV37MT3ypUrx48fP3To0PHjx69cuZJtE6FQaO7cuQaHrfLmptrZlsqI75Vbfcea203bVvU9TUtEY4loLKHFEpcb5l+om7ut6nvpDCr7w08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1aingy62/MSRURPRK+vraiCby9Y64zHXp668qTSSoI1/pdJIBX/19vi/W32e3t0/OD/88Pj84Kh4cFT/lLz7li7nj89PzfHZ7G99qFoi+Ys63f/DVy/nqwFd2wt+uBEpSBCIbvVILCx57xQPCoNxIlYtY9XaCgSkCzUx+cPgyVysaq/gQv1rgOIPvgZC1q1dLCV/ncw64IfRIX2DThTjUADlfr8zOKoNa5gCYx8afA4LRNxnw1dfufn55ZbN19dEoH1wWc5fF3EXh82UpZ1wetK4+Lq9syn5kYT9SirsdhICRW1rpN3yVA5DCl9neoAQEvxNDXEcSP+MhrNNgKpWS7HoQ40f4OmnCTdzqwe7GYFYH+XmCa6LMxRxh73kBcr7a4h50nWP2Z5ih8gdu53FYTnS9Wmr42g2l4Z/LMetdslnkVjmGcbsZhLGBa1/KVTpnrJJdD2zDzvYGPAmjM01PwwZfy7J29/P3FjOz6fW55czccmZueW1uOTObXr+3mNH4eRu2IxZeY/Gd6yd8VQNQwHcErSjK6ZfpTQgG2SaFJC97VIilxQ0V3mj5bRvCNjm9zLVvfNKsLrzmKJQUd7x5bUeednAlpg+7S0EARhUJVo1IWq+WBnydloD4D92XK86C35iLphnQ81Ag7bXK5kPEtK2YnfA6kWfAtabpagjhSyJFq0ip2icN1osLwmo4ZqErgi+JJJdesjluKResEqHhmIWmCL4kklRJiHtJSRTBl0QC5SV3ibykvojgSyKRSDGI4EsikUgxiOBLIpFIMYjgSyKRSDHIg+9/f6iWQmsz0tUAAAAASUVORK5CYII=" /> </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
task 2 -</div>
<h3 style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
create data xml file as below you want data from which to be loaded</h3>
<h4 style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
say - chain-config.xml </h4>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-family: "Courier New",Courier,monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"><catalogs></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Default Catalog: "Path Info" example --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <catalog></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Command that maps "Path Info" patterns to Commands --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <chain name="COMMAND_MAPPER"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command className="org.apache.commons.chain.web.servlet.PathInfoMapper"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command forward="/pathinfo.jsp" className="org.apache.commons.chain.apps.example.ForwardCommand"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </chain></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Foo Command --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <chain name="/foo"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command attribute="pathinfoFooCount" className="org.apache.commons.chain.apps.example.CountCommand"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </chain></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Bar Command --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <chain name="/bar"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command attribute="pathinfoBarCount" className="org.apache.commons.chain.apps.example.CountCommand"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </chain></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> </catalog></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Catalog for "Request Parameter" example --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <catalog name="reqparam"></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Command that maps a "Request Parameter" to Commands --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <chain name="COMMAND_MAPPER"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command catalogName="reqparam" className="org.apache.commons.chain.web.servlet.RequestParameterMapper"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command forward="/reqparam.jsp" className="org.apache.commons.chain.apps.example.ForwardCommand"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </chain></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Foo Command --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <chain name="foo"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command attribute="reqparamFooCount" className="org.apache.commons.chain.apps.example.CountCommand"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </chain></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Bar Command --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <chain name="bar"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <command attribute="reqparamBarCount" className="org.apache.commons.chain.apps.example.CountCommand"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </chain></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> </catalog></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"></catalogs></span></div>
<h3 style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
</h3>
<h3 style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
Create corresponding java classses</h3>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<b> Catalog.java :</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace; text-align: left;">
import java.util.ArrayList;<br />
import java.util.List;<br />
<br />
<br />
<br />
public class Catalog {<br />
<br />
/**<br />
* @uml.property name="name"<br />
*/<br />
private String name;<br />
<br />
/**<br />
* Getter of the property <tt>name</tt><br />
* @return Returns the name.<br />
* @uml.property name="name"<br />
*/<br />
public String getName() {<br />
return name;<br />
}<br />
<br />
/**<br />
* Setter of the property <tt>name</tt><br />
* @param name The name to set.<br />
* @uml.property name="name"<br />
*/<br />
public void setName(String name) {<br />
this.name = name;<br />
}<br />
<br />
/**<br />
* @uml.property name="chains"<br />
*/<br />
<br />
private List<Chain> chains=new ArrayList<Chain>();<br />
<br />
public void addChains(Chain chain)<br />
{<br />
this.chains.add(chain);<br />
}<br />
<br />
}</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<b>Chain.java :</b></div>
<div style="font-family: "Courier New",Courier,monospace; text-align: left;">
import java.util.ArrayList;<br />
import java.util.List;<br />
<br />
<br />
<br />
public class Chain {<br />
<br />
/**<br />
* @uml.property name="name"<br />
*/<br />
private String name;<br />
<br />
/**<br />
* Getter of the property <tt>name</tt><br />
* @return Returns the name.<br />
* @uml.property name="name"<br />
*/<br />
public String getName() {<br />
return name;<br />
}<br />
<br />
/**<br />
* Setter of the property <tt>name</tt><br />
* @param name The name to set.<br />
* @uml.property name="name"<br />
*/<br />
public void setName(String name) {<br />
this.name = name;<br />
}<br />
<br />
/**<br />
* @uml.property name="commands"<br />
*/<br />
private List<Command> commands=new ArrayList<Command>();<br />
<br />
<br />
/**<br />
* Setter of the property <tt>commands</tt><br />
* @param commands The commands to set.<br />
* @uml.property name="commands"<br />
*/<br />
public void addCommands(Command command) {<br />
this.commands.add(command);<br />
}<br />
<br />
}</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<b><br />Command.java :</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<span style="font-family: "Courier New",Courier,monospace;">import java.util.ArrayList;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">import java.util.List;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">public class Chain {</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> /**</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @uml.property name="name"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> */</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> private String name;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> /**</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * Getter of the property <tt>name</tt></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @return Returns the name.</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @uml.property name="name"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> */</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> public String getName() {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> return name;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> /**</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * Setter of the property <tt>name</tt></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @param name The name to set.</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @uml.property name="name"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> */</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> public void setName(String name) {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> this.name = name;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> /**</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @uml.property name="commands"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> */</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> private List<Command> commands=new ArrayList<Command>();</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> /**</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * Getter of the property <tt>commands</tt></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @return Returns the commands.</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @uml.property name="commands"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> */</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> public List getCommands() {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> return commands;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> /**</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * Setter of the property <tt>commands</tt></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @param commands The commands to set.</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @uml.property name="commands"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> */</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> public void addCommands(Command command) {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> this.commands.add(command);</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">}</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<h3 style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
task 3 - Create digester rules </h3>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<b>digester-catalog-rules.xml</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<span style="font-family: "Courier New",Courier,monospace;"><?xml version="1.0"?></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><!DOCTYPE digester-rules PUBLIC</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> "-//Apache Commons //DTD digester-rules XML V1.0//EN"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> "http://commons.apache.org/digester/dtds/digester-rules-3.0.dtd"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><digester-rules></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <pattern value="catalogs/catalog"></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <object-create-rule classname="Catalog"/></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <set-properties-rule/></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> </span><span style="font-family: "Courier New",Courier,monospace;"><!--</span><span style="font-family: "Courier New",Courier,monospace;"> comment :</span><span style="font-family: "Courier New",Courier,monospace;"></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<span style="font-family: "Courier New",Courier,monospace;"> </span><span style="font-family: "Courier New",Courier,monospace;"> <bean-property-setter-rule pattern="name"/></span> <span style="font-family: "Courier New",Courier,monospace;"> </span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">use as shown above if </span>say <span style="font-family: "Courier New",Courier,monospace;"><catalog><name>reparam</name> </catalog></span> instead of<span style="font-family: "Courier New",Courier,monospace;"> <catalog name="reparam"> </catalog></span><span style="font-family: "Courier New",Courier,monospace;"> </span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<span style="font-family: "Courier New",Courier,monospace;">--></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Nested Pattern for Characters --></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <pattern value="chain"></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <object-create-rule classname="Chain"/></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <set-properties-rule/></span><span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <!-- Nested Pattern for Characters --></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <pattern value="command"></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <object-create-rule classname="Command"/></span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <set-properties-rule/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"></span><br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> <set-next-rule methodname="addCommands" paramtype="Command"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"></pattern></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <set-next-rule methodname="addChains" paramtype="Chain"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"></pattern></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> <set-next-rule methodname="add" paramtype="Catalog"/></span><br />
<span style="font-family: "Courier New",Courier,monospace;"></pattern></span><br />
<span style="font-family: "Courier New",Courier,monospace;"></digester-rules></span></div>
<h3 style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
task 4 - Client program to load xml data</h3>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<span style="font-family: "Courier New",Courier,monospace;">import java.io.IOException;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">import java.io.InputStream;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">import java.net.URL;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">import org.apache.commons.digester3.Digester;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">import org.apache.commons.digester3.binder.DigesterLoader;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">import org.apache.commons.digester3.xmlrules.FromXmlRulesModule;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">import org.xml.sax.SAXException;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">import java.util.ArrayList;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">import java.util.List;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">public class runProgram {</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> /**</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> * @param args</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> */</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> public static void main(String[] args) {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> // TODO Auto-generated method stub</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> // Create an instance of the Digester from the XML rule set</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> DigesterLoader digesterLoader = DigesterLoader.newLoader(new FromXmlRulesModule() {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> @Override</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> protected void loadRules() {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> // TODO Auto-generated method stub</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> loadXMLRules( getClass( ).getResource("/com/tatu/resources/digester-catalog-rules.xml"));</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> });</span><br />
<span style="font-family: "Courier New",Courier,monospace;">Digester digester = digesterLoader.newDigester();</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">List<Catalog> catalogs = new ArrayList<Catalog>();</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> // Push a reference to the plays List on to the Stack</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> digester.push(catalogs);</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> // Parse the XML document</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> InputStream input = Digester.class.getClass().getResourceAsStream("/com/tatu/resources/chain-config.xml");</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> try {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Object root = digester.parse(input);</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> } catch (IOException e) {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> // TODO Auto-generated catch block</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> e.printStackTrace();</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> } catch (SAXException e) {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> // TODO Auto-generated catch block</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> e.printStackTrace();</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">}</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
Done. So have loaded the catalogs object with the xml data.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
Points to be noted from the above solution:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
1.object-create-rule creates an object </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
2.Rest of the rules are straightforward as their name suggests, object-create-rule creates a new instance, <span style="font-family: "Courier New",Courier,monospace;">set-properties-rule</span> sets the properties of the object from xml attributes like name attribute of catalog element whereas <span style="font-family: "Courier New",Courier,monospace;">bean-property-setter-rule</span> sets properties of the object from nested xml elements like say <span style="font-family: "Courier New",Courier,monospace;"><catalog><name>reparam</name> </catalog></span> instead of<span style="font-family: "Courier New",Courier,monospace;"> <catalog name="reparam"> </catalog></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
3- <b>set-next-rule:</b> (used for recursion) The set-next-rulerule moves to the next catalog, chain, and command tags. You have also specified the method to call in each case which will add the objects to a collection defined in the parent class, example : <set-next-rule methodname="addCommands" paramtype="Command"/>, <span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">here </span>addCommands() </span>method adds a command object to commands collection object defined in parent chain class.<br />
<br />
4.You want new custom rules,create your own Rule class deriving from digester Rule class. <br />
<br />
<br />
<br />
<br />
Any question, put your comments.<br />
<br />
One more thought, you don't want all these shit inbetween the xml files and java classes. Guess what, there is a trick to avoid that. But I don't like this trick unless you are in hurry. But everytime you use shortcut, you have to lose flexibilities. <br />
<br />
Trick is to use Apache Betwixt. Remember to use Betwixt, you need to use apache digester 2.1. For more go to apache Betwixt site. <br />
<br />
Use Betwixt BeanWriter to write the java beans to a file and then, use BeanReader to read from that file. Once you get the file generated from BeanWriter, you can change the values abd load it with BeanReader. (Need to configure betwixt mapping omitted here)<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> // Write XML document</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Writer writer = new FileWriter(</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Digester.class.getClass().getResource("/com/tatu/resources/chain-config.xml").getPath().substring(1, Digester.class.getClass().getResource("/com/tatu/resources/chain-config.xml").getPath().indexOf("chain-config.xml")) + "chains-config-betwixt.xml");</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> BeanWriter beanWriter = new BeanWriter(writer);</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> beanWriter.enablePrettyPrint( );</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;"> beanWriter.write( catalogs );</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> writer.close();</span><br />
<br />
//read it<br />
<div style="font-family: "Courier New",Courier,monospace;">
InputStream customCatalog = <br />
<br />
BeanReader.class.getClass().getResourceAsStream("/com/tatu/resources/chain-config<span style="font-family: "Courier New",Courier,monospace;">-betwixt</span>.xml");<br />
<br />
BeanReader beanReader = new BeanReader( );<br />
<br />
beanReader.getXMLIntrospector( ).setWrapCollectionsInElement(false);<br />
<br />
beanReader.registerBeanClass(Catalog.class);<br />
<br />
<br />
<br />
Catalog ct = (Catalog) beanReader.parse( customCatalog );</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<br />
<br />
Happy coding!!! </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<br />
<span style="font-family: "Courier New",Courier,monospace;"></span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: left;">
<span style="font-family: "Courier New",Courier,monospace;"><br /></span></div>
</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com12tag:blogger.com,1999:blog-2427907316875671900.post-92114365226348533772012-09-07T09:44:00.000-07:002012-10-22T21:38:41.935-07:00Handling complex object-relational mapping using apache dbutils<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Overview -</span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The Commons DbUtils library is a small set of classes designed to make working with<span class="Apple-converted-space"> </span></span><a class="externalLink" href="http://java.sun.com/products/jdbc/" style="background-color: white; background-image: url("http://commons.apache.org/dbutils/images/external-classic.png"); background-position: 100% 50%; background-repeat: no-repeat no-repeat; color: blue; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; padding-right: 18px; text-align: start; text-decoration: underline; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">JDBC</a><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-converted-space"> </span>easier. JDBC resource cleanup code is mundane, error prone work so these classes abstract out all of the cleanup tasks from your code leaving you with what you really wanted to do with JDBC in the first place: query and update data.</span></span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">DBUtils is a developer productivity package while dealing with JDBC stuffs. DBUtils is not a DAO (Data Access Object) framework, but can be used to create a DAO framwork. You can say it is your JDBC helper rather than a full-fledged framework like Hibernate. In other words, you don't need to write JDBC boilerplate codes, it is already written for you in DBUtils with enough works that you need while working with databases. </span></span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Why DBUtils - </span></span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"> -Small (You can browse source code easily and customize)</span></span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"> -Transparent (Easy to read)</span></span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"> -Fast</span></span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><br /></span></span>
<br />
<h2>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><b><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Problem with DBUtils - </span></b></span></h2>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><br /></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">DBUtils can't handle query and persistence of Complex objects.</span></span>
<br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><br /></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Let me explain that by example as below. </span></span>
<br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><br /></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The objective is to load a list of person objects from database. The implementation plan was explained below.</span></span>
<br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><br /></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Here is a simple person object list being fetched from database with 3 lines of code. (You need to supply the datasource or connection object)</span></span>
<br />
<br />
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="typ" style="color: #660066;">QueryRunner</span><span class="pln" style="color: black;"> run </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">QueryRunner</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">dataSource</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="com" style="color: #880000;">// Use the BeanListHandler implementation to convert all</span><span class="pln" style="color: black;">
</span><span class="com" style="color: #880000;">// ResultSet rows into a List of Person JavaBeans.</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">ResultSetHandler</span><span class="pun" style="color: #666600;"><</span><span class="typ" style="color: #660066;">List</span><span class="pun" style="color: #666600;"><</span><span class="typ" style="color: #660066;">Person</span><span class="pun" style="color: #666600;">>></span><span class="pln" style="color: black;"> h </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">BeanListHandler</span><span class="pun" style="color: #666600;"><</span><span class="typ" style="color: #660066;">Person</span><span class="pun" style="color: #666600;">>(</span><span class="typ" style="color: #660066;">Person</span><span class="pun" style="color: #666600;">.</span><span class="kwd" style="color: #000088;">class</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="com" style="color: #880000;">// Execute the SQL statement and return the results in a List of</span><span class="pln" style="color: black;">
</span><span class="com" style="color: #880000;">// Person objects generated by the BeanListHandler.</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">List</span><span class="pun" style="color: #666600;"><</span><span class="typ" style="color: #660066;">Person</span><span class="pun" style="color: #666600;">></span><span class="pln" style="color: black;"> persons </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> run</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">query</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">"SELECT * FROM Person"</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> h</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"></span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">Consider there are 2 tables, Person and PersonType. Similarly 2 Classes</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">Person and PersonType. Person Class has a setter field as Person_type </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">
</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">Tables Schema - </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> create table person_type
(person_type_id int not null,
internal_name varchar(50) not null,
display_name varchar(50) not null,
constraint ak_person_type unique (internal_name),
constraint pk_person_type primary key (person_type_id))</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">
</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> create table person (
person_id int not null,
person_type_id int not null,
name varchar(50) not null,
ssn varchar(9) null,
constraint pk_person primary key (person_id),
constraint fk_person_type foreign key (person_type_id) references person_type (person_type_id))</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">
</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">Classes Schema - </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> <img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX0AAACMCAIAAAAfou4OAAAOJElEQVR4nO2d628U1x2Gzx+TryFVkSJZldYIwkJAKAiSQE0wFzuQ0CYxRcZNDCTOBTsCxdgtFzuOgVXkohC52MZpDLYhhAalsYOVmoiAiRujIhcJKFVFEKiafhhptMy5zszOmd/OvI/eD7uzZ85ls/v4zNmTgT24fxtBEMRmWOI9QBAka4F3EASxHXgHQRDbgXcQBLEdeAdBENuBdxAEsR14B0EQ24F3EASxHXgHQRDbgXcQBLEdeAdBENtReafycCWSzST+uUTSHY13Pvr2IyRrgXeQuKPxztGJo0jWU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Vdx5gm1aGgXeQ+KLxzgNs08ow8A4SU/TeeYBtWhkm8Q8oksoYeQdBEKSEgXcQBLEdeAdBENuBdxAEsR14B0EQ24F3EASxHXgHQRDbgXcQBLEdeAdBENuBdxAEsR14B0EQ24F3EASxHXgHQRDbgXcQBLEdeAdBENuBdxAEsR14B0EQ2/k/l7zR33G6gTUAAAAASUVORK5CYII=" /></span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;"> The code above will not populate the person_type attribute of Person</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">object since Person object is a complex/nested object that reference other objects like </span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">Person_Type in this case.</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">
</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">So how to solve this issue.</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;"> </span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">You need to manually map and load it.</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;"> </span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">I created a simple way of doing this as described below.</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">
</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">The solution was to override BeanProcessor class's toBean and toBeanList methods with </span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">some customization as explained below.</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;"> </span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">A new class is created within DBUtils called NestedObjectBeanProcessor as shown below.</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">(But remember to include all required methods from BeanProcessor class to avoid compiler errors which I omitted below) </span></span></span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">public class NestedObjectBeanProcessor extends BeanProcessor { </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException {
List<T> results = new ArrayList<T>();
if (!rs.next()) {
return results;
}
PropertyDescriptor[] props = this.propertyDescriptors(type);
ResultSetMetaData rsmd = rs.getMetaData();
int[] columnToProperty = this.mapColumnsToProperties(rsmd, props);
do {
T bean = this.createBean(rs, type, props, columnToProperty);
try {
this.setNestedBeanProperty(bean,rs,type);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
results.add(bean);
} while (rs.next());
return results;
}
protected <T> void setNestedBeanProperty(T bean,ResultSet rs, Class<T> type) throws Exception
{
throw new Exception("setNestedBeanProperty method is not implemeted. Please override it.");
} </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">
</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">}</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">
</span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">Here the setNestedBeanProperty method is to be implemented by the developer</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">to populate the nested objects for example Person_Type in Person object here.</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">
</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">Here is a simple implementation to shows how to do that in your DAO layer.</span></span></span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">
</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> QueryRunner query = new QueryRunner();</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;">
</span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> //create a row processor for nested person object
ResultSetHandler<List<Person>> rsh = new BeanListHandler<Person>(Person.class,new BasicRowProcessor(new NestedObjectBeanProcessor()
{
protected <T> void setNestedBeanProperty(T bean,ResultSet rs, Class<T> type) throws Exception
{
QueryRunner query = new QueryRunner();
ResultSetHandler<Person_Type> rsh = new BeanHandler<Person_Type>(Person_Type.class);
int personTypeId = rs.getInt(1);
//create person_type object
Person_Type person_Type = query.query(con, "Select * from person_type where person_type_id=?", rsh, personTypeId);
//Setting person_type field
Class clazz = bean.getClass();
Field person_typeField = clazz.getDeclaredField("person_type");
person_typeField.setAccessible(true);
person_typeField.set(bean, person_Type);
}
}
));
List<Person> persons = query.query(con, "Select * from person", rsh);
</span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">So now the persons list loaded will be having all the required dependent objects. </span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">
</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">The implementation for </span><span class="pln" style="color: black;"><span class="pln" style="color: black;">setNestedBeanProperty method</span> provided above could be customized as per your requirement. </span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">
</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">Any questions ?</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">
</span></span></span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="font-size: small;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span class="pln" style="color: black;">Happy Coding !!!</span></span></span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Monaco, Courier, monospace; font-size: 0.9em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 7px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span class="pln" style="color: black;"> </span></pre>
</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com0tag:blogger.com,1999:blog-2427907316875671900.post-71153593767184946452012-07-31T14:56:00.002-07:002012-10-22T21:39:45.343-07:00Closure in Programming Language<div dir="ltr" style="text-align: left;" trbidi="on">
Do you understand closure in programming language?<br />
Some languages have this feature, some doesn't have.But javascript has this feature so as groovy.<br />
<br />
Somebody said if you don't need a situation to use closure, you can't understand it fully,lol. So to understand we need get a situation.<br />
<br />
#Here is the situation - A classic last value example (Used firefox for this test)<br />
<br />
Create 5 buttons on fly and when you click each, it should display "You just clicked Button " + <button number> as shown below<br />
<span style="font-size: x-small;"><br /></span>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;">function addButtonsWithHandlers(numOfButtons) {</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> var i, button;</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"><br /></span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> for(i = 0; i < numOfButtons; i++) {</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> button = document.createElement("input");</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> button.type="button"</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> button.value = "Button " + i;</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> button.onclick = function() {</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> alert("You just clicked Button " + i);</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> };</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"><br /></span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> document.body.appendChild(button);</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;"> }</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;">}</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;">addButtonsWithHandlers(5);</span></div>
<br />
Now it will alert <span style="font-size: x-small;">You just clicked Button </span>5 every time you click the buttons instead of <span style="font-size: x-small;">You just clicked Button </span>0, <span style="font-size: x-small;">You just clicked Button</span> 1, <span style="font-size: x-small;">You just clicked Button </span>2 etc<br />
<br />
How do you solve this problem to show the actual button number (like 0,1,2 ...) instead of 5 every-time?<br />
<br />
Ans -using Closure. Here is the need for using closure.<br />
<br />
Def of closure - An <a class="QuickWiki" href="http://en.wiktionary.org/wiki/abstraction" id="QuickWikiInternalLink" title="abstraction">abstraction</a> that represents a function within an <a class="QuickWiki" href="http://en.wiktionary.org/wiki/environment" id="QuickWikiInternalLink" title="environment">environment</a>, a context consisting of the variables that are both <a class="QuickWiki" href="http://en.wiktionary.org/wiki/bound_variable" id="QuickWikiInternalLink" title="bound variable">bound</a> at a particular time during the execution of the program and that are within the function's <a class="QuickWiki" href="http://en.wiktionary.org/wiki/scope" id="QuickWikiInternalLink" title="scope">scope</a>.<br />
<br />
Can you make a solution using the definition above, lol.<br />
Doesn't make sense above, don't worry. Go through the solution. Closures can be better understood through examples.<br />
<br />
Solution as below - <br />
<br />
<pre style="left: -1000px; position: fixed;">function addButtonsWithHandlersBad(numOfButtons) {
var i, button;
for(i = 0; i < numOfButtons; i++) {
button = document.createElement("input");
button.type="button"
button.value = "Button " + i;
button.onclick = alertbutton(i);
document.body.appendChild(button);
}
}
function alertbutton (i) {
return function () {alert("You just clicked Button " + i);};
}
addButtonsWithHandlersBad(5);</pre>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">function addButtonsWithHandlers(numOfButtons) {</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> </span></span><br />
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"> var i, button;</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> for(i = 0; i < numOfButtons; i++) {</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> button = document.createElement("input");</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> button.type="button"</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> button.value = "Button " + i;</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> button.onclick = <u><i>alertbutton(i);</i></u></span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> document.body.appendChild(button);</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> }</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">}</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><u><i><span style="font-family: "Courier New",Courier,monospace;">function alertbutton (i) {</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">return function () {alert("You just clicked Button " + i);};</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">}</span></i></u><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">addButtonsWithHandlers(5);</span></span><br />
<br />
Pay attention to the italic lines in the code above. <br />
So what I did above. I created a function called alertbutton which returns another function. This is a defcato closure, you can say a thumb rule, a function return another function. Then I assign the onclick event of the buttons to that closure.<br />
<br />
Another shortcut way of writing the onclick event using closure is as below. This way is called IIFE (<span style="font-size: small;">Immediately-Invoked Function Expression</span>)<br />
<br />
<br />
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"> button.onclick = (function alertbutton (i) {</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">return function () {alert("You just clicked Button " + i);};</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">})(i);</span></span><br />
<br />
<br />
That's the actual task you need to do.<br />
What is the underlying theory,<br />
<div style="text-align: center;">
<span style="font-size: large;">a function return another function makes the returned function closure (in this case, the closure is the anonymous function,i.e, <span style="font-size: x-small;">function () {alert("You just clicked Button " + i);}</span>)</span></div>
<br />
Another nice example borrowed here is as below,<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: x-small;">function localise(greeting) {<br /><br /> return function(name) { alert(greeting + ‘ ‘ + name };<br /><br />}<br /><br />var english = localise(‘Hello’);<br /><br />var french = localise(‘Bonjour’);<br /><br />english(‘kartik’); // alert box with “Hello kartik”<br /><br />french(‘kartik’) // alert box with “Bonjour kartik”</span></div>
<br />
Here, There is a parent function called localise which returns an anonymous inner function. This inner function remembers the variable greeting value even when at runtime the variable does not exist.<br />
<br />
Happy Coding!!!<br />
<pre style="left: -1000px; position: fixed;">function addButtonsWithHandlersBad(numOfButtons) {
var i, button;
for(i = 0; i < numOfButtons; i++) {
button = document.createElement("input");
button.type="button"
button.value = "Button " + i;
button.onclick = function() {
alert("You just clicked Button " + i);
};
document.body.appendChild(button);
}
}
addButtonsWithHandlersBad(5);</pre>
<pre style="left: -1000px; position: fixed;">function addButtonsWithHandlersBad(numOfButtons) {
var i, button;
for(i = 0; i < numOfButtons; i++) {
button = document.createElement("input");
button.type="button"
button.value = "Button " + i;
button.onclick = function() {
alert("You just clicked Button " + i);
};
document.body.appendChild(button);
}
}
addButtonsWithHandlersBad(5);</pre>
</div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com0tag:blogger.com,1999:blog-2427907316875671900.post-4488805924490626942012-06-14T15:02:00.000-07:002012-10-22T21:40:10.098-07:00Cascading Style Sheet - Key Concept<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
CSS - Key Points<br />
<ol style="text-align: left;">
<li> jQuery css Selector and absolute CSS Selector are same and so richness in css selector</li>
<li>Concept of CSS Pseudo Classes (e.g, a:visited {background-color:green} -here :visited is called Pseudo class)</li>
<li>Relative and Absolute positioning </li>
<li> Multi-Classing (e.g, <div class=”module1 weather”>) and Grouping (e.g. h1, h2, p, q #content, .standard {color: #000; margin: 5px;})</li>
<li>Box Model =>width = content width + padding + border (not margin)</li>
<li>Float on any element disturbs the rest of the (parent) container after that element. So make float:clear before the element where normal flow is again expected</li>
<li>Concept of "Relatively Absolute" (Make the parent element relative and child elements as absolute - called relatively absolute to create column structure like float)</li>
</ol>
(Point 3 explained) </div>
3. Relative and Absolute positioning :<br />
<ul style="text-align: left;">
<li>Relative postion called offset position creates a ghost element and relative means relative to the current position of the element in a normal flow. Browser see the element on the normal flow and mask it (blank as parent style) and then offset the element </li>
<li>Absolute positioning of an element is relative to the parent and space inbetween is contrasted and filled by other elements around it </li>
</ul>
<br /></div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com1tag:blogger.com,1999:blog-2427907316875671900.post-21324217265970951672011-09-11T17:38:00.000-07:002012-10-22T21:40:27.023-07:00IE caching issue (XML)<div dir="ltr" style="text-align: left;" trbidi="on">
Have you ever wonder why your internet explorer browser is not showing the updated data on a webpage where the data is fetched from the server as an xml file?<br />
<br />
You checked with other browsers like Firefox and chrome, things are absolutely fine, but when it comes to internet explorer, the data is same old as before even if you hit refresh.<br />
<br />
Well. I experienced the same problem with 2 projects. I figure out 2 solutions.<br />
<br />
Solution 1 -<br />
Change the temporary internet files setting as shown in the picture below.<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk2w45AnHdPN5-zNsUKFB9CPux4080fZMnHwagvF7Xx4ec10jGlwvUWDL0aHdY6N6MV56IzvoUjdouCFdS1X-nTkBfQieG9wlc8Fc00J8NxrUcdLmxVmXOJ1hM2eYUeY6Nz1QDUH1o9G0/s1600/IECache.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk2w45AnHdPN5-zNsUKFB9CPux4080fZMnHwagvF7Xx4ec10jGlwvUWDL0aHdY6N6MV56IzvoUjdouCFdS1X-nTkBfQieG9wlc8Fc00J8NxrUcdLmxVmXOJ1hM2eYUeY6Nz1QDUH1o9G0/s320/IECache.png" width="320" /></a><br />
As shown above, you can change caching option to every time I visit the webpage which is automatically by default. You can reach to this dialog box by Internet Options -> Browser history (Setting clicked).<br />
<br />
However this solution will work only on that particular browser where the setting is done.<br />
This is not desirable solution on public sites.<br />
<br />
Solution 2 -<br />
Here you don't have to change the client side settings. Changes has to be done in the server side by 2 ways.<br />
1. By adding a caching header to the xml request such as cache-control to no-cache.<br />
2.By appending a random query parameter to the GET http request (e.g, www.xyz.com/sample.xml? randomVar=[random number], the random number could be generated from javascript code using math.random() function and then appended to the get request ).<br />
<br />
Both of them works.<br />
<br />
Happy programming<br />
Bijay<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com0tag:blogger.com,1999:blog-2427907316875671900.post-3561313194811407602011-09-10T21:16:00.001-07:002011-09-11T17:41:38.111-07:00Minimal Code Java Pet Store<div dir="ltr" style="text-align: left;" trbidi="on">Hi There,<br />
New exciting another implementation of famous java pet store programming is coming soon. The interesting observation of this implementation will be minimum coding with same functionality.<br />
<br />
It will be useful for new learners and intermediate developers.<br />
<br />
Keep an eye on my blog...<br />
<br />
Happy Computer Programming<br />
Bijay</div>Bijay Deohttp://www.blogger.com/profile/03892766687834461626noreply@blogger.com2