<?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>Jakob Korherr&#039;s Blog</title>
	<atom:link href="http://www.jakobk.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jakobk.com</link>
	<description>A blog about Java, MyFaces and web development</description>
	<lastBuildDate>Tue, 22 Nov 2011 15:40:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JSF value expression injection vulnerability</title>
		<link>http://www.jakobk.com/2011/11/jsf-value-expression-injection-vulnerability/</link>
		<comments>http://www.jakobk.com/2011/11/jsf-value-expression-injection-vulnerability/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 15:40:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=218</guid>
		<description><![CDATA[A few days ago this issue was reported to Mojarra: http://java.net/jira/browse/JAVASERVERFACES-2247.
It basically states that it is possible in JSF 2 to perform ValueExpression injection when includeViewParams is set to true on a navigation case.
To illustrate this in a better way, I created an example project at apache-extras, which shows the vulnerability: http://code.google.com/a/apache-extras.org/p/jsf-includeviewparams-security-hole-example/
Use the following steps [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago this issue was reported to Mojarra: <a href="http://java.net/jira/browse/JAVASERVERFACES-2247">http://java.net/jira/browse/JAVASERVERFACES-2247</a>.</p>
<p>It basically states that it is possible in JSF 2 to perform ValueExpression injection when includeViewParams is set to true on a navigation case.</p>
<p>To illustrate this in a better way, I created an example project at apache-extras, which shows the vulnerability: <a href="http://code.google.com/a/apache-extras.org/p/jsf-includeviewparams-security-hole-example/">http://code.google.com/a/apache-extras.org/p/jsf-includeviewparams-security-hole-example/</a></p>
<p>Use the following steps to run the example:</p>
<ol>
<li>svn checkout http://svn.codespot.com/a/apache-extras.org/jsf-includeviewparams-security-hole-example/trunk/</li>
<li>mvn clean jetty:run-exploded -PjettyConfig</li>
<li>go to http://localhost:8080/include-view-params-security and follow the instructions</li>
</ol>
<p>This vulnerability exists, because JSF treats the value of a view parameter as a ValueExpression when performing a navigation case with includeViewParams=true. For further details, see the issues at Mojarra and MyFaces: <a href="http://java.net/jira/browse/JAVASERVERFACES-2247">http://java.net/jira/browse/JAVASERVERFACES-2247</a> and <a href="https://issues.apache.org/jira/browse/MYFACES-3405">https://issues.apache.org/jira/browse/MYFACES-3405</a></p>
<p><strong style="font-size:20pt;">Until this is fixed you should avoid using includeViewParams=true!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2011/11/jsf-value-expression-injection-vulnerability/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bachelor thesis about relative resource handler</title>
		<link>http://www.jakobk.com/2011/11/bachelor-thesis-about-relative-resource-handler/</link>
		<comments>http://www.jakobk.com/2011/11/bachelor-thesis-about-relative-resource-handler/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 13:52:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf]]></category>
		<category><![CDATA[tu wien]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=214</guid>
		<description><![CDATA[I am very happy to announce that I will write my bachelor thesis at the research group for industrial software (INSO) at Vienna University of Technology. The thesis will be about my work on the relative resource handler for JSF 2 [1].
Together with Marcus Büttner and Mark Struberg I will adapt the relative resource handler [...]]]></description>
			<content:encoded><![CDATA[<p>I am very happy to announce that I will write my bachelor thesis at the research group for industrial software (INSO) at Vienna University of Technology. The thesis will be about my work on the relative resource handler for JSF 2 [1].</p>
<p>Together with Marcus Büttner and Mark Struberg I will adapt the relative resource handler for the administration software of the Vienna University of Technology, TISS [2]. For this task the relative resource handler will include some new features apart from supporting relative paths between resources, like e.g. supporting external resource locations. Check out the issue tracker for all enhancements [3]. Also, we already created a wiki page [4] for a list of all requirements.</p>
<p>Stay tuned!</p>
<p>[1] <a href="http://code.google.com/a/apache-extras.org/p/relative-resource-handler/">http://code.google.com/a/apache-extras.org/p/relative-resource-handler/</a><br />
[2] <a href="https://tiss.tuwien.ac.at/">https://tiss.tuwien.ac.at/</a><br />
[3] <a href="http://code.google.com/a/apache-extras.org/p/relative-resource-handler/issues/list">http://code.google.com/a/apache-extras.org/p/relative-resource-handler/issues/list</a><br />
[4] <a href="http://code.google.com/a/apache-extras.org/p/relative-resource-handler/wiki/Requirements">http://code.google.com/a/apache-extras.org/p/relative-resource-handler/wiki/Requirements</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2011/11/bachelor-thesis-about-relative-resource-handler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MyFaces 2.1 is now trunk</title>
		<link>http://www.jakobk.com/2011/05/myfaces-2-1-is-now-trunk/</link>
		<comments>http://www.jakobk.com/2011/05/myfaces-2-1-is-now-trunk/#comments</comments>
		<pubDate>Mon, 02 May 2011 18:07:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=204</guid>
		<description><![CDATA[After a discussion about keeping our 2.0.x and 2.1.x branches in sync last week on the MyFaces dev mailing list, we decided to promote the 2.1.x branch to trunk. In addition, we created a 2.0.x maintenance branch.
MyFaces core 2.1.x is now here:
https://svn.apache.org/repos/asf/myfaces/core/trunk/
https://svn.apache.org/repos/asf/myfaces/shared/trunk/
or
https://svn.apache.org/repos/asf/myfaces/current21/

MyFaces core 2.0.x is now here:
https://svn.apache.org/repos/asf/myfaces/core/branches/2.0.x/
https://svn.apache.org/repos/asf/myfaces/shared/trunk_4.0.x/
or
https://svn.apache.org/repos/asf/myfaces/current20/
]]></description>
			<content:encoded><![CDATA[<p>After a discussion about <a href="http://www.mail-archive.com/dev@myfaces.apache.org/msg52812.html">keeping our 2.0.x and 2.1.x branches in sync</a> last week on the MyFaces dev mailing list, we decided to promote the 2.1.x branch to trunk. In addition, we created a 2.0.x maintenance branch.</p>
<h4>MyFaces core 2.1.x is now here:</h4>
<p><a href="https://svn.apache.org/repos/asf/myfaces/core/trunk/">https://svn.apache.org/repos/asf/myfaces/core/trunk/</a><br />
<a href="https://svn.apache.org/repos/asf/myfaces/shared/trunk/">https://svn.apache.org/repos/asf/myfaces/shared/trunk/</a><br />
or<br />
<a href="https://svn.apache.org/repos/asf/myfaces/current21/">https://svn.apache.org/repos/asf/myfaces/current21/</a><br />
<br/></p>
<h4>MyFaces core 2.0.x is now here:</h4>
<p><a href="https://svn.apache.org/repos/asf/myfaces/core/branches/2.0.x/">https://svn.apache.org/repos/asf/myfaces/core/branches/2.0.x/</a><br />
<a href="https://svn.apache.org/repos/asf/myfaces/shared/trunk_4.0.x/">https://svn.apache.org/repos/asf/myfaces/shared/trunk_4.0.x/</a><br />
or<br />
<a href="https://svn.apache.org/repos/asf/myfaces/current20/">https://svn.apache.org/repos/asf/myfaces/current20/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2011/05/myfaces-2-1-is-now-trunk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSF 2.2 Expert Group</title>
		<link>http://www.jakobk.com/2011/04/jsf-2-2-expert-group/</link>
		<comments>http://www.jakobk.com/2011/04/jsf-2-2-expert-group/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 12:19:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jcp]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsf 2.2]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=201</guid>
		<description><![CDATA[I just joined the JSF 2.2 (JSR 344) Expert Group. However, my request is not 100% done, I need to sign and fax the JSPA first (will do so next week).
I joined the EG, because some issues which were chosen for JSF 2.2, were originated by myself, like JAVASERVERFACES_SPEC_PUBLIC-976 or JAVASERVERFACES_SPEC_PUBLIC-947 (see other blog post). [...]]]></description>
			<content:encoded><![CDATA[<p>I just joined the JSF 2.2 (<a href="http://www.jcp.org/en/jsr/detail?id=344">JSR 344</a>) Expert Group. However, my request is not 100% done, I need to sign and fax the JSPA first (will do so next week).</p>
<p>I joined the EG, because some <a href="http://java.net/jira/secure/IssueNavigator.jspa?mode=hide&#038;requestId=10531">issues which were chosen for JSF 2.2</a>, were originated by myself, like JAVASERVERFACES_SPEC_PUBLIC-976 or JAVASERVERFACES_SPEC_PUBLIC-947 (see other blog post). In addition, I will certainly contribute code for some issues, e.g. for JAVASERVERFACES_SPEC_PUBLIC-947 (because this spec issue is the result of my <a href="https://issues.apache.org/jira/browse/MFCOMMONS-29">AdvancedResourceHandler in MyFaces commons</a>).</p>
<p>I am really looking forward to working with Ed Burns and the other EG members and to creating a kick-ass new version of JSF!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2011/04/jsf-2-2-expert-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSF 2.2 &#8211; spec issues with at least one vote</title>
		<link>http://www.jakobk.com/2011/04/jsf-2-2-spec-issues-with-at-least-one-vote/</link>
		<comments>http://www.jakobk.com/2011/04/jsf-2-2-spec-issues-with-at-least-one-vote/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 18:49:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsf 2.2]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=199</guid>
		<description><![CDATA[Here is a list of all open JSF spec issues with at least one vote: http://java.net/jira/secure/IssueNavigator.jspa?mode=hide&#038;requestId=10514
Created via JIRA&#8217;s custom search query api.
]]></description>
			<content:encoded><![CDATA[<p>Here is a list of all open JSF spec issues with at least one vote: <a href="http://java.net/jira/secure/IssueNavigator.jspa?mode=hide&#038;requestId=10514">http://java.net/jira/secure/IssueNavigator.jspa?mode=hide&#038;requestId=10514</a></p>
<p>Created via JIRA&#8217;s custom search query api.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2011/04/jsf-2-2-spec-issues-with-at-least-one-vote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSF 2.2 &#8211; Vote for your top 5 issues</title>
		<link>http://www.jakobk.com/2011/04/jsf-2-2-vote-for-your-top-5-issues/</link>
		<comments>http://www.jakobk.com/2011/04/jsf-2-2-vote-for-your-top-5-issues/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 18:21:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsf 2.2]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=191</guid>
		<description><![CDATA[In the JSR-344 (= JSF 2.2) expert group kick-off meeting last wednesday in Vienna, Austria (which I was very glad to attend), the expert group agreed on letting everyone involved in JSF vote for their top 5 specification issues in the issue tracker. Ed Burns also announced this in this blog post.
There are currently about [...]]]></description>
			<content:encoded><![CDATA[<p>In the JSR-344 (= JSF 2.2) expert group kick-off meeting last wednesday in Vienna, Austria (which I was very glad to attend), the expert group agreed on letting everyone involved in JSF vote for their top 5 specification issues in the <a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC" target="_top">issue tracker</a>. Ed Burns also announced this in <a href="http://weblogs.java.net/blog/edburns/archive/2011/04/14/vote-your-top-five-issues-jsf-22" target="_top">this blog post</a>.</p>
<p>There are currently about 330 open issues in the specification issues tracker and the number is slightly growing, since Ed told everyone to file their issues, because otherwise the problem &#8220;does not exist&#8221;.</p>
<p>Working through the open issues, I found out that there are some parts which do not have a spec issue yet, for example the question of integrating JSF&#8217;s managed bean mechanism with CDI (JSR-299) or the concept of CODI&#8217;s type-safe view config. Thus I created about 5 new issues in the tracker.</p>
<p>And here they are &#8211; <strong>my TOP 5 JSF 2.2 issues</strong>:</p>
<ul>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-901">JAVASERVERFACES_SPEC_PUBLIC-901</a> &#8211; Deprecate &#8220;targets&#8221; concept</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-907">JAVASERVERFACES_SPEC_PUBLIC-907</a> &#8211; Improve Ajax Http.Get support to (re)render parts of the page</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-947">JAVASERVERFACES_SPEC_PUBLIC-947</a> &#8211; Relative Resources</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-949">JAVASERVERFACES_SPEC_PUBLIC-949</a> &#8211; Window-id</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-972">JAVASERVERFACES_SPEC_PUBLIC-972</a> &#8211; [JSR-303 integration] @Valid support for custom types</li>
</ul>
<p>The first one comes from a discussion on the jsr-314-open list I had with Ed, Andy Schwartz and some other guys about (how I call it) &#8220;the epic fail targets attribute&#8221;. The second one is from Matthias Wessendorf and improves the Websocket support for JSF. The third one originates from my <a href="https://issues.apache.org/jira/browse/MFCOMMONS-29">Advanced JSF 2 ResourceHandler implementation</a> in MyFaces Commons. The fourth one comes from <a href="http://myfaces.apache.org/extensions/cdi/index.html">MyFaces CODI</a> and the fifth one comes from Gerhard Petracek, a colleague of mine from IRIAN who is Bean Validation expert group member.</p>
<p>However, there are some other open issues, which I created, that I cannot vote for (simply because you cannot vote for the issues you created):</p>
<ul>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-977">JAVASERVERFACES_SPEC_PUBLIC-977</a> &#8211; Type-safe view config and navigation</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-976">JAVASERVERFACES_SPEC_PUBLIC-976</a> &#8211; Future of JSF Managed Beans and CDI</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-974">JAVASERVERFACES_SPEC_PUBLIC-974</a> &#8211; Add support for conditional comments to h:outputStylesheet and h:outputScript (add condition attribute)</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-953">JAVASERVERFACES_SPEC_PUBLIC-953</a> &#8211; Provide a way to find out if content was defined for a <ui:insert></li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-946">JAVASERVERFACES_SPEC_PUBLIC-946</a> &#8211; Provide internal server path of resources from Resource API via EL</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-796">JAVASERVERFACES_SPEC_PUBLIC-796</a> &#8211; Use the model value for a UIViewParameter only on a postbacks</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-795">JAVASERVERFACES_SPEC_PUBLIC-795</a> &#8211; UIViewParameter state saving algorithm</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-755">JAVASERVERFACES_SPEC_PUBLIC-755</a> &#8211; passing through of actionListener, action,.. not possible between composite components</li>
<li><a href="http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-745">JAVASERVERFACES_SPEC_PUBLIC-745</a> &#8211; Type of #{cc.attrs.test} cannot be obtained if test resolves to null</li>
</ul>
<p>I you have some time, check them out and if you find them important enough, <strong>please vote</strong>! Deadline is Tuesday, April 19th, in the evening.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2011/04/jsf-2-2-vote-for-your-top-5-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to wrap a ValueExpression in EL 1.0 and 2.2</title>
		<link>http://www.jakobk.com/2010/12/how-to-wrap-a-valueexpression-in-el-1-0-and-2-2/</link>
		<comments>http://www.jakobk.com/2010/12/how-to-wrap-a-valueexpression-in-el-1-0-and-2-2/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 17:47:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsf 2.0]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=170</guid>
		<description><![CDATA[The problem
A new Class was introduced in the EL API 2.2: javax.el.ValueReference. In addition javax.el.ValueExpression now provides the following method:

public ValueReference getValueReference(ELContext context)
{
    return null;
}

This makes wrapping of a javax.el.ValueExpression (which is actually a very common thing in projects like MyFaces or OpenWebBeans) not really an easy task if you have to [...]]]></description>
			<content:encoded><![CDATA[<h3>The problem</h3>
<p>A new Class was introduced in the EL API 2.2: <code>javax.el.ValueReference</code>. In addition <code>javax.el.ValueExpression</code> now provides the following method:</p>
<pre class="brush: java;">
public ValueReference getValueReference(ELContext context)
{
    return null;
}
</pre>
<p>This makes wrapping of a <code>javax.el.ValueExpression</code> (which is actually a very common thing in projects like MyFaces or OpenWebBeans) not really an easy task if you have to support both EL versions in one project, because there are a lot of unanswered questions:</p>
<ul>
<li>Which EL version should I use to compile the code?</li>
<li>Should the ValueExpression wrapper implement getValueReference()?</li>
<li>Do I need one wrapper or two?</li>
<li>How can I even determine the EL version at runtime?</li>
<li>&#8230;</li>
</ul>
<p>To find a solution for this problem we have to take a closer look at the Java classloading mechanism:</p>
<h3>What does the ClassLoader do?</h3>
<p>After a lot of experimenting with different classpath configurations, I found out some pretty interesting things. For the experiments I used the following custom ValueExpression implementation:</p>
<pre class="brush: java;">
import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.el.ValueReference;

/**
 * @author Jakob Korherr
 */
public class MyValueExpression extends ValueExpression
{

    @Override
    public ValueReference getValueReference(ELContext context)
    {
        return new ValueReference(&quot;base&quot;, &quot;property&quot;);
    }

    @Override
    public String toString()
    {
        return &quot;toString() of MyValueExpression&quot;;
    }

    @Override
    public Object getValue(ELContext context)
    {
        return null;
    }

    @Override
    public void setValue(ELContext context, Object value)
    {
    }

    // ... other methods cut for clarity ...

}
</pre>
<p>Of course, you must compile this class using EL 2.2, because otherwise <code>javax.el.ValueReference</code> will not be present and you will get a compile error.</p>
<p>Now if you use this custom ValueExpression in any scenario in an EL 2.2 environment, everything will work just fine. However, the interesting part is using this class in an EL 1.0 environment, because here <code>javax.el.ValueReference</code> is NOT available.</p>
<p>At first I thought I will get a NoClassDefFoundError as soon as I use a MyValueExpression instance with EL 1.0. Thus I created the following test:</p>
<pre class="brush: java;">
public static void main(String... args)
{
    ValueExpression m = new MyValueExpression();
    System.out.println(m);
}
</pre>
<p>However, it went well and I got &#8220;toString() of MyValueExpression&#8221; although my class references <code>javax.el.ValueReference</code>, which was not on the classpath.</p>
<p>Then I added <code>private ValueReference valueReference;</code> to MyValueExpression and ran the test again. To my surprise, it worked well again!</p>
<p>After a lot of tests, I found out just 2 scenarios which did not work with EL 1.0:</p>
<p><strong>1) Calling a method on MyValueExpression which creates a new ValueReference or tries to call methods of it</strong>.  OK, this can obviously not work with EL 1.0. You will get a <code>java.lang.NoClassDefFoundError: javax/el/ValueReference</code></p>
<p><strong>2) Calling m.getValueReference()</strong>. Here you will get the following error, because obviously this method is not available in EL 1.0: <code>java.lang.NoSuchMethodError: javax.el.ValueExpression.getValueReference(Ljavax/el/ELContext;)Ljavax/el/ValueReference;</code></p>
<h3>Solution</h3>
<p>Because of the above findings you can just use EL 2.2 as compile dependency in your project and everything will work just fine also with EL 1.0, as long as you:</p>
<p><strong>1) do not call ValueExpression.getValueReference()<br />
2) do not call any method on ValueReference<br />
3) do not create an instance of ValueReference</strong></p>
<p>&#8230;outside of the <code>getValueReference()</code> method of your <code>javax.el.ValueExpression</code> implementation. Inside this method, you can do all of the above, because you will only get into this method if you&#8217;re using EL 2.2 at runtime!</p>
<p>Thus you can use this wrapper without any problems on EL 1.0:</p>
<pre class="brush: java;">
import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.el.ValueReference;

/**
 * @author Jakob Korherr
 */
public class ValueExpressionWrapper extends ValueExpression
{

    private ValueExpression wrapped;

    public ValueExpressionWrapper(ValueExpression wrapped)
    {
        this.wrapped = wrapped;
    }

    @Override
    public ValueReference getValueReference(ELContext context)
    {
        // You will only get here if EL 2.2 is available at runtime.
        // Thus you can use ValueReference without any problems!
        return wrapped.getValueReference(context);
    }

    @Override
    public Object getValue(ELContext context)
    {
        return wrapped.getValue(context);
    }

    @Override
    public void setValue(ELContext context, Object value)
    {
        wrapped.setValue(context, value);
    }

    // ... other methods cut for clarity ...

}
</pre>
<p>Using this wrapper in a pure EL 2.2 environment will not cause any problems when calling getValueReference() on the wrapper, because <code>javax.el.ValueReference</code> is provided by EL 2.2 at runtime.</p>
<p>Using this wrapper in a pure EL 1.0 environment will have the effect that <code>getValueReference()</code> is not visible at runtime and thus it will never get called and not cause any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2010/12/how-to-wrap-a-valueexpression-in-el-1-0-and-2-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mac OS X search-styled JTextField</title>
		<link>http://www.jakobk.com/2010/12/mac-os-x-search-styled-jtextfield/</link>
		<comments>http://www.jakobk.com/2010/12/mac-os-x-search-styled-jtextfield/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 19:06:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=162</guid>
		<description><![CDATA[Working on some design stuff for university, I found out a very convenient way to get a Mac OS X search-style textfield (like you find in _every_ Mac application) out of a standard JTextField.
Running a Swing application on Mac OS X Java, you normally use the Mac look-and-feel com.apple.laf.AquaLookAndFeel out of the box. The UI [...]]]></description>
			<content:encoded><![CDATA[<p>Working on some design stuff for university, I found out a very convenient way to get a Mac OS X search-style textfield (like you find in _every_ Mac application) out of a standard JTextField.</p>
<p>Running a Swing application on Mac OS X Java, you normally use the Mac look-and-feel <code>com.apple.laf.AquaLookAndFeel</code> out of the box. The UI classes of this look-and-feel support various client properties, which can be set via <code>putClientProperty(Object key, Object value)</code> on every JComponent. Now, to get a search-style for your JTextField you just have to set the following property:</p>
<pre class="brush: java;">jTextField.putClientProperty(&quot;JTextField.variant&quot;, &quot;search&quot;);</pre>
<p>And now your plain old JTextField looks like this:</p>
<p><img src="http://www.jakobk.com/wp-content/uploads/2010/12/search-jtextfield.png" alt="Mac-style search field" title="search-jtextfield" width="175" height="30" class="aligncenter size-full wp-image-164" /></p>
<p>In addition, there are a lot of other client properties, which can help you in building Mac OS X-style applications in Swing: <a href="http://developer.apple.com/library/mac/#technotes/tn2007/tn2196.html">http://developer.apple.com/library/mac/#technotes/tn2007/tn2196.html</a></p>
<p>Unfortunately this will only work when running the aforementioned Apple look-and-feel on a Mac OS X Java runtime environment (which will most likely be not available for > Java 6).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2010/12/mac-os-x-search-styled-jtextfield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSR-314 extended expert group</title>
		<link>http://www.jakobk.com/2010/10/jsr-314-extended-expert-group/</link>
		<comments>http://www.jakobk.com/2010/10/jsr-314-extended-expert-group/#comments</comments>
		<pubDate>Sun, 31 Oct 2010 15:24:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=157</guid>
		<description><![CDATA[Since this week I am allowed to post to the jsr-314-open mailing list and thus considered a member of the JSR-314 extended expert group. I am very happy with this, because I can finally raise my concerns with JSF 2.0 and 2.1 and also join some interesting discussions.
I already started a thread about the targets [...]]]></description>
			<content:encoded><![CDATA[<p>Since this week I am allowed to post to the jsr-314-open mailing list and thus considered a member of the JSR-314 extended expert group. I am very happy with this, because I can finally raise my concerns with JSF 2.0 and 2.1 and also join some interesting discussions.</p>
<p>I already started a thread about the targets attribute of composite components. I kinda consider it an epic fail, and I already got consent of other EG members. Check it out: <a href="http://lists.jboss.org/pipermail/jsr-314-open-mirror/2010-October/000604.html ">http://lists.jboss.org/pipermail/jsr-314-open-mirror/2010-October/000604.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2010/10/jsr-314-extended-expert-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>create annotation instances at runtime</title>
		<link>http://www.jakobk.com/2010/09/create-annotation-instances-at-runtime/</link>
		<comments>http://www.jakobk.com/2010/09/create-annotation-instances-at-runtime/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 10:20:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[cdi]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.jakobk.com/?p=146</guid>
		<description><![CDATA[Yesterday I stumbled upon an easy way to create annotation instances at runtime: javax.enterprise.util.AnnotationLiteral
This util class from CDI (JSR-299) implements all standard methods (toString(), equals(), hashCode(), annotationType()) just like an annotation instance created by Java would. Thus there is no real difference between subclasses from this class and the annotations created by the JRE.
Here you [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I stumbled upon an easy way to create annotation instances at runtime: <strong>javax.enterprise.util.AnnotationLiteral</strong></p>
<p>This util class from CDI (<a href="http://jcp.org/en/jsr/detail?id=299" target="_blank">JSR-299</a>) implements all standard methods (toString(), equals(), hashCode(), annotationType()) just like an annotation instance created by Java would. Thus there is no real difference between subclasses from this class and the annotations created by the JRE.</p>
<p>Here you can find the source code of AnnotationLiteral from Apache Geronimo Specs: <a href="http://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-jcdi_1.0_spec/src/main/java/javax/enterprise/util/AnnotationLiteral.java" target="_blank">AnnotationLiteral.java</a></p>
<h3>Example</h3>
<p>For example you have the following annotation (which is also a CDI qualifier):</p>
<pre>
<pre class="brush: java;">
@Target({PARAMETER, FIELD, METHOD, CONSTRUCTOR, TYPE})
@Retention(RUNTIME)
@Documented

@Qualifier
public @interface ConversationQualifier1
{
    String value();
}
</pre>
</pre>
<p>If you want to create an instance of it with a certain value at runtime, just create the following class:</p>
<pre>
<pre class="brush: java;">
public class MyConversationQualifier1
    extends AnnotationLiteral&lt;ConversationQualifier1&gt;
    implements ConversationQualifier1
{

    public String value()
    {
        return &quot;my assigned value&quot;;
    }
}
</pre>
</pre>
<p>Now you just need to create an instance of it and you can use it like any other annotation instance created by Java.</p>
<pre>
<pre class="brush: java;">
Annotation a = new MyConversationQualifier1();
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jakobk.com/2010/09/create-annotation-instances-at-runtime/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

