<?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-31270604</id><updated>2011-11-27T18:53:36.081-06:00</updated><title type='text'>App Dev</title><subtitle type='html'>Software should be simple</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nrudnik.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nrudnik.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Nick Rudnik</name><uri>http://www.blogger.com/profile/08654340053032116849</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><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-31270604.post-7166996376708228894</id><published>2011-08-01T23:30:00.003-05:00</published><updated>2011-08-01T23:37:46.771-05:00</updated><title type='text'>Google App Engine Datastore Java BigDecimal and JDO</title><content type='html'>If you have tried to persist a BigDecimal field in the Google App Engine Datastore using the low level Java API, you may have noticed BigDecimal is not natively supported. However, through the JDO interface, it is possible to persist a BigDecimal field on your entity.&lt;br /&gt;&lt;br /&gt;Define the entity with the proper JDO annotations.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;@PersistenceCapable(identityType = IdentityType.APPLICATION)&lt;br /&gt;public class MyEntity {&lt;br /&gt;  @PrimaryKey&lt;br /&gt;  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)&lt;br /&gt;  private Long id;&lt;br /&gt; &lt;br /&gt;  @Persistent&lt;br /&gt;  private BigDecimal amount;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The JDO implementation for the app engine datastore will handle the persistence of the BigDecimal value even though BigDecimal itself is not persisted. &lt;br /&gt;&lt;br /&gt;The important thing to understand is that there is a conversion happening so the BigDecimal precision is not entirely maintained. It seems to be the same as if you converted a BigDecimal object into float or double and back to BigDecimal. So, a BigDecimal with the value 1.99 might be actually stored as something like 1.9900000000000001101341... when it is converted back to BigDecimal.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31270604-7166996376708228894?l=nrudnik.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nrudnik.blogspot.com/feeds/7166996376708228894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31270604&amp;postID=7166996376708228894' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/7166996376708228894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/7166996376708228894'/><link rel='alternate' type='text/html' href='http://nrudnik.blogspot.com/2011/08/google-app-engine-datastore-java.html' title='Google App Engine Datastore Java BigDecimal and JDO'/><author><name>Nick Rudnik</name><uri>http://www.blogger.com/profile/08654340053032116849</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31270604.post-884445518655958419</id><published>2010-12-16T22:53:00.008-06:00</published><updated>2011-08-01T19:36:46.334-05:00</updated><title type='text'>Google App Engine for Java and the SSL Session</title><content type='html'>If you are building an application on Google App Engine for Java and you use sessions, SSL, and a custom domain name, you may have ran into trouble transferring the session between the secure and non-secure portions of your site. This is because SSL on App Engine requires use of the appspot.com domain while the rest of your application is accessed by your own domain name. When a browser accesses one domain, the session is established by a cookie that is inaccessible to the other. This presents much difficulty if you are designing something like a login or registration form that must be secure while later redirecting to an insecure page that needs the same session to know if the user is authenticated.  &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A simple solution is to transfer the jsessionid cookie value to the insecure site after you manipulate the session on the secure side. The flow would look something like this in the example of a login process:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;User requests secure page for login form.&lt;/li&gt;&lt;li&gt;Submits form by POST over SSL to servlet or other handler&lt;/li&gt;&lt;li&gt;In the servlet, update the session as you desire but also grab the jsessionid cookie&lt;/li&gt;&lt;li&gt;Redirect to an insecure servlet that accepts the jsessionid as a parameter&lt;/li&gt;&lt;li&gt;Write the received jsessionid cookie back to the response from the insecure side&lt;/li&gt;&lt;li&gt;Redirect or render appropriate view&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;The insecure session has now been replaced with the one established on the secure page. Login complete!&lt;br /&gt;&lt;br /&gt;Since my application is built in Spring 3 MVC, I have some sample code readily available that would go something like this:&lt;br /&gt;&lt;br /&gt;First, the controller method that handles the post of the login form has to grab the jsessionid from the current secure session. Remember, this post is done to the https appspot url.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;@RequestMapping(method = RequestMethod.POST)&lt;br /&gt;public String doSubmit(@ModelAttribute("loginForm") @Valid LoginForm loginForm&lt;br /&gt;  , @CookieValue("JSESSIONID") String jsessionid) {&lt;br /&gt;&lt;br /&gt;  //do the login logic&lt;br /&gt;  Long userId = userService.doLogin(loginForm.getEmail(), loginForm.getPassword());&lt;br /&gt;&lt;br /&gt;  if (userId != null ) {&lt;br /&gt;&lt;br /&gt;    //....&lt;br /&gt;    //set some kind of session variable here to indicate the user is authenticated&lt;br /&gt;    //this variable will be accessible from any insecure page&lt;br /&gt;    //....&lt;br /&gt;&lt;br /&gt;    return "redirect:http://www.mydomain.com/session-transfer.html?jsessionid="+jsessionid+"&amp;amp;destination=%2F";&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Notice the jsession id being taken from the current session and passed as a url parameter to the url that will actually transfer the session to the insecure site. The handler for the session-transfer url would look like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;@RequestMapping(method = RequestMethod.GET)&lt;br /&gt;public String handleRequest(@RequestParam("jsessionid") String jsessionId&lt;br /&gt;  , @RequestParam("destination") String destination&lt;br /&gt;  , HttpServletResponse response) {&lt;br /&gt;&lt;br /&gt;  //overwrite jsessionid from the one from the ssl site&lt;br /&gt;  Cookie jsessionCookie = new Cookie("JSESSIONID", jsessionId);&lt;br /&gt;  response.addCookie(jsessionCookie);&lt;br /&gt;  return "redirect:" + destination;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Since this handler is happening in the context of the http site, the current jsessionid the browser is providing in its cookie is for the insecure session. Here, we overwrite that jsessionid with the one from the secure site where the session was updated to indicate the user is authenticated. Now, anywhere in the site that needs session variables from insecure pages can read those that were set during the secure session.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31270604-884445518655958419?l=nrudnik.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nrudnik.blogspot.com/feeds/884445518655958419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31270604&amp;postID=884445518655958419' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/884445518655958419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/884445518655958419'/><link rel='alternate' type='text/html' href='http://nrudnik.blogspot.com/2010/12/google-app-engine-for-java-and-ssl.html' title='Google App Engine for Java and the SSL Session'/><author><name>Nick Rudnik</name><uri>http://www.blogger.com/profile/08654340053032116849</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31270604.post-1543042529958152427</id><published>2010-11-12T18:19:00.009-06:00</published><updated>2010-11-12T18:43:42.109-06:00</updated><title type='text'>Java 6 on Mac OS X 10.5.8</title><content type='html'>It's not terribly obvious, but if you have Mac OS X 10.5.8, it is possible to get Java SE 6 without upgrading your OS.&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Visit Apple's Developer Downloads&lt;/div&gt;&lt;div&gt;&lt;a href="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.9.3.3.1"&gt;http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.9.3.3.1&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;At the time of this writing, under the java category of downloads, this is the update that will give you Java SE 6 (1.6.0_22):&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Java for Mac OS X 10.5 Update 8 Developer Package&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Once installed, open the Java Preferences control panel and drag Java SE 6 to the top to use it by default.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31270604-1543042529958152427?l=nrudnik.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nrudnik.blogspot.com/feeds/1543042529958152427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31270604&amp;postID=1543042529958152427' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/1543042529958152427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/1543042529958152427'/><link rel='alternate' type='text/html' href='http://nrudnik.blogspot.com/2010/11/java-6-on-mac-os-x-1058.html' title='Java 6 on Mac OS X 10.5.8'/><author><name>Nick Rudnik</name><uri>http://www.blogger.com/profile/08654340053032116849</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-31270604.post-1269931182207703096</id><published>2010-09-30T19:05:00.002-05:00</published><updated>2010-09-30T19:19:54.780-05:00</updated><title type='text'>Upgrade Google App Engine SDK in Eclipse</title><content type='html'>Upgrading the Google App Engine SDK plugin for Eclipse is not terribly difficult but it's time I wrote down the steps I follow to get it done. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This works for Eclipse Galileo but should be similar in other versions.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Go to Help-&gt;Install New Software&lt;/li&gt;&lt;li&gt;Select the Google Plugin Site. Add if not there. http://dl.google.com/eclipse/plugin/3.5&lt;/li&gt;&lt;li&gt;Select the new version of the SDK. Complete the wizard.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Obvious so far. Now, go to your project and change it to use the new version you just installed.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Go to Properties of project&lt;/li&gt;&lt;li&gt;Go to Google -&gt; App Engine&lt;/li&gt;&lt;li&gt;Select Use Specific SDK and pick the newest version&lt;/li&gt;&lt;li&gt;Click OK&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;This will make the proper changes to your project to use the new SDK. But, if you had to point to specific jars in the SDK for any reason like doing unit testing, your project will be partially pointing to another version of the SDK. To make the upgrade process much more smooth, make use of variables in the project's build path.&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Go to the java build path -&gt; libraries tab.&lt;/li&gt;&lt;li&gt;Add a variable. Call it something like GAE_SDK and point it to the root of the installed Google App Engine plugin: /eclipse-jee-galileo-win32/eclipse/plugins/com.google.appengine.eclipse.sdkbundle.1.3.7_1.3.7.v201008311405/appengine-java-sdk-1.3.7&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;Now update all your extra Google App Engine SDK jars to point through this variable. Next time you upgrade, repeat the same steps and update the variable.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31270604-1269931182207703096?l=nrudnik.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nrudnik.blogspot.com/feeds/1269931182207703096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31270604&amp;postID=1269931182207703096' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/1269931182207703096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31270604/posts/default/1269931182207703096'/><link rel='alternate' type='text/html' href='http://nrudnik.blogspot.com/2010/09/upgrade-google-app-engine-sdk-in.html' title='Upgrade Google App Engine SDK in Eclipse'/><author><name>Nick Rudnik</name><uri>http://www.blogger.com/profile/08654340053032116849</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></feed>
