<?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>What I Learned Today &#187; jetty</title>
	<atom:link href="http://christiansons.net/mike/blog/tag/jetty/feed/" rel="self" type="application/rss+xml" />
	<link>http://christiansons.net/mike/blog</link>
	<description>Mike Christianson&#039;s journal of Java, Ant, SVN, Jetty, cygwin and other stuff.</description>
	<lastBuildDate>Wed, 04 Aug 2010 22:24:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Jetty browser cache control</title>
		<link>http://christiansons.net/mike/blog/2009/09/jetty-browser-cache-control/</link>
		<comments>http://christiansons.net/mike/blog/2009/09/jetty-browser-cache-control/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 18:36:37 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[jetty]]></category>
		<category><![CDATA[cache]]></category>

		<guid isPermaLink="false">http://christiansons.net/mike/blog/?p=405</guid>
		<description><![CDATA[Do you use Jetty and need to change the default setting for browser cache control? Have a look at the init-param element named cacheControl in webdefault.xml. Here&#8217;s the default configuration for the version of Jetty I use. Note the element is commented. &#60;!-- &#60;init-param&#62; &#60;param-name&#62;cacheControl&#60;/param-name&#62; &#60;param-value&#62;max-age=3600,public&#60;/param-value&#62; &#60;/init-param&#62; --&#62; To enable and configure browser cache control, [...]]]></description>
			<content:encoded><![CDATA[<p>Do you use Jetty and need to change the default setting for browser <a href="http://tools.ietf.org/html/rfc2616#section-14.9">cache control</a>?  Have a look at the <tt>init-param</tt> element named <tt>cacheControl</tt> in <tt>webdefault.xml</tt>.  </p>
<p>Here&#8217;s the default configuration for the version of Jetty I use.  Note the element is commented.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">&lt;init-param&gt;</span>
<span style="color: #808080; font-style: italic;">      &lt;param-name&gt;cacheControl&lt;/param-name&gt;</span>
<span style="color: #808080; font-style: italic;">      &lt;param-value&gt;max-age=3600,public&lt;/param-value&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;/init-param&gt;</span>
<span style="color: #808080; font-style: italic;">--&gt;</span></pre></div></div>

<p>To enable and configure browser cache control, uncomment and edit the <tt>param-value</tt> as appropriate.  The following example instructs the browser to disable all caching.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>cacheControl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>no-store,no-cache,must-revalidate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>For information on <tt>Cache-Control</tt>, see <a href="http://tools.ietf.org/html/rfc2616#section-14.9">RFC 2616, Section 14.9</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/09/jetty-browser-cache-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Jetty, embedded servlet container</title>
		<link>http://christiansons.net/mike/blog/2008/12/jetty-embedded-servlet-container/</link>
		<comments>http://christiansons.net/mike/blog/2008/12/jetty-embedded-servlet-container/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 21:59:06 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[servlet]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=49</guid>
		<description><![CDATA[There&#8217;s no law which states web servers and servlet containers must be large, separate pieces of software.  If there were, Jetty would be a dangerous outlaw (possibly even public enemy number one).  Jetty is an open-source embeddable web server and servlet container, written in Java.  It&#8217;s small, fast, and easy to embed &#8212; perfect for [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s no law which states web servers and servlet containers must be large, separate pieces of software.  If there were, <a title="Jetty website" href="http://www.mortbay.org/jetty/">Jetty</a> would be a dangerous outlaw (possibly even public enemy number one).  Jetty is an open-source embeddable web server and servlet container, written in Java.  It&#8217;s small, fast, and easy to embed &#8212; perfect for self-contained applications.</p>
<p>Let&#8217;s use an example to discover just how easy embedding Jetty can be.  <span id="more-49"></span>Say we have two servlets, one should be mapped to <tt>/service/one</tt> and the other <tt>/service/two</tt>, served on port <tt>8080</tt>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">Server server <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Server<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Connector connector <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SelectChannelConnector<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
connector.<span style="color: #006633;">setPort</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8080</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
server.<span style="color: #006633;">addConnector</span><span style="color: #009900;">&#40;</span>connector<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
ContextHandlerCollection contexts <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ContextHandlerCollection<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
server.<span style="color: #006633;">setHandler</span><span style="color: #009900;">&#40;</span>contexts<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003399;">Context</span> context <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Context</span><span style="color: #009900;">&#40;</span>contexts, <span style="color: #0000ff;">&quot;/service&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
context.<span style="color: #006633;">addServlet</span><span style="color: #009900;">&#40;</span>ServiceOne.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;/one&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
context.<span style="color: #006633;">addServlet</span><span style="color: #009900;">&#40;</span>ServiceTwo.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;/two&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
server.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
server.<span style="color: #006633;">join</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>That&#8217;s it; easy.  For information and more examples on embedding Jetty in your Java application, read <a title="wiki documentation on embedding Jetty" href="http://docs.codehaus.org/display/JETTY/Embedding+Jetty">Embedding Jetty</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2008/12/jetty-embedded-servlet-container/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
