<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>On the road to Bandol &#187; servlet</title>
	<atom:link href="http://javacard.vetilles.com/tag/servlet/feed/" rel="self" type="application/rss+xml" />
	<link>http://javacard.vetilles.com</link>
	<description>A weblog on Java Card, security, and other things personal</description>
	<lastBuildDate>Mon, 18 Aug 2025 06:48:26 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.32</generator>
	<item>
		<title>JC301-1: Introducing Java Card 3.0</title>
		<link>http://javacard.vetilles.com/2008/09/04/jc201-1-introducing-java-card-30/</link>
		<comments>http://javacard.vetilles.com/2008/09/04/jc201-1-introducing-java-card-30/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 21:47:33 +0000</pubDate>
		<dc:creator><![CDATA[Eric Vétillard]]></dc:creator>
				<category><![CDATA[Java Card Bandol]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Java Card 3.0]]></category>
		<category><![CDATA[servlet]]></category>

		<guid isPermaLink="false">http://javacard.vetilles.com/2008/09/04/jc201-1-introducing-java-card-30/</guid>
		<description><![CDATA[Foreword: The JC101 tutorial about Java Card 2 is getting closer to the end, now dealing with the subtleties of cryptography, testing, and other difficult tasks. As progress may slow to a crawl, it is time to start discussing the technology that actually started this blog, Java Card 3. &#8211; o &#8211; Your first program [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Foreword: The JC101 tutorial about Java Card 2 is getting closer to the end, now dealing with the subtleties of cryptography, testing, and other difficult tasks. As progress may slow to a crawl, it is time to start discussing the technology that actually started this blog, Java Card 3.</p>
<p><center>&#8211; o &#8211;</center></p>
<h2>Your first program</h2>
<p>If you are going to work with Java Card 3, your first program is quite likely to look something like the following:</p>
<pre>
public class EchoServlet extends <span style="background-color: yellow">HttpServlet</span> {

  <span style="background-color: yellow">@Override</span>
  public void doGet(
          HttpServletRequest request,
          HttpServletResponse response)
              throws IOException {
    String message =
      request.getPathInfo().substring(1);
    StringBuffer echo = <span style="background-color: yellow">new</span> StringBuffer();
    echo.append(HTML[0]);
    for(<span style="background-color: yellow">int</span> i = 1; i < HTML.length; i++)
    {
      echo.append(message);
      echo.append(HTML[i]);
    }
    PrintWriter out = response.getWriter();
    out.print(echo.toString());
  }

  private static final <span style="background-color: yellow">String</span> HTML[] = {
            "&lt;html>&lt;header>&lt;title>Echo&lt;/title>&lt;/header>"
         + "&lt;body>&lt;center>
    	 + "&lt;h1>Echo&lt;/h1>&lt;br>&lt;br>&lt;br>"
         + "&lt;font color=\"#000000\">" , "&lt;/font>&lt;br>"
         + "&lt;font color=\"#444444\">" , "&lt;/font>&lt;br>"
         + "&lt;font color=\"#888888\">" , "&lt;/font>&lt;br>"
         + "&lt;font color=\"#cccccc\">" , "&lt;/font>&lt;br>"
         + "&lt;/center>&lt;br>&lt;br>"
         + "&lt;small>&lt;p align=\"center\">"
         + "Yes, this servlet runs on a Java Card.&lt;/p>&lt;/small>"
         + "&lt;/center>&lt;/body>&lt;/html>"};
}
</pre>
<p>Quite a shocker, isn&#8217;t it? This doesn&#8217; look at all like a Java Card program. There is nothing specific for card in this program; it could run on any Java EE Web server. On the program, I have outlined a few words that somehow define what Java Card 3.0 is; let&#8217;s take a look at them:</p>
<ul>
<li><code>int</code>. Everyobdy expected this one eventually, and here it is. Java Card 3.0 is a pure 32-bit virtual machine, and there is no reason to cast computation into <code>short</code> and <code>byte</code>, expect for storage. Of course, this also means that Java Card 3.0 will only work on chips that include a 32-bit processor.</li>
<li><code>String</code>. Another long-time dream of Java Card developers, in particular those working on text-intensive SIM Toolkit applets. Well, strings are supported in Java Card 3.0.</li>
<li><code>new</code>. It is nos possible to allocate objects temporarily, <em>i.e.</em>, to program in a more standard Java way. This is made possible by the availability of a real garbage collector, and by the fact that some objects are actually stored in RAM. Of course, this also means that Java Card 3.0 will only work on chips that include enough RAM (at least 16 kilobytes).</li>
<li><code>@Override</code>. This annotation is not very useful in itself, but its availability means that Java Card 3.0 is based on a recent release of Java, which supports annotations. In fact, Java Card 3.0 is based on the latest release, Java 6, and it includes supports for quite a few advanced features, including generics and others.</li>
<li><code>HttpServlet</code>. I have kept the best one for the end. Yes, this application is a servlet, and not an applet. It means that a Java Card 3.0 card is expected to be a Web server, receiving HTTP requests over a TCP/IP connection and answering appropiately with a Web page that will be displayed in your browser.</li>
</ul>
<p>Now, can we run this application? Of course, we can, and the result is shown below:</p>
<p><center><a href="http://javacard.vetilles.com/2008/09/04/jc201-1-introducing-java-card-30/execution-of-echo1/" rel='attachment wp-att-152' title='Execution of Echo1' class="liimagelink"><img src='http://javacard.vetilles.com/wp-content/uploads/2008/09/echo1.thumbnail.png' alt='Execution of Echo1' /></a></center></p>
<p>A question that often comes to mind about these applications is &#8220;<em>Is this still Java Card?</em>&#8221; The answer is unclear:</p>
<ul>
<li><strong>No, it&#8217;s not!</strong> It is a Web server, it talks to your browser. It basically supports Java, and there is no Java Card-specific stuff any more.</li>
<li><strong>Of course it is &#8230;</strong> This thing runs on a smart card, <em>i.e.</em>, on devices that keep the interesting properties of a smart card (secure, portable, cheap, manageable), as well as their drawbacks (too small, too slow). So yes, there is still plenty of Java Card-specific stuff to know about Java Card 3.0 and servlets.</li>
</ul>
<p>That&#8217;s it for today! We will get to the real stuff in a few days or weeks. For now, you have an opportunity to come visit my home turf and learn about Java Card 3.0 by attending <a href="http://www.strategiestm.com/conferences/smartuniv/08/index.htm" class="liexternal">Smart University</a> session on <a href="http://www.strategiestm.com/conferences/smartuniv/08/program_smart-card-software.htm" class="liexternal">The Art of Java Card 3.0 Programming</a> on September 16th and 17th in Sophia Antipolis. If you missed the JavaOne bash, don&#8217;t miss this opportunity to meet with the Java Card 3 community. See you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://javacard.vetilles.com/2008/09/04/jc201-1-introducing-java-card-30/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
