<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2302252496976792766</id><updated>2012-01-14T15:10:39.928+05:30</updated><category term='Design patterns'/><category term='JBoss'/><category term='jQuery'/><category term='Apache POI'/><category term='HTTPS'/><category term='SiteMesh'/><category term='Regular Expressions'/><category term='Web Services'/><category term='Security'/><category term='Java'/><category term='Swings'/><category term='PHP'/><category term='Tomcat'/><category term='Spring MVC'/><category term='Linux'/><category term='Wicket'/><category term='SLF4j'/><category term='Eclipse'/><category term='FlexGrid'/><category term='IE'/><category term='Tiles'/><category term='JAX-WS'/><category term='SSL'/><category term='Spring'/><category term='JSON'/><category term='USB network'/><category term='PDFBox'/><title type='text'>Java Geeks</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>43</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-9118119662224648606</id><published>2011-12-22T10:53:00.002+05:30</published><updated>2011-12-22T10:59:02.083+05:30</updated><title type='text'>Associating JSP Editor for the .xhtml extension in Eclipse</title><content type='html'>To use the eclipse JSP editor for editing .xhtml files (created for JSF), go to &lt;b&gt;Window &amp;gt; Preferences &amp;gt; General &amp;gt; Content Type &amp;gt; Text &amp;gt; JSP&lt;/b&gt; and add &lt;b&gt;*.xhtml&lt;/b&gt; in the File Associations section.&lt;br/&gt;

With this extension added, you shall be able to see the available tags &amp; attribute listing for the JSF tags too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-9118119662224648606?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/9118119662224648606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=9118119662224648606' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/9118119662224648606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/9118119662224648606'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2011/12/associating-jsp-editor-for-xhtml.html' title='Associating JSP Editor for the .xhtml extension in Eclipse'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-1166467162417996457</id><published>2011-05-16T07:01:00.015+05:30</published><updated>2011-05-16T22:39:02.077+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><title type='text'>Setting timeout for web service invocations using SII client generated using Weblogic 8.1 SP6 ANT task</title><content type='html'>Even though the 11g version of weblogic has been released, most of the big organizations continue to use BEA Weblogic 8.1 version (there are number of reasons and I won't get into details). Since we have been invoking some very busy web services and wanted to utilize the timeout mechanism to throw an exception on the client side so that the user may be requested to try at a later time rather than waiting for ever. Over a number of blogs I saw people suggesting the use of &lt;b&gt;weblogic.webservice.rpc.timeoutsecs&lt;/b&gt; property and provide the timeout values in seconds. It didn't seem to work for me and so was the experience of many users using the webservice client generated by weblogic ant tasks and using the weblogic.jar and webservice.jar in classpath. After a number of google searches, I found out a person who had succesfully used the above mentioned property to get the timeout functionality working. The secret to this person's solution was, he had used a DII (i.e. used a self written client instead of the generated client). The sample DII client for a Calculator service with an &lt;b&gt;add&lt;/b&gt; webmethod is as below:

&lt;pre name="code" class="java"&gt;
      String NS_XSD = "http://www.w3.org/2001/XMLSchema";
      String targetNamespace = "http://www.bea.com/examples/Calculator";

      System.setProperty("javax.xml.rpc.ServiceFactory", "weblogic.webservice.core.rpc.ServiceFactoryImpl");
      System.setProperty("weblogic.webservice.verbose", "false");
      System.setProperty("weblogic.webservice.UseWebLogicURLStreamHandler", "true");

      ServiceFactory factory = ServiceFactory.newInstance();
      QName serviceName = new QName(targetNamespace, "CalculatorService");
      QName portName = new QName(targetNamespace, "CalculatorServicePort");
      QName operationName = new QName(targetNamespace, "add");
      Service service = factory.createService(serviceName);

      Call call = service.createCall();
      call.setOperationName(operationName);
      call.setPortTypeName(portName);
      call.setProperty(Call.OPERATION_STYLE_PROPERTY, "rpc");

      call.addParameter("intVal", new QName(NS_XSD, "int"), Integer.class, ParameterMode.IN);
      call.addParameter("intVal0", new QName(NS_XSD, "int"), Integer.class, ParameterMode.IN);
      call.setReturnType(new QName(NS_XSD, "int"), Integer.class);
      call.setTargetEndpointAddress("http://localhost:7001/CalculatorService/CalculatorService");
      ((weblogic.webservice.core.rpc.CallImpl) call).setProperty("weblogic.webservice.rpc.timeoutsecs", "5");
      System.out.println("Invoked DII :");
      System.out.println("Result : " + call.invoke(new Object[] { new Integer(a), new Integer(b) }));
&lt;/pre&gt;

Now comes the second problem, all the existing client code for a huge number of webservices are SII codes (generated by the ANT task in webservices.jar). Instead of converting all the client codes to DII, I had to find the solution using SII. Since the code is not provided by BEA, I decompiled the jar to understand what's going on under the hood and found something strange, the &lt;b&gt;weblogic.webservice.rpc.timeoutsecs&lt;/b&gt; set as a system property was fetched inside the jared code (in webservices.jar) but was only used in the logic that handled https invocations (may be missed out looking at the right place or it was never there). In order to confirm my findings, I exposed the service over https and modified the client code with some additional properties (related to https invocations and nothing to do with web service in particular) and VOILA!!!! It worked :) &lt;br/&gt;&lt;/br/&gt;

&lt;b&gt;Inference:&lt;/b&gt; To use the timeout property for rpc calls when using client generated SII, the webservice should be exposed in https (can't change the code in the jars used by the client code to fix it as the code is not open source). Or write a DII (example given above).

For SII invocation over https you need to use the below mentioned properties:

&lt;pre name="code" class="java"&gt;       System.setProperty("weblogic.security.SSL.trustedCAKeyStore", "C:/bea/weblogic81/server/lib/DemoIdentity.jks");
       System.setProperty("weblogic.webservice.client.ssl.strictcertchecking", "false");
       System.setProperty("weblogic.webservice.rpc.timeoutsecs", "10");
&lt;/pre&gt;

For invocations over https you shall need jsafeFIPS.jar &amp; webserviceclient+ssl.jar in classpath in addition to webservices.jar &amp; weblogic.jar (you can find all of those in the weblogic's lib folder). The invocation may also ask for license files (don't know why), then even put the  license.bea &amp; license_scale_limited.bea in the classpath.&lt;br/&gt;&lt;br/&gt;


For Weblogic 9 versions, the property to be set has changed. More details can be found at &lt;a href="http://download.oracle.com/docs/cd/E13222_01/wls/docs92/webserv/client.html"&gt;http://download.oracle.com/docs/cd/E13222_01/wls/docs92/webserv/client.html&lt;/a&gt;.
Those properties are:

&lt;pre name="code" class="java"&gt;
((Stub)service_action)._setProperty("weblogic.wsee.transport.read.timeout", 5000); //values are in millis
((Stub)service_action)._setProperty("weblogic.wsee.transport.connection.timeout", 5000); //values are in millis
&lt;/pre&gt;


I hope you found this post helpful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-1166467162417996457?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/1166467162417996457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=1166467162417996457' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1166467162417996457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1166467162417996457'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2011/05/setting-timeout-for-web-service.html' title='Setting timeout for web service invocations using SII client generated using Weblogic 8.1 SP6 ANT task'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-87758012237741570</id><published>2011-04-07T01:34:00.003+05:30</published><updated>2011-04-07T01:39:22.641+05:30</updated><title type='text'>Stop waiting for the designer to create rounded corners !!!</title><content type='html'>How many times has it happened that you've been waiting for the designer to create and provide you with the rounded corners image? We usually use these images as background images for divs or a rounded corner table. Now this can be achieved by using pure CSS.  Follow the link &lt;a href="http://www.css3.info/preview/rounded-border/"&gt;http://www.css3.info/preview/rounded-border/&lt;/a&gt; for more details. These CSS styles work perfectly for firefox and chrome but can give some problems on IE.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-87758012237741570?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/87758012237741570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=87758012237741570' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/87758012237741570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/87758012237741570'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2011/04/stop-waiting-for-designer-to-create.html' title='Stop waiting for the designer to create rounded corners !!!'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-8377911079346205762</id><published>2011-03-12T14:50:00.000+05:30</published><updated>2011-03-12T14:50:35.369+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSON'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring MVC'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><category scheme='http://www.blogger.com/atom/ns#' term='FlexGrid'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>jQuery FlexGrid &amp; Spring MVC 3</title><content type='html'>Recently I have been working on Spring MVC 3. There is inbuilt support for returning JSON data using &lt;b&gt;@ResponseBody&lt;/b&gt; annotation. Just make sure that &lt;b&gt;jackson-all-x.x.x.jar&lt;/b&gt; is on your classpath. I used &lt;b&gt;jackson-all-1.7.4.jar&lt;/b&gt;.This works great. &lt;br /&gt;
&lt;br /&gt;
I wanted to display the results in a tabular format with some basic sorting and paging functionality with AJAX. So I thought I will give a shot at jQuery. jQuery is such an amazing JavaScript library it makes this a lot easier when it comes to working with JavaScript or manipulating DOM.&lt;br /&gt;
&lt;br /&gt;
I found this amazing jQuery plugin, FlexGrid. It was pretty much what I wanted. Though it does not support i18N or themed L&amp;F, it did the job for me.&lt;br /&gt;
&lt;br /&gt;
So I started integrating the pieces. jQuery FlexGrid expects the JSON data to be in a specific format:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt;   total: (no of rec)
   page : (page no)
   rows : [{id: idVal, cell: [ (col1 value) , (col2 value) ,.. ]},
           {id: idVal, cell: [ (col1 value) , (col2 value) ,.. ]}
          ]
&lt;/pre&gt;&lt;br /&gt;
But the data returned from the method with &lt;b&gt;@ResponseBody&lt;/b&gt; annotation is in the following format:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt;   {(col1 value) , (col2 value) ,..}
&lt;/pre&gt;&lt;br /&gt;
So I thought I might as well go ahead and modify my DAO's to return the data in the required format. But well, why should I modify my DAO's? Its after all a UI layer requirement. This is what I came up with. &lt;br /&gt;
&lt;br /&gt;
Write a wrapper class that will hold the data required for FlexGrid and send this as a JSON response. Here's the wrapper class:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt;import java.io.Serializable;
import java.util.List;

/**
 * Wrapper class for JSON data to send to the client.
 * 
 * Currently we are using jQuery FlexGrid for displaying JSON data in table.&lt;br/&gt;
 * 
 * jQuery FlexGrid plug-in requires data to be in the below specified format.
 * 
 * 
 * total: (no of rec)
 * page : (page no)
 * rows : [{id: idVal, cell: [ (col1 value) , (col2 value) ,.. ]},
 *         {id: idVal, cell: [ (col1 value) , (col2 value) ,.. ]}
 *        ]
 *  
 * To keep the data service independent of this requirement as far as possible,
 * the id, cell format specifically ignored. we wrap the result from the data
 * service and further format the result using JavaScript as required.
 * 
 * 
 * @author  Enterprise Integrals
 * 
 * @version 1.0 
 * @see &lt;a href="http://flexigrid.info/"&gt;jQuery FlexGrid&lt;/a&gt;
 * 
 * @param T generic data type for list of objects to be sent in the JSON response.
 */
public class JsonDataWrapper&amp;lt;T&amp;gt; implements Serializable {

 private static final long serialVersionUID = 1L;
 //current page
 private int page;
 //total number of records for the given entity.
 private long total;
 //list of records to be displayed.
 private List&amp;lt;T&amp;gt; rows;

 public JsonDataWrapper(int page, long total, List&amp;lt;T&amp;gt; rows) {
  this.page = page;
  this.total = total;
  this.rows = rows;
 }

 // getter setter

}
&lt;/pre&gt;Here is how it is used in Spring MVC 3&lt;br /&gt;
&lt;pre class="java" name="code"&gt;/**
* FlexGrid submits the following parameters
* page: current page
* rp: rows per page
* sortname: sorting done on which column:
* sortorder: sort order asc/desc
* query: search criteria if you are using search option
* qtype: search on which column in grid. this is again customizable.
* 
* These parameters can be used as filters in the DAO to get the data.
*
* By default the FlexGrid uses POST. You can change to GET.
* @param T the entity list to displayed in grid
*/
@RequestMapping(value="/some Path", method= RequestMethod.POST)
public @ResponseBody JsonDataWrapper&amp;lt;T&amp;gt; getRows(WebRequest request) {
 //get the current page posted from the grid.
 int page = Integer.parseInt(request.getParameter("page"));
 //get the list of objects to be displayed from the db calling the service
 //the total number of pages are dynamically calculated on the basis of the total number of rows in the table. get that.
 JsonDataWrapper&amp;lt;T&amp;gt; jdw = new JsonDataWrapper&amp;lt;T&amp;gt;(page, total rows, rows);
 return jdw;
}
&lt;/pre&gt;But there is a catch here. The FlexGrid plugin again refuses to render the data. The reason is the List&amp;lt;T&amp;gt; rows is again a list of objects returned from the DAO layer. It does not format the data as required by FlexGrid plugin. How do we do that? So I decided lets not put this logic in our MVC implementation. Here is how the data is set on to the FlexGrid using JavaScript.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt; $("#flex1").flexigrid({
   // standard flexgrid configuration as per your need,
   preProcess: formatData
 });
&lt;/pre&gt;&lt;br /&gt;
Note the &lt;b&gt;preProcess&lt;/b&gt; definition. It pre processes the data before the grid is populated with the JSON data return from the server. You can inline the function that actually formats the data but I kept it separate. Here it goes:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt;function formatData(data) {
 var rows = Array();
 $.each(data.rows,function(i,row){
                //id can be mapped to any attribute of the return object in the list
  rows.push({id:row.val1, cell:[row.val1,row.val2]});
 });
 
 return {
  total:data.total,
  page:data.page,
  rows:rows
 };     
}
&lt;/pre&gt;&lt;br /&gt;
Now the grid populated correctly. There are other grid plugins for jQuery but FlexGrid &amp;amp; jQGrid are the best. FlexGrid has lot less functionality as compared to jQGrid but I like it because its light. For advanced features you can have a look at jQGrid.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-8377911079346205762?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/8377911079346205762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=8377911079346205762' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8377911079346205762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8377911079346205762'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2011/03/jquery-flexgrid-spring-mvc-3.html' title='jQuery FlexGrid &amp; Spring MVC 3'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-8199628535208228373</id><published>2011-02-20T17:20:00.000+05:30</published><updated>2011-02-20T17:20:24.943+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><title type='text'>PHP 5.3 Date Timezone issue</title><content type='html'>I was recently trying to setup PHP on my development machine. I downloaded the php-5.3.5-Win32-VC6-x86.zip for Windows and started to manually configure PHP (to get a feel. You can ofcourse use something like XAMPP to get started quickly.)&lt;br /&gt;
&lt;br /&gt;
Then I quickly executed some PHP scripts and found everything was running fine. I dumped some of the PHP samples I had and played around until one started complaining&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It is not safe to rely on the system's timezone settings.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Little researching solved the issue. PHP 5.3 requires you to set &lt;b&gt;date.timezone&lt;/b&gt; in php.ini file&lt;br /&gt;
&lt;br /&gt;
e.g. date.timezone = Asia/Calcutta&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://nl3.php.net/manual/en/timezones.php"&gt;http://nl3.php.net/manual/en/timezones.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-8199628535208228373?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/8199628535208228373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=8199628535208228373' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8199628535208228373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8199628535208228373'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2011/02/php-53-date-timezone-issue.html' title='PHP 5.3 Date Timezone issue'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-4053678719805189742</id><published>2010-06-17T22:32:00.001+05:30</published><updated>2010-06-17T22:35:26.953+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><title type='text'>Which style of WSDL should I use?</title><content type='html'>A Web Services Description Language (WSDL) binding style can be RPC or document. The use can be encoded or literal. How do you determine which combination of style and use to use? The author describes the WSDL and SOAP messages for each combination to help you decide.&lt;br /&gt;
&lt;a href="http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/"&gt;&lt;br /&gt;
Which style of WSDL should I use?&lt;br /&gt;
&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-4053678719805189742?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='enclosure' type='' href='http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/' length='0'/><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/4053678719805189742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=4053678719805189742' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4053678719805189742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4053678719805189742'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2010/06/which-style-of-wsdl-should-i-use.html' title='Which style of WSDL should I use?'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-722395827174669192</id><published>2009-10-31T09:24:00.016+05:30</published><updated>2009-10-31T20:37:56.135+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java 5 EOSL</title><content type='html'>Java 5 has reached End Of Life. Most of the bigger organization in the service industry are still using Java 1.4 and are not willing to migrate as they anticipate migration issues and feel that its a risk and unjustifiable. Java 6 has been out for a long and its time to take advantage of the new features, especially the web services stack (JAX-WS). There are lot of performance improvements which might be one reason to migrate.&lt;br/&gt;&lt;br/&gt;
On a personal note migration is little to do with technical, but more often political.&lt;br/&gt;&lt;br/&gt;
&lt;a href="http://java.sun.com/products/archive/eol.policy.html"&gt;http://java.sun.com/products/archive/eol.policy.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-722395827174669192?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/722395827174669192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=722395827174669192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/722395827174669192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/722395827174669192'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2009/10/java-5-eosl.html' title='Java 5 EOSL'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-7872927543327054230</id><published>2009-09-17T22:55:00.016+05:30</published><updated>2009-10-02T20:24:43.485+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTPS'/><title type='text'>File Download issue with IE over HTTPS</title><content type='html'>I am currently working on a project where the user can download PDF, XLS and CSV files. These files are dynamically generated within the application and thrown out on the browser when the user clicks on a particular link. This was running like a charm till recently, we decided to move to HTTPS and it stopped working. We were getting a message saying&lt;br&gt;&lt;br&gt;
&lt;span style="font-weight:bold;"&gt;"The file could not be stored in cache."&lt;br&gt;
"Internet Explorer was unable to open this site. The requested site is either unavailable or cannot be found. Please try again later."&lt;/span&gt;
&lt;br&gt;&lt;br&gt;
After a little googling I found that it is a known issue with IE. Refer to the link below.
&lt;a href="http://support.microsoft.com/kb/815313"&gt;http://support.microsoft.com/kb/815313&lt;/a&gt;
But installing a hotfix was out of question. So I went looking for a solution that could be handled through code and here is the solution that seems to work for us and the magic required to satisfy IE
&lt;pre name="code" class="java"&gt;
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=0");
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-7872927543327054230?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/7872927543327054230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=7872927543327054230' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/7872927543327054230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/7872927543327054230'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2009/09/file-download-issue-with-ie6-over-https_17.html' title='File Download issue with IE over HTTPS'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-6665638887861486105</id><published>2009-08-12T19:50:00.016+05:30</published><updated>2009-08-13T22:39:57.728+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSL'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Two way SSL on Tomcat &amp; JBoss</title><content type='html'>Continued from the previous post where I had put in steps to setup one way SSL. In this post i shall provide steps to enable client certificate authorization. Hence here we will see a situation where the client verifies the server cert and server verifies the client cert for validity and trust before a successful SSL handshake.


The initial steps shall be the same as mentioned in my previous post and with an assumption that your one way SSL is already working. Now to enable the client authorization, we need to modify the server.xml as below:

&lt;pre name="code" class="java"&gt;
&amp;lt;Connector port="8443" minSpareThreads="5" maxSpareThreads="75" enableLookups="true"
disableUploadTimeout="true" acceptCount="100" maxThreads="200" scheme="https" secure="true"
SSLEnabled="true" keystoreFile="c:/certs/test_store" keystorePass="password" clientAuth="true" truststoreFile="c:/certs/test_store" truststorePass="password" sslProtocol="TLS"/&amp;gt;
&lt;/pre&gt;

Export a certificate from the client keystore (client_store in this example) and import it into the server's truststore (test_store in this example). In real world you probably would not import each client cert but a CA root cert and then sign each client cert with that one. The above mentioned way is only for testing purposes and get the feel of the process. Launch the server.


No modifications are needed in the code on the client side. You can launch the client using:


&lt;pre name="code" class="java"&gt;
c:\&gt;java -Djavax.net.ssl.trustStore=c:/certs/client_store -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStore=c:/certs/client_store -Djavax.net.ssl.keyStorePassword=password HelloWorld
&lt;/pre&gt;


&lt;b&gt;Additional Tips:&lt;/b&gt;

1)In order to get detailed debug statements for the SSL handshake between the server and the client you can use the vm argument &lt;b&gt;-Djavax.net.debug=ssl,handshake&lt;/b&gt; on either side.

2)If you want to be able to access the site using your browser then you will have to have the client certificate in the &lt;b&gt;Internet Options &amp;gt; Content &amp;gt; Certificates &amp;gt; Personal&lt;/b&gt; section. For this you will have to be using a PKCS12 keystore instead of a standard JKS keystore. Hence instead use the following steps to generate the keystore on the client side:

&lt;pre name="code" class="java"&gt;
keytool -genkey -v -alias clientKey -keyalg RSA -storetype PKCS12 -keystore client.p12
&lt;/pre&gt;

The keypass and storepass needs to be the same. Like in the steps for client using JKS, even here you can use a similar command to export the cert

&lt;pre name="code" class="java"&gt;
keytool -export -alias clientKey -keystore client.p12 -storetype PKCS12 -rfc -file client.cer
&lt;/pre&gt;

Rest instructions like importing this cert into server's keystore continue to be same. One important point to note is that since the server's cert cannot be imported into PKCS12 keystore on client side, you have to import it into a JKS truststore and the commandline to launch the program needs to be modified as:

&lt;pre name="code" class="java"&gt;
c:\&gt;java -Djavax.net.debug=ssl,handshake -Djavax.net.ssl.keyStoreType=PKCS12
-Djavax.net.ssl.keyStore=c:/certs/client.p12 -Djavax.net.ssl.keyStorePassword=password
-Djavax.net.ssl.trustStore=c:/certs/cacerts -Djavax.net.ssl.trustStorePassword=password HelloWorld
&lt;/pre&gt;

In this case, the server's certificate has been imported into the &lt;b&gt;cacerts&lt;/b&gt; truststore of type JKS.


The PKCS12 keystore can be imported into the internet explorer at the above mentioned path. Now if you hit the URL using https, you shall be displayed a dialog box to select the cert you want to use for client authorization. Once you select it, the handshake process continues.



Through out the example we have been making hits to a servlet (https://personal-PC:8443/SampleWebApp/HelloWorld). We can get the details of the client cert used to access this URL from an attribute in the request object.

&lt;pre name="code" class="java"&gt;
X509Certificate certs[] = (X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
for (X509Certificate cert : certs) {
out.println(cert.getIssuerDN());
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-6665638887861486105?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/6665638887861486105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=6665638887861486105' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6665638887861486105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6665638887861486105'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2009/08/two-way-ssl-on-tomcat-jboss.html' title='Two way SSL on Tomcat &amp; JBoss'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-5454116256686521196</id><published>2009-08-04T17:57:00.007+05:30</published><updated>2009-10-29T20:03:38.406+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSL'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>SSL on Tomcat, JBoss and command line client (continued)</title><content type='html'>&lt;span style="font-family:arial;"&gt;I finished my previous post with the ending lines as &lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:courier new;"&gt;So if you had used domain name in the cert CN, then use domain name or if it is machine name then use the machine name &lt;/span&gt;&lt;span style="font-style: italic;"&gt;; &lt;/span&gt;and if you don't do so you shall see error messages similiar to &lt;span style="color: rgb(255, 0, 0);font-family:courier new;" &gt;HTTPS hostname wrong:  should be &amp;lt;personal-pc&amp;gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:arial;" &gt;where you had given your ip or localhost as the CN name while creating the keystore whereas referring the machine by its name (personal-pc in this case). If you go by the rules mentioned in previous post, it shall work i.e. using the same name in the URL to refer the machine you used as CN.

What if you still want to be able to work with the different name (not the one similiar to the CN) or you want to use the IP in the URL when accessing the site?

Well there is also a provision for this. You can write your own code to decide what needs to be done in such a situation by implementing the &lt;span style="font-style: italic;"&gt;HostnameVerifier&lt;/span&gt; interface.



&lt;/span&gt;
&lt;pre name="code" class="java"&gt;
URL url = new URL("https://personal-PC:8443/SampleWebApp/HelloWorld");
URLConnection connection = url.openConnection();

if (connection instanceof HttpsURLConnection) {
    ((HttpsURLConnection) connection).setHostnameVerifier(new HostnameVerifier() {

        public boolean verify(String hostname, SSLSession session) {
           //TODO: Logic controlling the verfication.
           return true;
        }
    });
}

BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
//Rest of the IO code.
&lt;/pre&gt;

&lt;span style="font-family:arial;"&gt;In the code above, I am just returning true for what ever comes in as host name, you shall write your logic here to handle the situation the way you like. With the above code in place, you will be able to use all valid names to refer your machine in the URL including computer name and localhost/127.0.0.1 (only for testing purposes).&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-5454116256686521196?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/5454116256686521196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=5454116256686521196' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5454116256686521196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5454116256686521196'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2009/08/ssl-on-tomcat-jboss-and-command-line_04.html' title='SSL on Tomcat, JBoss and command line client (continued)'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-2697528797946811045</id><published>2009-08-03T19:55:00.014+05:30</published><updated>2009-10-29T19:59:28.940+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSL'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>SSL on Tomcat, JBoss and command line client</title><content type='html'>&lt;font face="arial"&gt;
Talking about a secure website, the first thing that comes to mind is SSL. For almost all the sites today, we do encounter a section in the website where the address bar turns yellow with a lock indicating that the data being transfered is being encrypted. That section can be a login screen or a transaction screen etc. In this post i've tried to put some steps to achieve the goal of securing a HelloWorldServlet (not much useful but the technique for this or a complex one shall be same).&lt;br/&gt;

In order to start with the process of securing your site, we need a certificate. You shall be able to get a valid certificate from a Certification Authority like Thwate, Verisign and many more. Here I shall use a self-signed certificate but the process shall be quite similar for the ones from a Certification Authority (CA).&lt;br/&gt;

First of all we create a Keystore using the keytool available in a JRE installation. You can look for it in &lt;b&gt;JDK\bin&lt;/b&gt; or &lt;b&gt;JRE\bin&lt;/b&gt; directory.
&lt;pre name="code" class="java"&gt;
keytool -genkey -alias rsatest -keyalg RSA -keystore test_store -validity 60
&lt;/pre&gt;

Keep in mind while creating the keystore that the answer to the first question i.e. &lt;b&gt;What is your first and last name?&lt;/b&gt; should be either your domain address or machine name (It should be the name by which your machine shall be referred in URL when clients are making hits to it using an HttpsURLConnection). This is the &lt;b&gt;CN&lt;/b&gt; (Common Name). &lt;br/&gt;

After answering a number of self explanatory questions and providing an appropriate password, you shall see a file names &lt;b&gt;test_store&lt;/b&gt; in your present working directory folder. &lt;br/&gt;

In the next step, you can create a certificate that shall be required by the client application to communicate with this machine using SSL.

&lt;pre name="code" class="java"&gt;
keytool -export -alias rsatest -file rsatest.cer -keystore test_store
&lt;/pre&gt;

After executing this command, you shall see a rsatest.cer file created.&lt;br/&gt;

In order to start tomcat in https mode in addition to its default http mode, we need to modify the server.xml in the &lt;b&gt;TOMCAT_HOME\CONF&lt;/b&gt; folder.&lt;br/&gt;

Paste the snippet below in &lt;b&gt;server.xml&lt;/b&gt;.

&lt;pre name="code" class="java"&gt;
 &amp;lt;Connector port="8443" minSpareThreads="5" maxSpareThreads="75" enableLookups="true" 
  disableUploadTimeout="true" acceptCount="100" maxThreads="200" scheme="https" secure="true" 
  SSLEnabled="true" keystoreFile="c:/certs/test_store" keystorePass="password" clientAuth="false" sslProtocol="TLS"/&amp;gt;
&lt;/pre&gt;

Replace the location of keystoreFile and the keystorePass with appropriate values.&lt;br/&gt;

In case of JBoss the process is quite similar to that of Tomcat. We need to edit &lt;b&gt;JBOSS_HOME\server\default\deploy\jboss-web.deployer\server.xml&lt;/b&gt; instead and paste the below give snippet.

&lt;pre name="code" class="java"&gt;
 &amp;lt;Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false"
        strategy="ms"
               address="${jboss.bind.address}"
               keystoreFile="C:/certs/test_store"
               keystorePass="password"
               sslProtocol="TLS"/&amp;gt;
&lt;/pre&gt;

Which ever server you choose to modify, after you are done with saving the server.xml file start the server. You should be able to make hits to the server url with https protocol on an appropriate port (8443 in our case). Expect to see some warning like &lt;b&gt;There is a problem with this website's security certificate.&lt;/b&gt; on IE or &lt;b&gt;localhost:8443 uses an invalid security certificate.&lt;/b&gt; on firefox for the reasons explained very well on that screen. This happens as ours is a self-signed certificate and not issued by a trusted certificate authority that the machine or the browsers certificate stores posses. These self signed shall be good enough for internal use or testing but for internet use you should get the certs from a trusted certificate authority.&lt;br/&gt;

Well, we are ready with our server running in https mode. For example purposes I had developed a very simple HelloWorldServlet. I am able to access via &lt;i&gt;https://localhost:8443/WebAppDemo/HelloWorldServlet&lt;/i&gt;&lt;br/&gt;

Before we write the client code, we need to get the cert that we generated earlier. As we are on the same machine, you can re-use the trust store (for practice purposes) but in real environment (on a different machine), you shall create a new trust store and import the cert into it using the command given below:

&lt;pre name="code" class="java"&gt;
keytool -import -alias rsatest -file rsatest.cer -keystore cacerts
&lt;/pre&gt;

The same command is used to import any ROOT certificates or the certs provided by a website that you want to connect using your java program.&lt;br/&gt;

With the above command we created a new keystore and imported the certificate into it. The client code is very simple i.e. a usual HttpUrlConnection code. A small snippet from my test class HelloWorld.java is given below:

&lt;pre name="code" class="java"&gt;
  URL url = new URL("https://localhost:8443/WebAppDemo/HelloWorldServlet");
  URLConnection connection = url.openConnection();
&lt;/pre&gt;

Rest code is simple IO reading from stream hence skipping it.&lt;br/&gt;

The important part is are the VM arguments. If you have written a stand alone application, you shall run it using the following command:

&lt;pre name="code" class="java"&gt;
c:\&gt;java -Djavax.net.ssl.trustStore=c:/certs/cacerts -Djavax.net.ssl.trustStorePassword=password HelloWorld
&lt;/pre&gt;

One very important point is that in the URL the server machine should be refered by the name used in the CN while creating the keystore. So you need to use the domain name of the machine as the CN. It won't work otherwise. In my example using localhost is a bad practice but I feel you get the point and modify your codes according to the situation. The IP of the machine should not be used as a CN, so you have to use the domain name or the machine name as the CN for the cert. The same domain name or machine name (used in CN) should be used when accessing the URL or else you will encounter host name verification failure.&lt;/font&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-2697528797946811045?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/2697528797946811045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=2697528797946811045' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2697528797946811045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2697528797946811045'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2009/08/ssl-on-tomcat-jboss-and-command-line.html' title='SSL on Tomcat, JBoss and command line client'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-1261464158981864454</id><published>2009-02-23T21:06:00.005+05:30</published><updated>2009-02-23T21:17:54.982+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Executing the code while JVM shuts down</title><content type='html'>&lt;span style="font-family:arial;"&gt;A number of times we have encountered a situation where we want a particular piece of code to be executed when our application is exiting. More necessarily we need such a mechanism when we have developed a server and want the code to be executed for any System.exit(0) call or a CTRL + C key combination on the console. &lt;/span&gt;

&lt;span style="font-family:arial;"&gt;A shutdown hook is the way out for this problem. Writing it is very simple. All the code we need to be executed should be written in a Thread and its object should be registered with the Runtime of the JVM. The code is as below.

&lt;pre name="code" class="java"&gt;
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
System.out.println("Executing the code while closing down.");
}
});
&lt;/pre&gt;
A detailed explanation of the above method is provided in the Javadocs for the Runtime class.
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-1261464158981864454?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/1261464158981864454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=1261464158981864454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1261464158981864454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1261464158981864454'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2009/02/executing-code-while-jvm-shuts-down.html' title='Executing the code while JVM shuts down'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-2905491766554648394</id><published>2009-01-25T21:29:00.013+05:30</published><updated>2009-01-25T22:07:08.993+05:30</updated><title type='text'>Remote debugging application on pocket pc running on j9</title><content type='html'>&lt;span style="font-family:arial;"&gt;I assume that eclipse was used for the development of the application. Once the application is ready, It shall be copied over to the device that has j9 run time environment. The application can be deployed as a jar file or classes. In order to run the application, either command line needs to be used or we can create a link file with the following content:&lt;/span&gt;
&lt;pre&gt;
&lt;span style="font-family:arial;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;255#"\Program Files\j9\bin\j9.exe" -jcl:ppro11  -cp "Test.jar" "trial.Test"&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;span style="font-family:arial;"&gt;Assuming that the application is packed into a jar file and the trail.Test is the main class. &lt;/span&gt;&lt;span style="font-family:arial;"&gt;Save the above file with a &lt;span style="font-weight: bold;"&gt;.lnk&lt;/span&gt; extension e.g. &lt;span style="font-weight: bold;"&gt;Test.lnk&lt;/span&gt;. Click on the Test.lnk file and see that the application launches properly.&lt;/span&gt;
&lt;pre&gt;
&lt;span style="font-family:arial;"&gt;Now in order to remote debug, check for the existence of &lt;span style="font-weight: bold;"&gt;j9dbg23.dll&lt;/span&gt; in your j9 bin directory. Modify the &lt;span style="font-weight: bold;"&gt;Test.lnk&lt;/span&gt; file to:&lt;/span&gt;
&lt;/pre&gt;
&lt;pre&gt;
&lt;span style="font-family:arial;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;255#"\Program Files\j9\bin\j9w.exe" -jcl:ppro11 -debug:transport=dt_socket,server=y,address=4142 -cp "Test.jar" "trial.Test"&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;span style="font-family:arial;"&gt;Once it is done, open the same project in eclipse. &lt;/span&gt;
&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Open the Debug Configurations window (Run &gt; Debug Configuration).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Create a new &lt;span style="font-weight: bold;"&gt;Remote Java Application&lt;/span&gt; configuration and enter the details as follows:&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;
&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Project -&gt; Select your project.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Connection Type -&gt; Standard (Socket Attach)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Connection Properties -&gt; ip of the remote machine (pocket pc) and the debug port (4142 in our example case). This port is mentioned in the above created ".lnk" file, hence should be the same in this "Remote Java Application" debug configuration.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Run the application on the pocket pc by clicking on the Test.lnk file.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Click on the Debug button on the newly created "Remote Java Application" debug configuration.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;You are ready to debug your application buy putting break points in appropriate code locations.&lt;/span&gt;
&lt;span style="font-family:arial;"&gt;This scenario has been tested with j9 on a Windows CE 4.2 environment. Should be the same for Windows Mobile and Linux environment (you'll get an .so instead of a .dll in j9 distribution).&lt;/span&gt;
&lt;pre&gt;
&lt;span style="font-family:arial;"&gt;The debugger can similiarly be attached even using netbeans.&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-2905491766554648394?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/2905491766554648394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=2905491766554648394' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2905491766554648394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2905491766554648394'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2009/01/remote-debugging-application-on-pocket.html' title='Remote debugging application on pocket pc running on j9'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-8998226720360554682</id><published>2008-12-06T00:00:00.004+05:30</published><updated>2008-12-06T00:42:46.181+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Fullscreen of Fedora10 installed on Vista using VirtualBox</title><content type='html'>&lt;span style="font-family:arial;"&gt;Installing Fedora10 on Windows Vista using Virtual Box was very straight forward. I used a live disk or the iso initially and once the virtual machine booted up, I used the option of install to hard disk to avoid using the &lt;span style="font-weight: bold;"&gt;iso &lt;/span&gt;or the &lt;span style="font-weight: bold;"&gt;Live CD&lt;/span&gt;.&lt;/span&gt;

&lt;span style="font-family:arial;"&gt;The complex issue was that the screen size is too small i.e. the highest available resolution was 800 x 600. My Vista is using 1280 x 800, hence the Fedora on Virtual Box looked very small. I was able to make it full screen by following certain steps mentioned as below:

&lt;/span&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;Run the Virtual Machine installed using VirtualBox. Go to the &lt;span style="font-weight: bold;"&gt;Devices &lt;/span&gt;menu and select the "I&lt;span style="font-weight: bold;"&gt;nstall Guest Addons . . .&lt;/span&gt;" option. Reboot the machine.
&lt;/li&gt;&lt;/ul&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;When the virtual machine is shutdown, you should be able to see that in the settings "&lt;span style="font-weight: bold;"&gt;CD/DVD-ROM&lt;/span&gt;" section will be configured for the "&lt;span style="font-weight: bold;"&gt;VBoxGuestAdditions.iso&lt;/span&gt;".&lt;/li&gt;&lt;/ul&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;On the Virtual Machine startup, you shall be able to see this iso mounted and have icon on the desktop.&lt;/li&gt;&lt;/ul&gt;&lt;ul face="arial"&gt;&lt;li&gt;Before these Addons can be installed certain dependencies like &lt;span style="font-weight: bold;"&gt;make&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;gcc&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;kernel-headers&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;kernel-devel &lt;/span&gt;needs to be installed. These can be done using the following commands:&lt;/li&gt;&lt;/ul&gt;&lt;ol style="font-family: arial; font-weight: bold;"&gt;&lt;ol&gt;&lt;ul&gt;&lt;li&gt;#] yum install make&lt;/li&gt;&lt;li&gt;#] yum install gcc-c++&lt;/li&gt;&lt;li&gt;#] yum install kernel-headers&lt;/li&gt;&lt;li&gt;#] yum install kernel-devel&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;ul style="font-family: arial;"&gt;&lt;li&gt;When the dependencies are installed, we proceed installing the addons&lt;/li&gt;&lt;ul style="font-weight: bold;"&gt;&lt;ul&gt;&lt;li&gt;#] cd /media/VBOXADDITIONS_2.0.6-39755/&lt;/li&gt;&lt;li&gt;#] sh ./VBoxLinuxAdditions-x86.run&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li  style="font-family:arial;"&gt;Reboot the Virtual Machine. Now fire the commands to get the Display in the System &gt; Administration menu.&lt;/li&gt;&lt;ul style="font-family: arial; font-weight: bold;"&gt;&lt;ul&gt;&lt;li&gt;#] yum install system-config-display&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li  style="font-family:arial;"&gt;Now you can open the &lt;span style="font-weight: bold;"&gt;System &gt; Administration &gt; Display&lt;/span&gt; window. In the &lt;span style="font-weight: bold;"&gt;Hardware tab&lt;/span&gt;, select the &lt;span style="font-weight: bold;"&gt;VBoxVideo&lt;/span&gt; drivers in the&lt;span style="font-weight: bold;"&gt; Video Card configuration&lt;/span&gt;. Press OK two times and reboot the machine.&lt;/li&gt;&lt;li face="arial"&gt;On restart, again open the Display window. If the desired resolution is not being displayed then you have to manually modify the &lt;span style="font-weight: bold;"&gt;/etc/X11/xorg.conf&lt;/span&gt; file.&lt;/li&gt;&lt;li style="font-family: arial;"&gt;Open the &lt;span style="font-weight: bold;"&gt;/etc/X11/xorg.conf&lt;/span&gt; file . Modify the &lt;span style="font-weight: bold;"&gt;Section "Screen"&lt;/span&gt;. You need to add the &lt;span style="font-weight: bold;"&gt;Modes&lt;/span&gt;.
&lt;/li&gt;&lt;pre&gt;
      Section "Screen"
         Identifier "Screen0"
         Device     "Videocard0"
         Monitor    "Monitor0"
         DefaultDepth     24
         SubSection "Display"
             Viewport   0 0
             Depth     24
             &lt;span style="font-weight: bold;"&gt;Modes "1024x768"&lt;/span&gt;
         EndSubSection
      EndSection&lt;/pre&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Reboot the machine. On restart, you shall see the Virtual Machine will start with the new resolution. To have full screen press the &lt;span style="font-weight: bold;"&gt;host + F&lt;/span&gt; keys. By default the host key for Virtual Box is &lt;span style="font-weight: bold;"&gt;Right Control&lt;/span&gt; key.&lt;/span&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-8998226720360554682?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/8998226720360554682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=8998226720360554682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8998226720360554682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8998226720360554682'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/12/fullscreen-of-fedora10-installed-on.html' title='Fullscreen of Fedora10 installed on Vista using VirtualBox'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-3516863351085446674</id><published>2008-11-11T15:23:00.009+05:30</published><updated>2008-11-17T13:07:06.648+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Checking network connection using Java</title><content type='html'>&lt;span style="font-family:arial;"&gt;At times it is required to check whether the machine is still connected to network or not.  One way to find it using JDK1.6 by using the code is as below.&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
Enumeration&amp;lt;NetworkInterface&amp;gt; interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
 NetworkInterface nic = interfaces.nextElement();
 System.out.print("Interface Name : [" + nic.getDisplayName() + "]");
 System.out.println(", Is connected : [" + nic.isUp() + "]");
}
&lt;/pre&gt;&lt;span style="font-family:arial;"&gt;Additionally several new useful methods such as &lt;span style="font-family:courier new;"&gt;isLoopBack(), isPointToPoint()&lt;/span&gt; and many more have been added in JDK 1.6 release. Refer to the Javadocs for more information on &lt;span style="font-family:courier new;"&gt;NetworkInterface&lt;/span&gt; class in &lt;span style="font-family:courier new;"&gt;java.net &lt;/span&gt;package.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-3516863351085446674?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/3516863351085446674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=3516863351085446674' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3516863351085446674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3516863351085446674'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/11/checking-network-connection-using-java.html' title='Checking network connection using Java'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-4871567240265853388</id><published>2008-10-21T13:07:00.004+05:30</published><updated>2008-10-23T13:08:44.409+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Regular Expressions'/><title type='text'>Best way to check for all alphabetic, alphanumeric or numeric strings</title><content type='html'>&lt;span style="font-family: arial;"&gt;The best way of checking whether the string is a pure alphabetic, alphanumeric or numeric is to use the String class's matches method by using the regex pattern as a parameter.&lt;/span&gt;
&lt;pre name="code" class="java"&gt;
  if ("!abc123".matches("[a-zA-Z]*")) {
   System.out.println("Pure alphabetic string");
  } else {
   System.out.println("Not pure alphabets");
  }
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-4871567240265853388?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/4871567240265853388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=4871567240265853388' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4871567240265853388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4871567240265853388'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/10/best-way-to-check-for-all-alphabetic.html' title='Best way to check for all alphabetic, alphanumeric or numeric strings'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-7814196445683957709</id><published>2008-10-05T13:10:00.040+05:30</published><updated>2008-10-05T22:30:27.667+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SLF4j'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><title type='text'>Auto Injection of a Logger into Spring beans</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Dependency injection using Spring provides an easy way of injecting logging implementations to beans configured using Spring. Spring inherently use (JCL) Jakarta Commons Logging which may cause class loading issues.&lt;br/&gt;

Refer to this post &lt;a href="http://www.qos.ch/logging/classloader.jsp"&gt;http://www.qos.ch/logging/classloader.jsp &lt;/a&gt;.&lt;br/&gt;

After searching for a while I found out that we can replace JCL with SLF4j by just replacing the &lt;span style="font-weight: bold;"&gt;commons-logging.jar&lt;/span&gt; with the SLF4j provided &lt;span style="font-weight: bold;"&gt;jcl-over-slf4j.x.x.x.jar&lt;/span&gt; implementation (Please add the required dependencies). SLF4j provides a lot of good features over good old logging implementation. &lt;br/&gt;Please refer to  &lt;a href="http://www.slf4j.org/"&gt;http://www.slf4j.org&lt;/a&gt;.&lt;br/&gt;
Not going into further details lets start with our implementation of &lt;/span&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;&lt;span style="font-size:85%;"&gt;Logger.
&lt;span style="font-weight: bold;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;T&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;he first step is to create a Logger annotation. The Logger annotation is shown below.&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-family:courier new;font-size:100%;"  &gt;&lt;pre name="code" class="java"&gt;/**
* Indicates Logger of appropriate type to
* be supplied at runtime to the annotated field.
*
* The injected logger is an appropriate implementation
* of org.slf4j.Logger.
*/
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

@Retention(RUNTIME)
@Target(FIELD)
@Documented
public @interface Logger {
}&lt;/pre&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;Now lets define a class that actually does the job of injecting the logger implementation.&lt;/span&gt;&lt;pre name="code" class="java"&gt;
/**
 * Auto injects the underlying implementation of logger into the bean with field
 * having annotation &lt;code&gt;Logger&lt;/code&gt;.
 * 
 */
import java.lang.reflect.Field;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.util.ReflectionUtils;

import static org.springframework.util.ReflectionUtils.FieldCallback;

public class LoggerInjector implements BeanPostProcessor {

 public Object postProcessAfterInitialization(Object bean, String beanName)
   throws BeansException {
  return bean;
 }

 public Object postProcessBeforeInitialization(final Object bean,
   String beanName) throws BeansException {
  ReflectionUtils.doWithFields(bean.getClass(), new FieldCallback() {
   public void doWith(Field field) throws IllegalArgumentException,
     IllegalAccessException {
    // make the field accessible if defined private
    ReflectionUtils.makeAccessible(field);
    if (field.getAnnotation(Logger.class) != null) {
     Log log = LogFactory.getLog(bean.getClass());
     field.set(bean, log);
    }
   }
  });
  return bean;
 }
}
&lt;/pre&gt;

&lt;span style=";font-family:arial;font-size:100%;"&gt;Using it is even simpler. Just add the Logger annotation created above to the Log field in the required class.
The class DemoBean below shows a field annotated this way.
The import class Log is actually present in the jcl-over-slf4j.x.x.x.jar and does not depend on the JCL anymore.&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
import org.apache.commons.logging.Log;

public class DemoBean {

 @Logger
 private Log log;

 public void doSomething() {
  log.info("message");
  log.error("Lets see how the error message looks...");
 }
}
&lt;/pre&gt;

&lt;span style=";font-family:arial;font-size:100%;"&gt;Just define the above bean in your spring application context defition. (I used XML configuration). Also you need to define a bean using the class LoggerInjector. &lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Application contexts can auto-detect BeanPostProcessor beans in their  bean definitions and apply them before any other beans get created&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;.&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-7814196445683957709?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/7814196445683957709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=7814196445683957709' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/7814196445683957709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/7814196445683957709'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/10/auto-injection-of-logger-into-spring.html' title='Auto Injection of a Logger into Spring beans'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-5960205477965171145</id><published>2008-09-18T08:44:00.024+05:30</published><updated>2008-10-06T20:19:51.841+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><title type='text'>Solution to the issue with List's in wsimport generated POJO classes</title><content type='html'>&lt;span style="font-family:arial;"&gt;This topic is in extension to "&lt;/span&gt;
&lt;a style="font-family: arial;" href="http://jgeeks.blogspot.com/2008/09/its-not-necessary-to-use-wsimport.html"&gt;It is not necessary to use wsimport generated POJO Files&lt;/a&gt;
&lt;span style="font-weight: bold;font-family:arial;" &gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;" post on this blog.&lt;/span&gt;

&lt;span style="font-family:arial;"&gt;Lets consider that our &lt;/span&gt;
&lt;span style="font-weight: bold;font-family:arial;" &gt;Employee &lt;/span&gt;
&lt;span style="font-family:arial;"&gt;class has another property called &lt;/span&gt;
&lt;span style="font-weight: bold;font-family:arial;" &gt;addresses&lt;/span&gt;
&lt;span style="font-family:arial;"&gt;. This addresses property is a List of strings. So our modified 
&lt;span style="font-weight: bold;"&gt;Employee &lt;/span&gt;shall look like:&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
import java.util.List;
public class Employee {
 private int age;
 private String name;
 private List&amp;lt;String&amp;gt; addresses;

 public Employee() {
 }

 public Employee(int age, String name, List&amp;lt;String&amp;gt; addresses) {
  super();
  this.age = age;
  this.name = name;
  this.addresses = addresses;
 }
 
 //write getter setter for properties to comply to Java Bean/POJO standard
}
&lt;/pre&gt;
&lt;span style="font-family:arial;"&gt;and the Web Method is:&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
@WebMethod
 public Employee printEmployee(Employee e) {
  System.out.println(e.getName() + " - " + e.getAge() + " - " e.getAddresses);
  return e;
 }
&lt;/pre&gt;

&lt;span style="color: rgb(0, 0, 0);font-family:arial;" &gt;As a result of generating the client using &lt;span style="font-weight: bold;"&gt;wsimport&lt;/span&gt;, the generated &lt;span style="font-weight: bold;"&gt;Employee &lt;/span&gt;looks like:

&lt;pre name="code" class="java"&gt;
@XmlAccessorType(XmlAccessType.FIELD) 
 @XmlType(name = "employee", propOrder = {  "addresses",  "age",  "name" }) 
 public class Employee {  
  @XmlElement(nillable = true)  
  protected List addresses;  
  protected int age;  
  protected String name;
 }
&lt;/pre&gt;

&lt;h3 class="post-title entry-title"&gt;&lt;a href="http://jgeeks.blogspot.com/2008/09/its-not-necessary-to-use-wsimport.html"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;span style="font-family:arial;"&gt;  and strangely enough there is no setter method for the list of addresses. There is a clear explanation for the same in the comments above the getter for the addresses property as:&lt;/span&gt;&lt;br/&gt;

&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;This accessor method returns a reference to the live list,&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;not a snapshot. Therefore any modification you make to the&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;returned list will be present inside the JAXB object.&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;This is why there is not a &amp;lt;CODE&amp;gt;set&amp;lt;/CODE&amp;gt; method for the addresses property.&lt;/span&gt;&lt;br/&gt;

&lt;span style="font-weight: bold;font-family:arial;" &gt;Solution:&lt;/span&gt;
&lt;span style="font-family:arial;"&gt;But this doesn't mean that this is a dead end. As mentioned in the original blog, you can replace the generated Employee class with the one that you used in the Web Service. With that you shall have the setter method for addresses list and the client invokes the Web Service perfectly.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-5960205477965171145?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/5960205477965171145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=5960205477965171145' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5960205477965171145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5960205477965171145'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/solution-to-issue-with-lists-in.html' title='Solution to the issue with List&apos;s in wsimport generated POJO classes'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-2021233255506347199</id><published>2008-09-15T09:35:00.067+05:30</published><updated>2008-10-05T22:22:20.421+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JAX-WS'/><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><title type='text'>Exposing JAX-WS web service using Spring</title><content type='html'>&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
We start by creating a web project in Eclipse. I used Sysdeo Tomcat plugin.This will create a basic web application structure. Note that this does not create a web.xml file in the WEB-INF folder.&lt;br/&gt;

Add the following jar files to the WEB-INF\lib folder&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;

&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
&lt;pre&gt;
activation.jar
commons-collections.jar
commons-logging.jar
FastInfoset.jar
http.jar
jaxb-api.jar
jaxb-impl.jar
jaxb-xjc.jar
jaxws-api.jar
jaxws-rt.jar
jaxws-spring-1.7.jar
jsr173_api.jar
jsr181-api.jar
jsr250-api.jar
resolver.jar
saaj-api.jar
saaj-impl.jar
sjsxp.jar
spring.jar
stax-ex.jar
streambuffer.jar
xbean-spring-2.8.jar
&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;
&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;

You are required to download the jaxws-spring-1.X.jar from

https://maven2-repository.dev.java.net/source/browse/*checkout*/maven2-
repository/trunk/www/repository/org/jvnet/jax-ws-commons/spring/jaxws-spring/1.8/jaxws-spring-1.8.jar?rev=3913
(This is the latest available version. I used 1.7 version.)
&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;
&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;

If you are using Java SE 6 some of the jars may not be required.
Also if you need to use the latest version of JAX-WS with Java SE 6
you will need to use the endorsed mechanism for loading the JAX-WS libraries.I am using Java SE 5.
&lt;/span&gt;&lt;/span&gt;
&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
Here is the simple web service class:
&lt;/span&gt;&lt;/span&gt;

&lt;pre name="code" class="java"&gt;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;

/**
* Please run the wsgen if you are using Style.DOCUMENT
* Style.RPC used only for demo purpose.
* @author
*
*/
@WebService
@SOAPBinding(style = Style.RPC, use = Use.LITERAL)
public class HelloService {

   @WebMethod
   public String sayHello(@WebParam(name="name")String name) {
       return "Hello " + name;
   }

}
&lt;/pre&gt;
&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Create an applicationContext.xml file in the WEB-INF folder as shown.&lt;/span&gt;&lt;/span&gt;

&lt;pre name="code" class="xml"&gt;
&lt;beans
   xmlns="http://www.springframework.org/schema/beans"
   xsi="http://www.w3.org/2001/XMLSchema-instance"
   ws="http://jax-ws.dev.java.net/spring/core"
   wss="http://jax-ws.dev.java.net/spring/servlet"
   schemalocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://jax-ws.dev.java.net/spring/core
      http://jax-ws.dev.java.net/spring/core.xsd
      http://jax-ws.dev.java.net/spring/servlet
      http://jax-ws.dev.java.net/spring/servlet.xsd"&gt;

   &lt;wss:binding url="/hello" service="#helloService"&gt;&lt;/wss:binding&gt;
   &lt;ws:service id="helloService" bean="#helloImpl"&gt;&lt;/ws:service&gt;

   &lt;bean id=" helloImpl" class="com.mypkg.ws.HelloService"&gt;&lt;/bean&gt;
&lt;/beans&gt;
&lt;/pre&gt;

&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Create a web.xml file in the WEB-INF folder and add the following entries to it.&lt;/span&gt;&lt;/span&gt;

&lt;pre name="code" class="xml"&gt;
&lt;context-param&gt;
    &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
    &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
&lt;/context-param&gt;


&lt;listener&gt;
   &lt;listener-class&gt;
       org.springframework.web.context.ContextLoaderListener
   &lt;/listener-class&gt;
&lt;/listener&gt;


&lt;servlet&gt;
   &lt;servlet-name&gt;jaxws-servlet&lt;/servlet-name&gt;
   &lt;servlet-class&gt;
      com.sun.xml.ws.transport.http.servlet.WSSpringServlet
   &lt;/servlet-class&gt;
&lt;/servlet&gt;

&lt;servlet-mapping&gt;
   &lt;servlet-name&gt;jaxws-servlet&lt;/servlet-name&gt;
   &lt;url-pattern&gt;/hello&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;

&lt;!--... if you deploy more services,
you might need more &lt;servlet-mapping&gt;s --&gt;
&lt;/pre&gt;

&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;This service is configured using the &amp;lt;wss:binding&amp;gt; tag in the applicationContext.xml file as described above.

&amp;lt;wss:binding&amp;gt; definitions define what services are exposed to which part of the URL space.

You can also use the nested syntax for the configuration as shown below:&lt;/span&gt;&lt;/span&gt;

&lt;pre name="code" class="xml"&gt;
&lt;wss:binding url="/hello"&gt; &lt;!—Should match the servlet mapping defined in web.xml file --&gt;
    &lt;wss:service&gt;
        &lt;ws:service bean="#helloImpl"&gt;&lt;/ws:service&gt;
    &lt;/wss:service&gt;
&lt;/wss:binding&gt;
&lt;/pre&gt;

&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Server side Handlers for the service can also be configured using the &amp;lt;ws:service&amp;gt; definition as shown below:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;

&lt;pre name="code" class="xml"&gt;
&lt;ws:service id="helloService" bean="#helloImpl" handlers="#myHandler"&gt;&lt;/ws:service&gt;

&lt;bean id="myHandler" class="qualified name of the handler class"&gt;&lt;/bean&gt;
&lt;/pre&gt;&lt;br/&gt;

&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;If the service uses more than one handler, handlers can be nested.&lt;/span&gt;&lt;/span&gt;

&lt;pre name="code" class="xml"&gt;
&lt;ws:service id="helloService" bean="#helloImpl"&gt;
   &lt;ws:handlers&gt;
       &lt;ref bean="myHandler"&gt;&lt;/ref&gt;
       &lt;ref bean="secondHandler"&gt;&lt;/ref&gt;
   &lt;/ws:handlers&gt;
&lt;/ws:service&gt;
&lt;/pre&gt;

&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Deploy the web project on tomcat (tested on Tomcat 6.0). The service WSDL can be accessed using the following URL

http://&amp;lt;your-ip&amp;gt;:&amp;lt;tomcat-port&amp;gt;/&amp;lt;project-name&amp;gt;/hello?wsdl&lt;br/&gt;
Also I would suggest to have a look at Apache CXF.
&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-2021233255506347199?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/2021233255506347199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=2021233255506347199' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2021233255506347199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2021233255506347199'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/exposing-jax-ws-web-service-using.html' title='Exposing JAX-WS web service using Spring'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-6445112695282004848</id><published>2008-09-11T14:00:00.005+05:30</published><updated>2008-10-05T22:26:58.202+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><title type='text'>Using annotated classes as web method params or return types</title><content type='html'>&lt;span style="font-family: arial;"&gt;Some time back one of my friends was writing a web service in which certain web methods either returned or received Entity classes as parameters. When ever the wsgen command was fired an error as below was generated:&lt;/span&gt;&lt;br/&gt;

&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;C:\eclipse\workspace\TopLinkExample\bin&gt;&lt;span style="font-weight: bold;"&gt;wsgen -cp . service.TopLinkImpl&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;.\org\acme\entity\Order.class: warning: Cannot find annotation method 'name()' i&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;n type 'javax.persistence.Table': class file for javax.persistence.Table not fou&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;nd&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;.\org\acme\entity\Order.class: warning: Cannot find annotation method 'strategy(&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;)' in type 'javax.persistence.GeneratedValue': class file for javax.persistence.&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;GeneratedValue not found&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;Problem encountered during annotation processing;&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;see stacktrace below for more information.&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;java.lang.NullPointerException&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.i&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;sSubtype(WebServiceAP.java:418)&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt; at...&lt;br/&gt;


&lt;span style="color: rgb(0, 0, 0); font-family: arial;font-family:arial;" &gt;After pondering for a while we figured out that the required classes (persistence related jars) were not in the class path.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial;font-family:arial;" &gt; So the following command got our stuff working:&lt;/span&gt;&lt;br/&gt;

&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;C:\eclipse\workspace\TopLinkExample\bin&gt;set CLASSPATH=%CLASSPATH%;C:\eclipse\wor&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;kspace\TopLinkExample\lib\ejb3-persistence.jar;C:\eclipse\workspace\TopLinkExamp&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;le\lib\jboss-ejb3x.jar;C:\eclipse\workspace\TopLinkExample\lib\toplink-essential&lt;/span&gt;
&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;s.jar;.;&lt;/span&gt;

&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;C:\eclipse\workspace\TopLinkExample\bin&gt;&lt;span style="font-weight: bold;"&gt;wsgen -cp %CLASSPATH%;. service.TopLinkI&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-weight: bold;font-family:courier new;" &gt;mpl&lt;/span&gt;&lt;br/&gt;

&lt;span style="font-family:arial;"&gt;Even though this seems to be a very simple problem, during the time we were searching for the solution, we found that most of the people had this problem and didn't know the solution, whereas the &lt;span style="font-weight: bold;"&gt;-cp .&lt;/span&gt; in the &lt;span style="font-weight: bold;"&gt;wsgen&lt;/span&gt; command was going unnoticed.
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-6445112695282004848?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/6445112695282004848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=6445112695282004848' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6445112695282004848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6445112695282004848'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/using-annotated-classes-as-web-method.html' title='Using annotated classes as web method params or return types'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-1676102261234041578</id><published>2008-09-11T13:08:00.009+05:30</published><updated>2008-10-05T22:43:40.259+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><title type='text'>It is not necessary to use wsimport generated POJO Files</title><content type='html'>&lt;span style="font-family:arial;"&gt;When we have a Web Service in which we either pass the POJO object as a parameter or as a return type, by running &lt;/span&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;wsimport&lt;/span&gt;&lt;span style="font-family:arial;"&gt; command in order to generate Web Service Client similiar POJO classes are generated.&lt;/span&gt;&lt;br/&gt;

Suppose you have a Web Service with a Web Method that takes and returns a POJO of Class &lt;span style="font-weight: bold;"&gt;Employee&lt;/span&gt;:-&lt;br/&gt;

&lt;pre name="code" class="java"&gt;
public class Employee {
 private int age;
 private String name;

 public Employee() {
 }

 public Employee(int age, String name) {
  super();
  this.age = age;
  this.name = name;
 }
 
 //write getter setter for properties to comply to Java Bean/POJO standard
}
&lt;/pre&gt;

&lt;span style="font-family:arial;"&gt;and the Web Method is:&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
@WebMethod
 public Employee printEmployee(Employee e) {
  System.out.println(e.getName() + " - " + e.getAge());
  return e;
 }
&lt;/pre&gt;

&lt;span style="color: rgb(0, 0, 0);font-family:arial;" &gt;&lt;span style="font-family:arial;"&gt;On generating the client, an Employee POJO is automatically generated but with some XML stuff and no constructor i.e. default constructor:&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
@XmlAccessorType(XmlAccessType.FIELD)  
 @XmlType(name = "employee", propOrder = {"age", "name"})  
 public class Employee {  
  protected int age;  
  protected String name;  
  // Setters and Getters for the properties are also generated 
 }
&lt;/pre&gt;

&lt;span style="color: rgb(0, 0, 0);font-family:arial;" &gt;There seems to be two things about this generated POJO that irritates me:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol style="font-family: arial;"&gt;&lt;li&gt;The newly generated Employee POJO has a lot of XML stuff that does not do any work in service invocation.&lt;/li&gt;&lt;li&gt;I miss the constructor that takes in values for the POJO i.e. new Employee("name", 23);&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;Solution is simple:- &lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:arial;"&gt;Delete the generated POJO's from the client generated by &lt;/span&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;wsimport &lt;/span&gt;&lt;span style="font-family:arial;"&gt;command and copy the POJO's from the Web Service side to the generated client code. The package name of the POJO need not be the same on the Web Service and the Client side i.e. on the Web Service it can be pack.Employee where as in client it can be client.Employee.&lt;/span&gt;
&lt;span style="font-family:arial;"&gt;It works without any problems.&lt;/span&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-1676102261234041578?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/1676102261234041578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=1676102261234041578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1676102261234041578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1676102261234041578'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/its-not-necessary-to-use-wsimport.html' title='It is not necessary to use wsimport generated POJO Files'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-4457325035750383026</id><published>2008-09-08T18:16:00.003+05:30</published><updated>2008-09-08T18:24:53.538+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='USB network'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Setting network b/w Linux machines using USB cable</title><content type='html'>&lt;span style="font-family:arial;"&gt;To setup the USB network between two linux machines perform the following steps :-

   1) Attach both the Linux machines using a USB cable.
   2) Open the terminal window on each of the machines and type the following command
                         (On first machine)
&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;        ]# ifconfig usb0 10.100.10.101 netmask 255.255.255.0&lt;/span&gt;
&lt;span style="font-family:arial;"&gt;
&lt;/span&gt;&lt;span style="font-family:arial;"&gt;                          (On second machine)
&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;        ]# ifconfig usb0 10.100.10.102 netmask 255.255.255.0&lt;/span&gt;
&lt;span style="font-family:arial;"&gt;
        Once done, try to ping the other machine using the assigned ip i.e. 10.100.10.101. This technique has been tested with two machines with Fedora 9 on one machine and busybox on other. It should be able to work on other combinations of linux too.
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-4457325035750383026?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/4457325035750383026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=4457325035750383026' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4457325035750383026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4457325035750383026'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/setting-network-bw-linux-machines-using.html' title='Setting network b/w Linux machines using USB cable'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-6743716345244253270</id><published>2008-09-07T10:24:00.005+05:30</published><updated>2008-10-12T12:58:43.854+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Java Socket  client issue on Linux</title><content type='html'>&lt;span style="font-family:arial;"&gt;In the case that the socket client is on the windows and server on linux &amp;amp; the server goes down, the client on windows identified immediately and gives an exception. For a scenario vice versa i.e. socket client on linux and server on any other machine (currently tested on windows), the client waits for too long for a timeout. To deal this situation instead of opening a socket client like:&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
 Socket socket = new Socket(“10.1.25.186”, 8080);
&lt;/pre&gt;

You should use:

&lt;pre name="code" class="java"&gt;
InetAddress inetAddr = InetAddress.getByName(“navnit.tempo.local”);  
SocketAddress socAddr = new InetSocketAddress(inetAddr, 8080);  
Socket socket = new Socket();  socket.connect(socAddr, 5000); // 5000 is the timeout in millis.
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-6743716345244253270?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/6743716345244253270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=6743716345244253270' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6743716345244253270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6743716345244253270'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/java-socket-client-issue-on-linux.html' title='Java Socket  client issue on Linux'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-323479171639581062</id><published>2008-09-07T10:21:00.008+05:30</published><updated>2008-10-05T22:53:18.377+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Swings'/><category scheme='http://www.blogger.com/atom/ns#' term='PDFBox'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache POI'/><title type='text'>Extracting text from documents using Java</title><content type='html'>&lt;span style="font-family:arial;"&gt;Extracting the text from the &lt;span style="font-weight: bold;"&gt;HTM/HTML&lt;/span&gt; document i.e. pulling all the text except the HTML tags is done as:&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
URL url = new URL("http://localhost:8080/index.jsp");  
EditorKit kit = new HTMLEditorKit();  
Document document = kit.createDefaultDocument();  
kit.read(url.openStream(), document, 0);  
System.out.println(document.getText(0, document.getLength()));
&lt;/pre&gt;

&lt;span style="font-family:arial;"&gt;For &lt;span style="font-weight: bold;"&gt;PDF &lt;/span&gt;text extraction use pdfbox from www.pdfbox.org&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
URL url = new URL("http://localhost:8080/Document.pdf");  
PDDocument document = PDDocument.load(url.openStream());  
PDFTextStripper pdfStripper = new PDFTextStripper();  pdfStripper.setSortByPosition(false);  
pdfStripper.setStartPage(1); //from which page to start  
pdfStripper.setEndPage(3);  //on which page to end
System.out.println(pdfStripper.getText(document));  
document.close();
&lt;/pre&gt;

&lt;span style="font-family:arial;"&gt;For &lt;span style="font-weight: bold;"&gt;MS Office Suite documents&lt;/span&gt; text extraction use Apache POI ( http://poi.apache.org/ )
Sample code for extracting text from a &lt;span style="font-weight: bold;"&gt;.doc&lt;/span&gt; file is as follows:-

&lt;pre name="code" class="java"&gt;
POIFSFileSystem doc = new POIFSFileSystem(new FileInputStream("c:/Resume.doc"));
WordExtractor extractor = new WordExtractor( doc );
System.out.println(extractor.getText());
&lt;/pre&gt;

&lt;/span&gt;&lt;span style="font-family:arial;"&gt;A good article on the same can be found at  &lt;/span&gt;&lt;a href="http://www.informit.com/guides/content.aspx?g=java&amp;amp;seqNum=354"&gt;&lt;span style="font-family:arial;"&gt;http://www.informit.com/guides/content.aspx?g=java&amp;amp;seqNum=354&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-323479171639581062?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/323479171639581062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=323479171639581062' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/323479171639581062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/323479171639581062'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/extracting-text-from-htmlpdf-documents.html' title='Extracting text from documents using Java'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-5565349810274796186</id><published>2008-09-07T10:14:00.004+05:30</published><updated>2008-10-05T23:03:49.077+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Precision subtraction of floats</title><content type='html'>&lt;span style="font-family:arial;"&gt;The normal subtraction of the double values in java result in a very long answer e.g. System.out.println(0.123 - 0.100); will result in 0.022999999999999993 as opposed to the expected 0.023. The Math.round function won't work here as it &lt;/span&gt;&lt;span style="font-family: arial;"&gt;Returns the closest &lt;/span&gt;&lt;code style="font-family: arial;"&gt;long&lt;/code&gt;&lt;span style="font-family: arial;"&gt;/int to the argument&lt;/span&gt;.&lt;span style="font-family:arial;"&gt;This precision problem can be fixed using the BigDecimal class.

&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
BigDecimal first = new BigDecimal(0.123);
BigDecimal second = new BigDecimal(0.100);
System.out.println(first.subtract(second, new MathContext(2)));
&lt;/pre&gt;

The above program rounds off the answer to a precision of 2. i.e. the result will be 0.023.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-5565349810274796186?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/5565349810274796186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=5565349810274796186' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5565349810274796186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5565349810274796186'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/precision-subtraction-of-floats.html' title='Precision subtraction of floats'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-3783059090252808602</id><published>2008-09-07T10:05:00.005+05:30</published><updated>2008-10-05T23:04:39.166+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Socket connection via proxy</title><content type='html'>&lt;span style="font-family:arial;"&gt;To make the hits to internet programmatically via a proxy, you need to launch the program with the following JVM arguments. The program &lt;span style="font-weight: bold;"&gt;ConnectionTest&lt;/span&gt; contains the code to connect to some server on the internet and if in order to do so it needs to go via a proxy then run it as follows.&lt;br/&gt;

&lt;span style="color: rgb(51, 102, 255);font-family:courier new;" &gt; &gt;java -Dhttp.proxyHost=proxy2.temp.org -Dhttp.proxyPort=8888 pack.ConnectionTest&lt;/span&gt;
&lt;br/&gt;

Running the above code without the JVM arguments, it won't connect.
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-3783059090252808602?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/3783059090252808602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=3783059090252808602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3783059090252808602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3783059090252808602'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/socket-connection-via-proxy.html' title='Socket connection via proxy'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-3437447856364974065</id><published>2008-09-07T09:37:00.007+05:30</published><updated>2008-10-05T23:01:50.126+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Generating same hashcode for similiar objects</title><content type='html'>&lt;p class="MsoBodyText" style="margin-left: 18pt;"&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style="font-family:arial;"&gt;Always override &lt;/span&gt;&lt;b style="font-family: arial;"&gt;hashCode&lt;/b&gt;&lt;span style="font-family:arial;"&gt; method if you are overriding the &lt;/span&gt;&lt;b style="font-family: arial;"&gt;equals&lt;/b&gt;&lt;span style="font-family:arial;"&gt; method of a java class. A POJO containing the same values in the properties can generate different hashCodes by default. If you need a way to generate the same hashCodes for POJO’s with same properties, instead of writing your own logic like adding properties or any other method, consider using apache’s commons-lang class &lt;/span&gt;&lt;b style="font-family: arial;"&gt;HashCodeBuilder&lt;/b&gt;&lt;span style="font-family:arial;"&gt;. This is specially worth considering if the objects are being added to data structures that use hashing mechanism for storing objects e.g. HashSet, HashMap, etc.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;pre name="code" class="java"&gt;
@Override  public int hashCode() {
    return HashCodeBuilder.reflectionHashCode(this);
}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-3437447856364974065?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/3437447856364974065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=3437447856364974065' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3437447856364974065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3437447856364974065'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/09/generating-same-hashcode-for-similiar.html' title='Generating same hashcode for similiar objects'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-8588346974840583236</id><published>2008-07-09T17:40:00.005+05:30</published><updated>2008-07-09T18:29:18.694+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Wicket'/><title type='text'>Reasons I like Wicket</title><content type='html'>&lt;p&gt;&lt;span style="font-family:arial;"&gt;I have been using Struts for a long time now. Also I have used other frameworks like JSF and WebWork. But Wicket seems to a breeze of fresh air.
Lots of information is already available on Wicket and how it compares with other frameworks in general, so here I will try to focus on what I experienced.

1. Wicket uses plain Java with plain HTML. Goodbye to XML configuration files for building web applications (web.xml still remainsJ). You just need a good IDE. NetBeans and Eclipse already have some plug-in support to facilitate RAD.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
&lt;span style="font-family:arial;"&gt;2. Creating a component in Wicket is really easy and requires writing an HTML file and a plain Java class. Being a component oriented framework reusability of components can be achieved easily. In other frameworks reuse of components at the UI layer has been a big hassle. In wicket you make subclasses of existing components (e.g. Panel) and provide your own version of it leading to an OO design.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:arial;"&gt;3. Wicket imposes minimal requirements on the mark-up templates. It does not introduce any special syntax to HTML. It extends HTML in a XHTML standards way via Wicket namespace. Thus the nice side-effect of using Wicket is a XHTML compliant web page. This promotes the almost as is use of templates from the UI designers. Changes if required in later stages can be done by UI designers easily in their favourite IDE. I’m sure that this is a big deal for most development teams. Wicket renders clean HTML code which can later be used for making adjustments to the UI.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:arial;"&gt;4. Wicket provides a large set of components, not to forget their Ajax counterparts. Developing Ajax enabled applications has never been easier. If advanced functionality is required on top of the existing one existing components can be extended to build new custom components. Libraries for integration with well know JavaScript frameworks like script.aculo.us, Prototype and DOJO also exist. All of the above in few minutes with a few lines of Java code. The custom components and ideas are shared and thus the component palette is ever increasing. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:arial;"&gt;5. Out of the box Ajax support is the most killer feature of Wicket. I tried playing around with DOJO and also DWR in some of my Struts applications. But the AJAX support in Wicket is refined with virtually no JavaScript to write. The very useful Ajax debug popup that automagically appears on your web pages in development mode. So using Ajax is as simple as telling Wicket that instead of showing or hiding a component using a full-page refresh do that using Ajax partial-updates to a page. And it just works on any kind of component.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:arial;"&gt;6. Wicket has some cool features I explored out of necessity. Unlike other frameworks like Struts where you have to choose say commons-fileupload and manually include the JAR, I was pleasantly surprised to see that Wicket supports multipart forms / file uploading out of the box. Wicket also provides a download file link component specifically for this purpose.
You can get those bookmarkable “friendly URLs” with the use of URL mounting feature provided in Wicket. Wicket provides a good form binding support for POJO’s. Component validation support in Wicket is good with Ajax validation easy to implement.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:arial;"&gt;7. Very active community. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:arial;"&gt;8. Fairy good documentation with working sample code.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-family:arial;"&gt;Sure there is some learning curve but I think it’s worth the effort. Wicket is an excellent framework and seems that it has been developed keeping in mind the problems a common development team faces. Enjoy J
&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-8588346974840583236?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/8588346974840583236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=8588346974840583236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8588346974840583236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/8588346974840583236'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/07/reasons-i-like-wicket.html' title='Reasons I like Wicket'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-2287223498804495907</id><published>2008-07-04T12:03:00.011+05:30</published><updated>2008-10-06T20:25:52.441+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Design patterns'/><title type='text'>Singleton In Different Way</title><content type='html'>&lt;span style="font-family:courier new;"&gt;&lt;pre name="code" class="java"&gt;public class Singleton {
    private Singleton() {
    }
    private static class SingletonHolder {
        private static final Singleton singleton = new Singleton();
    }
    public static Singleton getInstance() {
        return SingletonHolder.singleton;
    }
}&lt;/pre&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Whenever a class is first loaded by JVM it's static variable and static initialiser bloacks are executed. In the above example when the class Singleton is loaded by the JVM, the class goes through initialization. Since the class does not have any static variables and initializer blocks, the initialization completes simply. The JVM will not load the static class definition SingletonHolder within Singleton class until you touch something in the SingletonHolder class. Hence the static variable is not initialized until the JVM determines that SingletonHolder must be loaded or executed. The static class SingletonHolder is only executed when the static method getInstance is invoked on the class Singleton.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family:arial;"&gt;The first time when this class will be loaded by the JVM the static variable singleton will be initialized by executing the (private) constructor for the outer class Singleton. As per the Java Language Specification (JLS) the class initialization phase is guaranteed to be serial, i.e., non-concurrent, no further synchronization is required in the static getInstance method during loading and initialization. As the initialization phase initializes the static variable singleton in synchronized manner, all subsequent concurrent invocations of the getInstance will return the same correctly initialized singleton without incurring any additional synchronization overhead.&lt;/span&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-2287223498804495907?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/2287223498804495907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=2287223498804495907' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2287223498804495907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2287223498804495907'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/07/singleton-in-different-way.html' title='Singleton In Different Way'/><author><name>Gaurav Saini</name><uri>http://www.blogger.com/profile/10070976169850999039</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-6787802359410960045</id><published>2008-06-30T14:19:00.011+05:30</published><updated>2008-06-30T15:06:06.987+05:30</updated><title type='text'>Few Tips On Serialization</title><content type='html'>&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Static fields are like the Transient fields and they are not serialized with the object. The reason is that they are associated with the class rather then object's state.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;If we have a sub class which extends a super class and implements Serializable interface and super class doesn't implement Serializable interface then:&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;While serializing the sub class object, only its state excluding the super class visible variables will be serialized.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;While de-serializing the sub class state will restored from the serialized data. The super class state will be initialized by invoking the no-arg constructor of super class.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;The no-arg constructor should be visible to the sub class otherwise an exception will be thrown at runtime.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ol start="3"&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;If the super class also implements Serializable interface then the state of the subclass object including the super class visible variables will be serialized. And while de-serializing the sub class and super class state will be restored from the serialized data only instead of no-arg constructor for super class.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;If there is an arg constructor in the super class and there is no default constructor then the subclass constructor should specify the call to the specific super (arg...) constructor. Otherwise there will be a compile-time error.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-6787802359410960045?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/6787802359410960045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=6787802359410960045' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6787802359410960045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6787802359410960045'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/06/few-tips-on-serialization.html' title='Few Tips On Serialization'/><author><name>Gaurav Saini</name><uri>http://www.blogger.com/profile/10070976169850999039</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-6716184705406597998</id><published>2008-04-26T15:50:00.015+05:30</published><updated>2008-10-06T20:47:02.210+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='JAX-WS'/><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><title type='text'>Basic Security on JAXWS 2.0</title><content type='html'>&lt;span style="font-family:arial;"&gt;You can apply basic realm security to your webservice. In the web.xml, you have to paste certain tags given below. Don’t apply the Basic Realm for GET. The client code makes a GET request to get the port. Apply Basic Realm for POST. The client code will put the authentication values in the headers as:&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
 Calculator calculator = (new CalculatorService()).getCalculatorPort(); 
 BindingProvider provider = (BindingProvider) calculator; 
 provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "navnit"); 
 provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "leo");
&lt;/pre&gt;

&lt;span style="font-family:arial;"&gt;The web.xml section is as below:&lt;/span&gt;

&lt;pre name="code" class="xml"&gt;
&lt;security-constraint&gt;
 &lt;web-resource-collection&gt;
  &lt;web-resource-name&gt;Protected Site&lt;/web-resource-name&gt;
  &lt;!-- protects the whole site --&gt;
  &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;!-- list of methods that will be protected --&gt;
  &lt;http-method&gt;DELETE&lt;/http-method&gt;
  &lt;http-method&gt;POST&lt;/http-method&gt;
  &lt;http-method&gt;PUT&lt;/http-method&gt;
 &lt;/web-resource-collection&gt;
 
 &lt;auth-constraint&gt;
  &lt;!-- role name with access --&gt;
  &lt;role-name&gt;CalculatorUser&lt;/role-name&gt;
 &lt;/auth-constraint&gt;
&lt;/security-constraint&gt;

&lt;!-- BASIC authentication --&gt;
&lt;login-config&gt;
 &lt;auth-method&gt;BASIC&lt;/auth-method&gt;
 &lt;realm-name&gt;Example Basic Authentication&lt;/realm-name&gt;
&lt;/login-config&gt;

&lt;!-- Define security roles --&gt;
&lt;security-role&gt;
 &lt;description&gt;Test role&lt;/description&gt;
 &lt;role-name&gt;CalculatorUser&lt;/role-name&gt;
&lt;/security-role&gt;
&lt;/pre&gt;

&lt;span lang="EN-US"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="COLOR: rgb(0,0,0)"&gt;You also need to create a role in the &lt;b style="FONT-FAMILY: verdana"&gt;tomcat-users.xml &lt;/b&gt;and a user/password.&lt;/span&gt;
&lt;/span&gt;

&lt;pre name="code" class="xml"&gt;
&lt;role rolename="CalculatorUser"&gt;&lt;/role&gt;
&lt;user username="navnit" password="leo" roles="CalculatorUser"&gt;&lt;/user&gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-6716184705406597998?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/6716184705406597998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=6716184705406597998' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6716184705406597998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6716184705406597998'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/04/basic-security-on-jaxws-20.html' title='Basic Security on JAXWS 2.0'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-2719160074777372848</id><published>2008-04-26T15:30:00.006+05:30</published><updated>2008-10-06T20:49:49.295+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Swings'/><title type='text'>Change the foreground and background selection color of a JMenuItem.</title><content type='html'>&lt;pre name="code" class="java"&gt;
JCheckBoxMenuItem standard = new JCheckBoxMenuItem(); 
 standard.setUI(new chkboxMenuItem(menuSelFore,menuSelBack)); 

 class chkboxMenuItem extends BasicCheckBoxMenuItemUI { 
       public chkboxMenuItem(Color selFore,Color selBack) { 
        selectionForeground = selFore; 
           selectionBackground = selBack; 
       } 
 }
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-2719160074777372848?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/2719160074777372848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=2719160074777372848' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2719160074777372848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/2719160074777372848'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/04/change-foreground-and-background.html' title='Change the foreground and background selection color of a JMenuItem.'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-4111353054834485735</id><published>2008-04-26T15:23:00.007+05:30</published><updated>2008-10-06T20:52:04.592+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Swings'/><title type='text'>Changing the swing submenu expanding orientation</title><content type='html'>&lt;span style=";font-family:arial;font-size:100%;"  &gt;To set the orientation of the menu to open the submenus in the left direction ( &lt;-- ) instead of default right direction ( --&gt; ) use :&lt;/span&gt;

&lt;pre name="code" class="java"&gt;
JMenu prefMenu = new JMenu();
prefMenu.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-4111353054834485735?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/4111353054834485735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=4111353054834485735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4111353054834485735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4111353054834485735'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/04/changing-swing-submenu-expanding.html' title='Changing the swing submenu expanding orientation'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-3563834562441210436</id><published>2008-04-22T12:46:00.000+05:30</published><updated>2008-04-22T19:07:45.167+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><title type='text'>Using link files to manage an Eclipse install</title><content type='html'>&lt;a name="link-ref"&gt;&lt;/a&gt;You might want to consider a more managed environment     instead of just dumping all the cool plug-ins (with     referencing features I hope) into your Eclipse directory     tree. If you need to update Eclipse, you really don't     want to either unzip a new Eclipse on top or hunt through the list of features and plug-ins to find     those you want to move forward.                 &lt;p&gt;     Here is an approach for organizing your Eclipse or     Eclipse-based product and builds on the capabilities of     link files:    &lt;/p&gt;             &lt;ul&gt;&lt;li&gt;      Keep Eclipse or an Eclipse-based product clean. That      is, don't add any of your features or plug-ins to the       eclipse\features      and eclipse\plugins directories.     &lt;/li&gt;&lt;li&gt;      Create both an       eclipse\links and      eclipse\links-out            directory in the existing Eclipse directory. If you      are using an Eclipse-based product, the       eclipse\links       directory may already exist. The directory is not      special, just a convenient place to hide link files      when not in use.     &lt;/li&gt;&lt;li&gt;      Create a one or more &lt;i&gt;add-ons&lt;/i&gt; directories for the      features and plug-ins you want to add to your      configuration. In these directories, create an      eclipse\features       and eclipse\plugins          directory structure.     &lt;/li&gt;&lt;li&gt;      For each &lt;i&gt;add-ons&lt;/i&gt; directory, create a link file in      the  eclipse\links-out        directory. Copy those you      currently want as part of your active configuration      to the eclipse\links directory.     &lt;/li&gt;&lt;/ul&gt;             &lt;p&gt;     For example, assume you unzipped Eclipse into a     directory named      Eclipse-2.1.1, then created an     add-ons directory named      CoolTools, also in the     Eclipse-2.1.1directory. In the      CoolTools directory, you could     have multiple directories, one for each tool or family     of tools you want to add to Eclipse. Your structure     might look something like&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_mTPVfrrUQGA/SA2RhLR_iAI/AAAAAAAAABg/z5nvPtarehQ/s1600-h/linkdir.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_mTPVfrrUQGA/SA2RhLR_iAI/AAAAAAAAABg/z5nvPtarehQ/s320/linkdir.jpg" alt="" id="BLOGGER_PHOTO_ID_5191965944578017282" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;     The EditorList.link      file would contain either of these     entries (not both):&lt;/p&gt;             &lt;p&gt;                 &lt;code&gt; path=D:/Eclipse-2.1.1/CoolTools/EditorList
path=D:\\Eclipse-2.1.1\\CoolTools\\EditorList &lt;/code&gt;             &lt;/p&gt;             &lt;p&gt;     The slash is either one (&lt;code&gt;/&lt;/code&gt;) or two (&lt;code&gt;\\&lt;/code&gt;) depending on direction.    &lt;/p&gt;             &lt;p&gt;     Be sure that the entry does not end with a space as this     causes it to be ignored by Eclipse —     it took me several hours to determine this the first     time I used link files.    &lt;/p&gt;             &lt;p&gt;     If you start Eclipse with a new workspace, all of     Eclipse and the features and plug-ins found via link     files will be available.     &lt;/p&gt;Please refer to the link below for further details :

&lt;a href="http://www.ibm.com/developerworks/opensource/library/os-ecfeat/#link-ref"&gt;www.ibm.com/developerworks/opensource/library/os-ecfeat/#link-ref&lt;/a&gt;
&lt;p&gt;
&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-3563834562441210436?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/3563834562441210436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=3563834562441210436' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3563834562441210436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3563834562441210436'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/04/using-link-files-to-manage-eclipse.html' title='Using link files to manage an Eclipse install'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_mTPVfrrUQGA/SA2RhLR_iAI/AAAAAAAAABg/z5nvPtarehQ/s72-c/linkdir.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-3783579421252107774</id><published>2008-01-16T09:54:00.001+05:30</published><updated>2008-04-26T16:20:09.027+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><title type='text'>Using JAXWS 2.1 on Java 6.0</title><content type='html'>To use JAX-WS 2.1 on Java 6.0 and Tomcat 6.0,  place all the libraries in the JAXWS 2.1 in “&amp;lt;&lt;tomcat-home&gt;TOMCAT_HOME&lt;/tomcat-home&gt;&amp;gt;&lt;tomcat-home&gt;\endorsed” directory.

To run the client, you have to have the JAX-WS 2.1 library (jaxb-api.jar) in your bootstrap. For this put the jaxb-api.jar from the JAX-WS 2.1 distribution in the "&amp;lt;&lt;java_home&gt;JAVA_HOME&lt;/java_home&gt;&lt;/tomcat-home&gt;&amp;gt;&lt;tomcat-home&gt;&lt;java_home&gt;/jre/lib/"endorsed.&lt;/java_home&gt;&lt;/tomcat-home&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-3783579421252107774?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/3783579421252107774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=3783579421252107774' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3783579421252107774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3783579421252107774'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/01/using-jaxws-21-on-java-60.html' title='Using JAXWS 2.1 on Java 6.0'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-4000475556990539757</id><published>2008-01-11T11:41:00.002+05:30</published><updated>2008-10-06T20:54:10.417+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tiles'/><category scheme='http://www.blogger.com/atom/ns#' term='SiteMesh'/><title type='text'>Why SiteMesh instead of Tiles?</title><content type='html'>&lt;ol style="font-family: arial;font-family:verdana;" &gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;SiteMesh is much easier to configure and use (less typing and easier to understand)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Using Tiles, you need to have your forwards go to a "tiles page" versus the direct JSP. SiteMesh takes the approach that your page (your JSP) doesn't even know or care that it's being decorated.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Using Tiles, each individual page you want to go to has to be associated with a layout - Major pain! Every time you create a new JSP that you want to forward to, you have to create another tiles definition and associate it with a layout and forward to the Tile page (versus the JSP). With SiteMesh you can simply set up a URL pattern and all your pages are decorated with the layout you choose.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;span style=";font-family:arial;font-size:100%;"  &gt;
&lt;span style="font-family: arial;"&gt;On the other hand there is downside of using SiteMesh. SiteMesh stores the entire content of your HTML body into memory before it decorates it. If you have some very large pages, such as might happen in a reporting application where you don't have pagination implemented and end up with one large page of rows, you could end up with severe memory problems.&lt;/span&gt;&lt;br/&gt;

&lt;span style="font-family: arial;"&gt;You can read this &lt;/span&gt;&lt;a style="font-family: arial;" href="http://today.java.net/pub/a/today/2004/03/11/sitemesh.html"&gt;http://today.java.net/pub/a/today/2004/03/11/sitemesh.html&lt;/a&gt;&lt;span style="font-family: arial;"&gt; post by Will Iverson about how to use SiteMesh.&lt;/span&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-4000475556990539757?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/4000475556990539757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=4000475556990539757' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4000475556990539757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/4000475556990539757'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2008/01/why-sitemesh-instead-of-tiles.html' title='Why SiteMesh instead of Tiles?'/><author><name>Shirish Pandharikar</name><uri>http://www.blogger.com/profile/08711504385122792110</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_mTPVfrrUQGA/SM4OT_PC8jI/AAAAAAAAAEg/pPmGYuiRXGE/S220/Shirish.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-7378610595823317910</id><published>2007-12-13T10:09:00.000+05:30</published><updated>2007-12-13T10:11:23.776+05:30</updated><title type='text'>Accessing the properties file outside the Jar file.</title><content type='html'>To access the .properties file when the file is outside the jar you just need to enter the classpath value in the manifest.mf file:

&lt;span style="font-family: courier new; color: rgb(51, 102, 255);"&gt;Manifest-Version: 1.0&lt;/span&gt;
&lt;span style="font-family: courier new; color: rgb(51, 102, 255);"&gt;Main-Class: pack.HelloWorld&lt;/span&gt;
&lt;span style="font-family: courier new; color: rgb(51, 102, 255);"&gt;Class-Path: .&lt;/span&gt;

Multiple classpath requirements will be space separated and not ; separated i.e. You have to mention all the jar names.

&lt;span style="font-family: courier new; color: rgb(51, 102, 255);"&gt;Class-Path: servlet.jar infobus.jar acme/beans.jar acme/mysql.jar&lt;/span&gt;

For properties in a folder named config, you can put in class path as

&lt;span style="font-family: courier new; color: rgb(51, 102, 255);"&gt;Class-Path: servlet.jar infobus.jar config/.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-7378610595823317910?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/7378610595823317910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=7378610595823317910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/7378610595823317910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/7378610595823317910'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2007/12/accessing-properties-file-outside-jar.html' title='Accessing the properties file outside the Jar file.'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-3472146399213736935</id><published>2007-12-13T10:04:00.002+05:30</published><updated>2008-10-06T20:56:45.034+05:30</updated><title type='text'>Programmatically compiling the Java program using Compiler API</title><content type='html'>Sample code to programmatically compile a Java program.

&lt;pre name="code" class="java"&gt;
public class CompilerExample {
    public static void main(String[] args) {
        String fileToCompile = "c:" + java.io.File.separator
                + "HelloWorld.java";
        JavaCompiler compiler =      ToolProvider.getSystemJavaCompiler();
        int compilationResult = compiler.run(null, null, null, fileToCompile);
        if (compilationResult == 0) {
            System.out.println("Compilation is successful");
        } else {
            System.out.println("Compilation Failed");
        }
    }
}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-3472146399213736935?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/3472146399213736935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=3472146399213736935' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3472146399213736935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3472146399213736935'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2007/12/programmatically-compiling-java-program.html' title='Programmatically compiling the Java program using Compiler API'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-6224634649168444897</id><published>2007-12-13T09:59:00.001+05:30</published><updated>2008-10-06T20:58:52.382+05:30</updated><title type='text'>Creating an image file (jpg) using java</title><content type='html'>You can create the custom images using java with the following snippet. This can be productively used in sign up forms to make the user enter the text in the image manually (to avoid automated script).

&lt;pre name="code" class="java"&gt;
BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); 
 Graphics g = image.getGraphics(); 
 g.drawString("Hello World!!!", 10, 20); 
 try {  
   ImageIO.write(image, "jpg", new File("c:/CustomImage.jpg")); 
 } catch (IOException e) {  
  e.printStackTrace(); 
 }
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-6224634649168444897?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/6224634649168444897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=6224634649168444897' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6224634649168444897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/6224634649168444897'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2007/12/creating-image-file-jpg-using-java.html' title='Creating an image file (jpg) using java'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-5764240846417510765</id><published>2007-12-13T09:23:00.002+05:30</published><updated>2009-08-09T01:11:58.979+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Running multiple instances of tomcat from single installation</title><content type='html'>&lt;span style="font-family: arial;font-size:85%;" &gt;To install the tomcat once and use it to launch multiple instances follow the steps:
&lt;/span&gt;&lt;ol style="font-family: arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Create a folder e.g. Alpha in the TOMCAT_HOME.
&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Copy the conf, logs, temp, webapps and work folders to the Alpha folder.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Modify the conf\server.xml  to change the port i.e. make them different from the ports of the main tomcat e.g. change its Connector port to 8081 and so on.
&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Copy startup.bat from TOMCAT_HOME\bin and paste to TOMCAT_HOME\Alpha\.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Modify the startup.bat by adding the highlighted part to the end of the file.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-family: arial;font-size:85%;" &gt;
&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255); font-family: arial;font-family:courier new;font-size:85%;"  &gt;:doneSetArgs&lt;/span&gt;&lt;span style="font-family: arial;font-size:85%;" &gt;
&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255); font-family: arial;font-family:courier new;font-size:85%;"  &gt;SET CATALINA_BASE=%CATALINA_HOME%\Alpha&lt;/span&gt;&lt;span style="font-family: arial;font-size:85%;" &gt;
&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255); font-family: arial;font-family:courier new;font-size:85%;"  &gt;SET CATALINA_TMPDIR = %CATALINA_HOME%\Alpha\temp&lt;/span&gt;&lt;span style="font-family: arial;font-size:85%;" &gt;
&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255); font-family: arial;font-family:courier new;font-size:85%;"  &gt;call "%EXECUTABLE%" start %CMD_LINE_ARGS%&lt;/span&gt;&lt;span style="font-family: arial;font-size:85%;" &gt;
&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255); font-family: arial;font-family:courier new;font-size:85%;"  &gt;:end&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-5764240846417510765?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/5764240846417510765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=5764240846417510765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5764240846417510765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/5764240846417510765'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2007/12/running-multiple-instances-of-tomcat.html' title='Running multiple instances of tomcat from single installation'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-414042383861415808</id><published>2007-12-13T09:14:00.000+05:30</published><updated>2007-12-13T12:02:15.876+05:30</updated><title type='text'>Making an Executable Jar file</title><content type='html'>Steps to make a jar file executable jar file (i.e open on double click):
Tips to develop an executable jar for a simple Hello.java

1&gt;Create a text file named Hello.mf and edit it with

&lt;span style="color: rgb(51, 102, 255);"&gt;        Manifest-Version: 1.0 &lt;/span&gt;
&lt;span style="color: rgb(51, 102, 255);"&gt;        Main-Class: Hello &lt;/span&gt;

&lt;span style="color: rgb(204, 0, 0);"&gt;    *It is important to end the above file with a blank line i.e after the Main-Class line two enters   key presses.&lt;/span&gt;
2&gt;Then create the archive by typing

&lt;span style="color: rgb(51, 102, 255);"&gt;        jar cvmf Hello.mf Hello.jar Hello.class Hello.java &lt;/span&gt;
                                       or
&lt;span style="color: rgb(51, 102, 255);"&gt;        jar cmf Hello.mf Hello.jar * &lt;/span&gt;

3&gt;Run it by typing the command below or simply double clicking the Jar file (For Swing/AWT based applications)

&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;        java -jar Hello.jar&lt;/span&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-414042383861415808?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/414042383861415808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=414042383861415808' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/414042383861415808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/414042383861415808'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2007/12/steps-to-make-jar-file-executable-jar.html' title='Making an Executable Jar file'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-3511783759641680729</id><published>2007-12-13T09:09:00.001+05:30</published><updated>2008-10-06T21:03:33.054+05:30</updated><title type='text'>Signing a Jar</title><content type='html'>The steps to sign a jar are as follows:&lt;br/&gt;&lt;br/&gt;

&lt;span style="color: rgb(51, 102, 255);font-family:courier new;font-size:100%;"  &gt;#javac *.java &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;/span&gt;&lt;br/&gt;
&lt;span style="color: rgb(51, 102, 255);font-family:courier new;font-size:100%;"  &gt;#jar -cvf cupidIM.jar *.* &lt;/span&gt;&lt;br/&gt;
&lt;span style="font-size:100%;"&gt;
&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-family:courier new;font-size:100%;"  &gt;#keytool -genkey -keyalg RSA -keystore test_store -alias rsatest &lt;/span&gt;&lt;br/&gt;
&lt;span style="font-size:100%;"&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-family:courier new;font-size:100%;"  &gt;#keytool -export -alias rsatest -file rsatest.cer -keystore test_store &lt;/span&gt;&lt;br/&gt;
&lt;span style="font-size:100%;"&gt;
&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-family:courier new;font-size:100%;"  &gt;#keytool -import -alias rsatest -file rsatest.cer -keystore cacerts &lt;/span&gt;&lt;br/&gt;&lt;span style="font-size:100%;"&gt;

&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-size:100%;" &gt;&lt;span style="font-family:courier new;"&gt;#jarsigner -keystore test_store cupidIM.jar rsatest&lt;/span&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-3511783759641680729?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/3511783759641680729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=3511783759641680729' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3511783759641680729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/3511783759641680729'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2007/12/signing-jar.html' title='Signing a Jar'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2302252496976792766.post-1550053114377033291</id><published>2007-04-20T17:12:00.002+05:30</published><updated>2008-10-06T21:08:46.619+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Swings'/><title type='text'>Making a JTree transparent</title><content type='html'>&lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:maroon;"   &gt;&lt;span style="font-family: arial;font-size:100%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;To make a JTree completely transparent (i.e even after the tree.setOpaque(false) leaves the leaf nodes with white part.. The below code removes even that and makes it totally transparent).&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre name="code" class="java"&gt;
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() {

    public Color getBackgroundNonSelectionColor() {
        return(null);
    }

    public Color getBackground() {
        return(null);
    }
};
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2302252496976792766-1550053114377033291?l=jgeeks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jgeeks.blogspot.com/feeds/1550053114377033291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2302252496976792766&amp;postID=1550053114377033291' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1550053114377033291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2302252496976792766/posts/default/1550053114377033291'/><link rel='alternate' type='text/html' href='http://jgeeks.blogspot.com/2007/04/making-jtree-transparent.html' title='Making a JTree transparent'/><author><name>Navnit Singh Biring</name><uri>http://www.blogger.com/profile/05375041876981046471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp1.blogger.com/_ZFusQvoJd6c/R2CzBS6qk5I/AAAAAAAAAAs/y8eg8gv_NBY/S220/suli%26me.jpg'/></author><thr:total>2</thr:total></entry></feed>
