<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>lekkimworld.comJava</title>
    <link>http://lekkimworld.com/categories/java/</link>
    <description>A blog by IBM Champion Mikkel Flindt Heisterberg about IBM Notes/Domino, Websphere, IBM Connections, mobile, web, JavaScript, Java and other appdev topics...</description>
    <language>en</language>
    <copyright>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</copyright>
    <pubDate>Wed, 08 May 2013 13:44:17 GMT</pubDate>
    <dc:creator>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</dc:creator>
    <dc:date>2013-05-08T13:44:17Z</dc:date>
    <dc:language>en</dc:language>
    <dc:rights>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</dc:rights>
    <image>
      <title>lekkimworld.comJava</title>
      <url>http://lekkimworld.com/categories/java/</url>
    </image>
    <item>
      <title>Using the IBM Connections API from other languages using custom certificates</title>
      <link>http://lekkimworld.com/2012/06/04/using_the_ibm_connections_api_from_other_languages_using_custom_certificates.html</link>
      <content:encoded>&lt;p&gt;
I was reading up on some stuff in the IBM Connections REST API during the weekend and came across a post titled &lt;a href="http://www-10.lotus.com/ldd/lcwiki.nsf/dx/9.2_Using_IBM_Connections_API_in_different_programming_languages"&gt;Using IBM Connections API in different programming languages&lt;/a&gt; on how to use the REST API from other languages than JavaScript from within IBM Connections. The approach there is very nice and quite valid but it fails to mention what to do if the SSL certificate of the API endpoint either isn't trusted or isn't certified using a "known" root certificate. In this case "known" means to the Java runtime you're using or the runtime of any other language for that matter. Here I'm only dealing with Java though. 
&lt;/p&gt;
&lt;p&gt;
By default the java.net classes will not allow a SSL connections to a server using a unknown/untrusted certificate but there are ways around that. Of course the best is always to make sure that the certificate of the server may be validated by the Java keystore (including intermediate certificates) but for testing - or if you know what you're doing - simply ignoring the certificate test can be beneficial. Below is some code showing how to configure the SSL runtime to ignore the certificate and hostname checks. The code is a static configuration method and I deem it pretty readable. The code allows *all* certificates but could pretty easily be locked down to be more restrictive if need be.
&lt;pre class="prettyprint"&gt;
private void enableSelfSignedCerts() throws Throwable {
  TrustManager[] trustAllCerts = new TrustManager[] { 
    new X509TrustManager() {
      public java.security.cert.X509Certificate[] 
        getAcceptedIssuers() {
        return null;
      }
      public void checkClientTrusted(X509Certificate[] certs,
          String authType) {
      }
      public void checkServerTrusted(X509Certificate[] certs,
        String authType) {
      }
    }
 };

 SSLContext sc = SSLContext.getInstance("SSL");
 sc.init(null, 
         trustAllCerts, 
         new java.security.SecureRandom());
  HttpsURLConnection.
    setDefaultSSLSocketFactory(sc.getSocketFactory());

  // Create all-trusting host name verifier
  HostnameVerifier allHostsValid = new HostnameVerifier() {
    public boolean verify(String hostname, 
      SSLSession session) {
      return true;
    }
  };
  
  // Install the all-trusting host verifier
  HttpsURLConnection
    .setDefaultHostnameVerifier(allHostsValid);
}
&lt;/pre&gt;
&lt;/p&gt;
&lt;link href="http://lekkimworld.com/files/prettyprint/prettify.css" type="text/css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://lekkimworld.com/files/prettyprint/prettify.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
prettyPrint();
&lt;/script&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/tags/connections/">connections</category>
      <category domain="http://lekkimworld.com/tags/ibm_connections/">ibm_connections</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/ssl/">ssl</category>
      <pubDate>Mon, 04 Jun 2012 06:38:36 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2012-06-04:default/1338791916299</guid>
      <dc:date>2012-06-04T06:38:36Z</dc:date>
    </item>
    <item>
      <title>Show 'n Tell Thursday: Maximizing tabs in DDE (20 October 2011)</title>
      <link>http://lekkimworld.com/2011/10/20/show_n_tell_thursday_maximizing_tabs_in_dde_20_october_2011.html</link>
      <content:encoded>&lt;p&gt;
&lt;img src="http://lekkimworld.com/images/domino/show-n-tell/showandtellthursdays_small.jpg" style="float: right; margin: -10px 0 10px 10px;" /&gt;
It has been a looooooooooooooooong time since I did a SnTT but I found it fitting for this week. The tip is short and very straight forward but will make it easier and more productive for you to work in Domino Designer on Eclipse (DDE). 
&lt;/p&gt;
&lt;p&gt;
If you are like me like the navigator in DDE is on the left, and the outline/controls/data views are on the right. You realize that you do not have much space left for code in the center editor. Bummer! :-( To help remedy that you may either minimize or close the views on the right but that really isn't ideal as it takes time and some times you need the views e.g. for XPages work. As an alternative you could figure out which views you use for what tasks and create custom perspectives in DDE for those tasks which isn't for the Eclipse-superuser. You could also choose the easy solution - simply maximize the editor.
&lt;/p&gt;
&lt;p&gt;
Maximizing the editor is easy. You simply double-click the tab or press Ctrl-M to make the editor go fullscreen. When done you simply double-click the tab again or press Ctrl-M to return it to being "in the middle". Easy and quick.
&lt;/p&gt;
&lt;p&gt;
Hope it works as nicely for you as it does for me.
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/categories/sntt/">SnTT</category>
      <category domain="http://lekkimworld.com/tags/dde/">dde</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/show-n-tellthursday/">show-n-tellthursday</category>
      <category domain="http://lekkimworld.com/tags/sntt/">sntt</category>
      <pubDate>Thu, 20 Oct 2011 07:24:20 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2011-10-20:default/1319095460375</guid>
      <dc:date>2011-10-20T07:24:20Z</dc:date>
    </item>
    <item>
      <title>A TAI code example</title>
      <link>http://lekkimworld.com/2011/06/10/a_tai_code_example.html</link>
      <content:encoded>&lt;p&gt;
To complete &lt;a href="http://lekkimworld.com/tags/tai"&gt;my series posts&lt;/a&gt; on writing Trust Association Interceptors (TAI's) for Websphere Application Server I wanted to show a real-life example. Not a good example necessarily but an example never the less... :-)
&lt;/p&gt;
&lt;p&gt;
The below example is a very simple TAI that simply does the following:
&lt;ol&gt;
&lt;li&gt;The initialize() method reads a cookie name from the configuration done in the Websphere Application Server ISC. It illustrates how you can configure a TAI externally without having to hard code it.&lt;/li&gt;
&lt;li&gt;The isTargetInterceptor() method looks at the request and sees if a cookie with the configured name is available. If yes it continues to process the request and if not it aborts processing (from the TAI point of view).&lt;/li&gt;
&lt;li&gt;The negotiateValidateandEstablishTrust() method does the actual work by simply telling WAS that the username of user is the value from the cookie.&lt;/li&gt;
&lt;/ol&gt;
As you see writing a TAI is very simple but extremely powerful. Imagine what could be done if you did SSO between Websphere Application Server and Lotus Domino.
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
import java.util.Properties;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ibm.websphere.security.WebTrustAssociationException;
import com.ibm.websphere.security.WebTrustAssociationFailedException;
import com.ibm.wsspi.security.tai.TAIResult;
import com.ibm.wsspi.security.tai.TrustAssociationInterceptor;

public class ExampleTAI implements TrustAssociationInterceptor {
   // declarations
   private String cookie = null;
   
   @Override
   public void cleanup() {
   }

   @Override
   public String getType() {
      return String.format("Example TAI %s", this.getVersion());
   }

   @Override
   public String getVersion() {
      return "1.0";
   }

   @Override
   public int initialize(Properties props) 
      throws WebTrustAssociationFailedException {
      System.out.println("ExampleTAI.initialize()");
      
      // read properties from configuration in WAS
      this.cookie = props.getProperty("cookieName");
      
      // return 0 to indicate success
      return 0;
   }

   @Override
   public boolean isTargetInterceptor(
      HttpServletRequest req) 
      throws WebTrustAssociationException {
      System.out.println("ExampleTAI.isTargetInterceptor()");
      for (Cookie c : req.getCookies()) {
         if (c.getName().equals(this.cookie)) return true;
      }
      return false;
   }

   @Override
   public TAIResult negotiateValidateandEstablishTrust(
      HttpServletRequest req, 
      HttpServletResponse res) 
      throws WebTrustAssociationFailedException {
      System.out.println("ExampleTAI.negotiate...()");
      for (Cookie c : req.getCookies()) {
         if (c.getName().equals(this.cookie)) {
            // send 200 to signal we're okay
            return TAIResult.create(HttpServletResponse.SC_OK, 
                c.getValue());
         }
      }
      
      // not authenticated
      return TAIResult.create(HttpServletResponse.SC_UNAUTHORIZED);
   }

}
&lt;/pre&gt;
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/categories/ibm_products/">IBM</category>
      <category domain="http://lekkimworld.com/categories/web/">Web</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/tai/">tai</category>
      <category domain="http://lekkimworld.com/tags/was/">was</category>
      <category domain="http://lekkimworld.com/tags/websphere/">websphere</category>
      <pubDate>Fri, 10 Jun 2011 12:06:58 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2011-06-10:default/1307707618593</guid>
      <dc:date>2011-06-10T12:06:58Z</dc:date>
    </item>
    <item>
      <title>New version of the Java UI API Exerciser available from OpenNTF</title>
      <link>http://lekkimworld.com/2010/12/07/new_version_of_the_java_ui_api_exerciser_available_from_openntf.html</link>
      <content:encoded>&lt;p&gt;
A new release of the Notes Java UI Exerciser project has been released on OpenNTF (&lt;a href="http://www.openntf.org/blogs/openntf.nsf/d6plinks/NHEF-8BW8JX"&gt;OpenNTF Release: Notes Java UI APIs in 8.5.2&lt;/a&gt;) by our friends on the Java UI team at IBM one of whom I'm lucky enough to co-present with at Lotusphere. Check it out!
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/tags/api/">api</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/ui/">ui</category>
      <pubDate>Tue, 07 Dec 2010 13:27:22 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2010-12-07:default/1291728442843</guid>
      <dc:date>2010-12-07T13:27:22Z</dc:date>
    </item>
    <item>
      <title>The Next Release of Java: Java JDK 7, out mid-2011</title>
      <link>http://lekkimworld.com/2010/10/22/the_next_release_of_java_java_jdk_7_out_mid_2011.html</link>
      <content:encoded>&lt;p&gt;
News from JavaOne:
&lt;p&gt;
&lt;p&gt;
&lt;i&gt;
Mark Reinhold confirmed that "Plan B" is now the plan of record for the next release of Java, with JDK 7 scheduled for mid-2011, with support for other languages on the JVM (InvokeDynamic) and many small improvements (parts of Project Coin). Things that don't make it into JDK 7 are planned for JDK 8, including Project Lambda and Project Jigsaw, scheduled for late 2012. Markus Eisele, software architect, provides details about Java SE 7 and Java SE 8.
&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blogs.oracle.com/javaone/2010/09/plan_b_wins.html?msgid=3-2517886426"&gt;Janice J. Heiss: Plan B Wins&lt;/a&gt;
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/javaone/">javaone</category>
      <pubDate>Fri, 22 Oct 2010 06:47:56 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2010-10-22:default/1287730076296</guid>
      <dc:date>2010-10-22T06:47:56Z</dc:date>
    </item>
    <item>
      <title>How to extend Notes 8: New version of the demo application</title>
      <link>http://lekkimworld.com/2010/08/24/how_to_extend_notes_8_new_version_of_the_demo_application.html</link>
      <content:encoded>&lt;p&gt;
I just posted an update to the demo application for my &lt;a href="http://lekkimworld.com/tags/extending_notes8/"&gt;Extending Notes 8&lt;/a&gt; series of posts. The demo application is discussed in more detail in my previous post (&lt;a href="http://lekkimworld.com/2010/08/06/how_to_extend_notes_8_livetext_demo_application.html"&gt;How to extend Notes 8: LiveText demo application&lt;/a&gt;). The issue was that I had a button to create a demo e-mail in the UI which made the plugin depend on the Notes Java UI API which was added in Notes 8.5.1 and hence meant that the demo application wasn't installable on previous Notes versions... :-(
&lt;/p&gt;
&lt;p&gt;
To remedy that I built an new version where the button using the offending API is added from an Eclipse plugin fragment and using a custom extension point (if you're running Notes 8.5.1+). More on that approach at a later date. For now you may install the new version using the updated &lt;a href="http://lekkimworld.com/files/extending_notes8/dynlivetextdemoapplication/extension_1.0.1.xml"&gt;widget descriptor (extension.xml)&lt;/a&gt; (simply drag the link to your MyWidgets sidebar plugin).
&lt;/p&gt;
&lt;p&gt;
If you do an update - which there's absolutely no reason to if it already works for you - the only way to tell is by verifying that the version number at the bottom of the sidebar application is changed to 1.0.1.
&lt;/p&gt;
&lt;p&gt;
That's all for this post. All the posts in the series may be found under the &lt;a href="http://lekkimworld.com/tags/extending_notes8/"&gt;extending_notes8&lt;/a&gt; tag.
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/categories/ibm_products/">IBM</category>
      <category domain="http://lekkimworld.com/tags/eclipse/">eclipse</category>
      <category domain="http://lekkimworld.com/tags/extending_notes8/">extending_notes8</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/livetext/">livetext</category>
      <category domain="http://lekkimworld.com/tags/notes8/">notes8</category>
      <category domain="http://lekkimworld.com/tags/notes85/">notes85</category>
      <pubDate>Tue, 24 Aug 2010 17:51:38 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2010-08-24:default/1282672298902</guid>
      <dc:date>2010-08-24T17:51:38Z</dc:date>
    </item>
    <item>
      <title>How to extend Notes 8: LiveText demo application</title>
      <link>http://lekkimworld.com/2010/08/06/how_to_extend_notes_8_livetext_demo_application.html</link>
      <content:encoded>&lt;p&gt;
The day before yesterday I posted the first summary post in my &lt;a href="http://lekkimworld.com/tags/extending_notes8/"&gt;Extending Notes 8&lt;/a&gt; series with a complete end-to-end approach to &lt;a href="http://lekkimworld.com/2010/08/04/how_to_extend_notes_8_dynamic_livetext_recognizers_using_java.html"&gt;dynamically adding LiveTex recognizers&lt;/a&gt;. As part of that post I uploaded a &lt;a href=".files/extending_notes8/dynamiclivetextrecognizersusingjava/com.lekkimworld.extnotes8.dynext.zip"&gt;demo application (plugin)&lt;/a&gt; but I didn't add a screenshot so I thought I'd remedy that. 
&lt;/p&gt;
&lt;p align="center"&gt;
&lt;img src="http://lekkimworld.com/files/extending_notes8/dynlivetextdemoapplication/emoapp.jpg" /&gt;
&lt;/p&gt;
&lt;p&gt;
As you can see the plugin has a small welcome text and two buttons. You'll also see a textbox to hold any exception (not that I'm expecting any) that might be raised as part of adding the recognizer and content type. You may use the two buttons to easily create a demo e-mail for use with the added LiveText stuff. The left button creates the e-mail in the UI (using the new handy Java UI classes) and the right one simply sends the e-mail to you in the backend. The latter is very handy for testing as the e-mail needs to be in read mode for the LiveText sub-system to kick in.
&lt;/p&gt;
&lt;p&gt;
I've put a compiled version of the plugin on my update site and tthe plugin may be installed by dragging this &lt;a href="http://lekkimworld.com/files/extending_notes8/dynlivetextdemoapplication/extension.xml"&gt;extension.xml&lt;/a&gt; file to your MyWidgets sidebar panel (policy permitting). 
&lt;/p&gt;
&lt;p&gt;
That's all for this post. All the posts in the series may be found under the &lt;a href="http://lekkimworld.com/tags/extending_notes8/"&gt;extending_notes8&lt;/a&gt; tag.
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/categories/ibm_products/">IBM</category>
      <category domain="http://lekkimworld.com/tags/eclipse/">eclipse</category>
      <category domain="http://lekkimworld.com/tags/extending_notes8/">extending_notes8</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/livetext/">livetext</category>
      <category domain="http://lekkimworld.com/tags/notes8/">notes8</category>
      <category domain="http://lekkimworld.com/tags/notes85/">notes85</category>
      <pubDate>Fri, 06 Aug 2010 10:54:23 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2010-08-06:default/1281092063777</guid>
      <dc:date>2010-08-06T10:54:23Z</dc:date>
    </item>
    <item>
      <title>How to extend Notes 8: case insensitive LiveText patterns</title>
      <link>http://lekkimworld.com/2010/08/05/how_to_extend_notes_8_case_insensitive_livetext_patterns.html</link>
      <content:encoded>&lt;p&gt;
When you start to do a lot of LiveText recognizers you find yourself wanting to do more advanced stuff with your regular expressions. For instance you might want to do case insensitive patterns or use some of the others regular expression modifiers. This post will show you how to do this.
&lt;/p&gt;
&lt;p&gt;
By default the regular expressions you specify for your recognizers are case sensitive. This is normally fine unless you really want it to be case insensitive. Since the LiveText engine is in Java you may use the supported Java modifiers for your regular expressions. Normally the modifiers are specified when you "compile the pattern" in Java (java.util.regex.Pattern.compile(pattern, modifiers)) but as you don't have access to this process you can't do that. 
&lt;/p&gt;
&lt;p&gt;
There is however another way...
&lt;/p&gt;
&lt;p&gt;
You can embed some modifiers in the pattern such as Pattern.MULTILINE, Pattern.UNICODE_CASE, Pattern.DOTALL and most of all Pattern.CASE_INSENSITIVE! You embed the modifier in the start of the pattern. So instead of doing a case insensitive pattern like this (to recognizer "lotus" and "Lotus"):
&lt;pre&gt;
[Ll]otus
&lt;/pre&gt;
you do
&lt;pre&gt;
(?i)lotus
&lt;/pre&gt;
Cool isn't it?
&lt;/p&gt;
&lt;p&gt;
The following modifiers are supported in Java though not all makes sense for LiveText:
&lt;ul&gt;
&lt;li&gt;Pattern.CASE_INSENSITIVE = (?i)&lt;/li&gt;
&lt;li&gt;Pattern.MULTILINE = (?m)&lt;/li&gt;
&lt;li&gt;Pattern.DOTALL = (?s)&lt;/li&gt;
&lt;li&gt;Pattern.UNICODE_CASE = (?u)&lt;/li&gt;
&lt;/ul&gt;
Please bear in mind that it probably only makes sense to use DOTALL and CASE_INSENSITIVE.
&lt;/p&gt;
&lt;p&gt;
That's all for this post. All the posts in the series may be found under the &lt;a href="http://lekkimworld.com/tags/extending_notes8/"&gt;extending_notes8&lt;/a&gt; tag.
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/categories/ibm_products/">IBM</category>
      <category domain="http://lekkimworld.com/tags/eclipse/">eclipse</category>
      <category domain="http://lekkimworld.com/tags/extending_notes8/">extending_notes8</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/livetext/">livetext</category>
      <category domain="http://lekkimworld.com/tags/notes8/">notes8</category>
      <category domain="http://lekkimworld.com/tags/notes85/">notes85</category>
      <pubDate>Thu, 05 Aug 2010 12:11:33 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2010-08-05:default/1281010293886</guid>
      <dc:date>2010-08-05T12:11:33Z</dc:date>
    </item>
  </channel>
</rss>

