Seam SVN: r9821 - trunk/build.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-12-22 16:57:41 -0500 (Mon, 22 Dec 2008)
New Revision: 9821
Modified:
trunk/build/root.pom.xml
Log:
JBSEAM-3822
Modified: trunk/build/root.pom.xml
===================================================================
--- trunk/build/root.pom.xml 2008-12-22 21:57:18 UTC (rev 9820)
+++ trunk/build/root.pom.xml 2008-12-22 21:57:41 UTC (rev 9821)
@@ -302,7 +302,7 @@
<artifactId>resteasy-jaxrs</artifactId>
<version>1.0-beta-5</version>
<exclusions>
- <exclusion>
+ <exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
@@ -553,7 +553,7 @@
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
- </dependency>
+ </dependency>
<dependency>
<groupId>javassist</groupId>
@@ -991,16 +991,18 @@
<artifactId>xmlsec</artifactId>
</exclusion>
+ <!--
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
-
+ -->
+ <!--
<exclusion>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</exclusion>
-
+ -->
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
16 years
Seam SVN: r9820 - trunk/build.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-12-22 16:57:18 -0500 (Mon, 22 Dec 2008)
New Revision: 9820
Modified:
trunk/build/default.build.properties
Log:
for 2.1.2
Modified: trunk/build/default.build.properties
===================================================================
--- trunk/build/default.build.properties 2008-12-22 20:00:37 UTC (rev 9819)
+++ trunk/build/default.build.properties 2008-12-22 21:57:18 UTC (rev 9820)
@@ -7,7 +7,7 @@
# ------------
major.version 2
minor.version .1
-patchlevel .1
+patchlevel .2
qualifier -SNAPSHOT
#
# Other program locations
16 years
Seam SVN: r9819 - in trunk: src/wicket/org/jboss/seam/wicket/web and 1 other directory.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 15:00:37 -0500 (Mon, 22 Dec 2008)
New Revision: 9819
Removed:
trunk/src/wicket/org/jboss/seam/wicket/web/WicketExceptionFilter.java
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Wicket.xml
Log:
JBSEAM-3730: WicketExceptionFilter is problematic
Modified: trunk/doc/Seam_Reference_Guide/en-US/Wicket.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Wicket.xml 2008-12-22 16:49:56 UTC (rev 9818)
+++ trunk/doc/Seam_Reference_Guide/en-US/Wicket.xml 2008-12-22 20:00:37 UTC (rev 9819)
@@ -271,15 +271,36 @@
<para>
Seam automatically installs the Wicket filter for you (ensuring that
it is inserted in the correct place for you). But you still need to
- tell Wicket which <code>WebApplication</code> class to use:
+ tell Wicket which <code>WebApplication</code> class to use.
</para>
<programlisting role="XML"><![CDATA[<components xmlns="http://jboss.com/products/seam/components"
- xmlns:wicket="http://jboss.com/products/seam/wicket">
+ xmlns:wicket="http://jboss.com/products/seam/wicket"
+ xsi:schemaLocation=
+ "http://jboss.com/products/seam/wicket
+ http://jboss.com/products/seam/wicket-2.1.xsd">
+
+ <wicket:web-application
+ application-class="org.jboss.seam.example.wicket.WicketBookingApplication" />
+</components]]></programlisting>
- <wicket:web-application application-class="org.jboss.seam.example.wicket.WicketBookingApplication" />
+ <para>
+ In addition, if you plan to use JSF-based pages in the same application as wicket pages, you'll
+ need to ensure that the jsf exception filter is only enabled for jsf urls:
+ </para>
+
+ <programlisting role="XML"><![CDATA[<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:web="http://jboss.com/products/seam/web"
+ xmlns:wicket="http://jboss.com/products/seam/wicket"
+ xsi:schemaLocation=
+ "http://jboss.com/products/seam/web
+ http://jboss.com/products/seam/web-2.1.xsd">
+
+ <!-- Only map the seam jsf exception filter to jsf paths, which we identify with the *.seam path -->
+ <web:exception-filter url-pattern="*.seam"/>
</components]]></programlisting>
-
+
+
<tip>
<para>
Take a look at the Wicket documentation for more on authorization
Deleted: trunk/src/wicket/org/jboss/seam/wicket/web/WicketExceptionFilter.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/web/WicketExceptionFilter.java 2008-12-22 16:49:56 UTC (rev 9818)
+++ trunk/src/wicket/org/jboss/seam/wicket/web/WicketExceptionFilter.java 2008-12-22 20:00:37 UTC (rev 9819)
@@ -1,45 +0,0 @@
-package org.jboss.seam.wicket.web;
-
-import static org.jboss.seam.annotations.Install.FRAMEWORK;
-import static org.jboss.seam.ScopeType.APPLICATION;
-
-import java.io.IOException;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.annotations.web.Filter;
-import org.jboss.seam.web.AbstractFilter;
-
-/**
- * Disable the exception filter when using Wicket (as JSF is an EE library, we
- * can't rely on classDependencies to disable it)
- * @author
- */
-@Scope(APPLICATION)
-@Name("org.jboss.seam.web.exceptionFilter")
-@Install(precedence = FRAMEWORK, classDependencies="org.apache.wicket.Application")
-@BypassInterceptors
-@Filter()
-public class WicketExceptionFilter extends AbstractFilter
-{
-
-
- @Override
- public boolean isDisabled()
- {
- return true;
- }
-
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
- {
-
-
- }
-}
16 years
Seam SVN: r9818 - in trunk/src: wicket/org/jboss/seam/wicket and 1 other directories.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 11:49:56 -0500 (Mon, 22 Dec 2008)
New Revision: 9818
Modified:
trunk/src/main/org/jboss/seam/web/WicketFilter.java
trunk/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java
trunk/src/wicket/org/jboss/seam/wicket/web/WicketFilterInstantiator.java
Log:
JBSEAM-3670: Wicket filter shouldn't unconditionally set up scopes.
Modified: trunk/src/main/org/jboss/seam/web/WicketFilter.java
===================================================================
--- trunk/src/main/org/jboss/seam/web/WicketFilter.java 2008-12-22 16:20:30 UTC (rev 9817)
+++ trunk/src/main/org/jboss/seam/web/WicketFilter.java 2008-12-22 16:49:56 UTC (rev 9818)
@@ -13,19 +13,19 @@
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.Seam;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.core.Init;
import org.jboss.seam.deployment.HotDeploymentStrategy;
-import org.jboss.seam.servlet.ContextualHttpServletRequest;
@Scope(APPLICATION)
@Name("org.jboss.seam.web.wicketFilter")
@@ -49,6 +49,9 @@
private ClassLoader hotDeployClassLoader;
+ /*
+ * Upon initialization and re-initialization, lookup the hot deployment strategy and grab its classloader, if it exists.
+ */
@Observer(value= { "org.jboss.seam.postInitialization","org.jboss.seam.postReInitialization"} )
public void postReInitialization()
{
@@ -65,23 +68,20 @@
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain chain) throws IOException, ServletException
{
+ /* If there is no delegate, we are a no-op filter */
if (delegate==null)
{
chain.doFilter(servletRequest, servletResponse);
}
else
{
- new ContextualHttpServletRequest((HttpServletRequest) servletRequest)
- {
- @Override
- public void process() throws Exception
- {
+ Init init = (Init) ServletLifecycle.getServletContext().getAttribute( Seam.getComponentName(Init.class) );
/*
* We initialize the delegate on the first actual request and any time the
* init timestamp changes, so that the WicketFilter gets reinitialized whenever the
* hot deployment classloader detects changes, enabling wicket components to be hot deployed.
*/
- if (lastInitTime != Init.instance().getTimestamp())
+ if (init != null && lastInitTime != init.getTimestamp())
{
delegate.destroy();
@@ -98,6 +98,10 @@
{
parameters.put("filterMappingUrlPattern", "/*");
}
+
+ /* Let the seam debug flag control the wicket configuration flag (deployment vs. development) */
+ parameters.put("configuration",init.isDebug() ? "development" : "deployment");
+
if (getApplicationFactoryClass() != null)
{
parameters.put("applicationFactoryClassName", getApplicationFactoryClass());
@@ -123,22 +127,24 @@
if (hotDeployClassLoader != null)
Thread.currentThread().setContextClassLoader(previousClassLoader);
}
- lastInitTime = Init.instance().getTimestamp();
+ lastInitTime = init.getTimestamp();
}
delegate.doFilter(servletRequest, servletResponse, chain);
}
-
- }.run();
}
- }
@Override
public void init(FilterConfig filterConfig) throws ServletException
{
super.init(filterConfig);
-
- delegate = (javax.servlet.Filter) Component.getInstance("org.jboss.seam.wicket.web.wicketFilterInstantiator", ScopeType.STATELESS);
- savedConfig = filterConfig;
+ /* Save the configuration so that we can use it to re-initialize the wicket filter at request time, as
+ * we may need to do it again if changes are hot deployed. Also, look up the delegate now, as the presence
+ * of the delegate component implies the presence of the wicket classes themselves.
+ */
+ if (delegate == null) {
+ delegate = (javax.servlet.Filter) Component.getInstance("org.jboss.seam.wicket.web.wicketFilterInstantiator", ScopeType.STATELESS);
+ savedConfig = filterConfig;
+ }
}
public String getApplicationClass()
Modified: trunk/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java 2008-12-22 16:20:30 UTC (rev 9817)
+++ trunk/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java 2008-12-22 16:49:56 UTC (rev 9818)
@@ -1,5 +1,7 @@
package org.jboss.seam.wicket;
+import javax.servlet.http.HttpServletRequest;
+
import org.apache.wicket.IRedirectListener;
import org.apache.wicket.Request;
import org.apache.wicket.RequestCycle;
@@ -10,15 +12,27 @@
import org.apache.wicket.markup.html.form.IOnChangeListener;
import org.apache.wicket.markup.html.link.ILinkListener;
import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.WebRequest;
+import org.apache.wicket.protocol.http.WebRequestCycle;
import org.apache.wicket.protocol.http.WebRequestCycleProcessor;
+import org.apache.wicket.protocol.http.WebResponse;
import org.apache.wicket.protocol.http.WebSession;
import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
import org.apache.wicket.request.IRequestCodingStrategy;
import org.apache.wicket.request.IRequestCycleProcessor;
import org.apache.wicket.request.target.component.IBookmarkablePageRequestTarget;
import org.apache.wicket.request.target.component.listener.IListenerInterfaceRequestTarget;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.Lifecycle;
+import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.core.Conversation;
+import org.jboss.seam.core.ConversationPropagation;
+import org.jboss.seam.core.Events;
import org.jboss.seam.core.Manager;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.servlet.ServletRequestSessionMap;
+import org.jboss.seam.web.ServletContexts;
import org.jboss.seam.wicket.international.SeamStatusMessagesListener;
/**
@@ -30,7 +44,26 @@
public abstract class SeamWebApplication extends WebApplication
{
+ private static final LogProvider log = Logging.getLogProvider(SeamWebApplication.class);
+
/**
+ * When operating in tests, it is sometimes useful to leave the contexts extant
+ * after a request, and destroy them upon the next request, so that models that use injections
+ * can be queried post-request to determine their values.
+ */
+ protected boolean destroyContextsLazily = false;
+
+ public boolean isDestroyContextsLazily()
+ {
+ return destroyContextsLazily;
+ }
+
+ public void setDestroyContextsLazily(boolean destroyContextsLazily)
+ {
+ this.destroyContextsLazily = destroyContextsLazily;
+ }
+
+ /**
* Custom session with invalidation override. We can't just let Wicket
* invalidate the session as Seam might have to do some cleaning up to do.
*/
@@ -136,4 +169,91 @@
protected abstract Class getLoginPage();
+ /*
+ * Override to provide a seam-specific RequestCycle, which sets up seam contexts.
+ */
+ @Override
+ public RequestCycle newRequestCycle(final Request request, final Response response)
+ {
+ return new SeamWebRequestCycle(this, (WebRequest)request, (WebResponse)response);
+ }
+
+
+ /**
+ * A WebRequestCycle that sets up seam requests. Essentially this
+ * is similiar to the work of ContextualHttpServletRequest, but using the wicket API
+ * @author cpopetz
+ *
+ */
+ protected static class SeamWebRequestCycle extends WebRequestCycle {
+
+ public SeamWebRequestCycle(WebApplication application, WebRequest request, Response response)
+ {
+ super(application, request, response);
+ }
+
+ @Override
+ protected void onBeginRequest()
+ {
+ HttpServletRequest httpRequest = ((WebRequest)request).getHttpServletRequest();
+
+ if (Contexts.getEventContext() != null && ((SeamWebApplication)getApplication()).isDestroyContextsLazily() && ServletContexts.instance().getRequest() != httpRequest)
+ {
+ destroyContexts();
+ }
+
+ if (Contexts.getEventContext() == null)
+ {
+ ServletLifecycle.beginRequest(httpRequest);
+ ServletContexts.instance().setRequest(httpRequest);
+ ConversationPropagation.instance().restoreConversationId( request.getParameterMap() );
+ Manager.instance().restoreConversation();
+ ServletLifecycle.resumeConversation(httpRequest);
+ Manager.instance().handleConversationPropagation( request.getParameterMap() );
+
+ // Force creation of the session
+ if (httpRequest.getSession(false) == null)
+ {
+ httpRequest.getSession(true);
+ }
+ }
+ super.onBeginRequest();
+ Events.instance().raiseEvent("org.jboss.seam.wicket.beforeRequest");
+ }
+
+ @Override
+ protected void onEndRequest()
+ {
+ // TODO Auto-generated method stub
+ try
+ {
+ super.onEndRequest();
+ Events.instance().raiseEvent("org.jboss.seam.wicket.afterRequest");
+ }
+ finally
+ {
+ if (Contexts.getEventContext() != null && !((SeamWebApplication)getApplication()).isDestroyContextsLazily())
+ {
+ destroyContexts();
+ }
+ }
+ }
+
+ private void destroyContexts()
+ {
+ try {
+ HttpServletRequest httpRequest = ((WebRequest)request).getHttpServletRequest();
+ Manager.instance().endRequest( new ServletRequestSessionMap(httpRequest) );
+ ServletLifecycle.endRequest(httpRequest);
+ }
+ catch (Exception e)
+ {
+ /* Make sure we always clear out the thread locals */
+ Lifecycle.endRequest();
+ log.warn("ended request due to exception", e);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
}
Modified: trunk/src/wicket/org/jboss/seam/wicket/web/WicketFilterInstantiator.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/web/WicketFilterInstantiator.java 2008-12-22 16:20:30 UTC (rev 9817)
+++ trunk/src/wicket/org/jboss/seam/wicket/web/WicketFilterInstantiator.java 2008-12-22 16:49:56 UTC (rev 9818)
@@ -1,6 +1,3 @@
-/**
- *
- */
package org.jboss.seam.wicket.web;
import static org.jboss.seam.annotations.Install.BUILT_IN;
@@ -25,12 +22,20 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Lifecycle;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.web.FilterConfigWrapper;
import org.jboss.seam.wicket.WebApplication;
import org.jboss.seam.wicket.ioc.WicketClassLoader;
+/**
+ * This component wraps the WicketFilter, encapsulates the class dependencies
+ * upon the wicket library, and propogates the configuration from seam's own
+ * WicketFilter, specified with web:wicket-wilter. It also sets up the WicketClassLoader
+ * to instrument wicket components on the fly, if necessary.
+ *
+ */
@Name("org.jboss.seam.wicket.web.wicketFilterInstantiator")
@Install(precedence = BUILT_IN, classDependencies={"org.apache.wicket.Application"})
@BypassInterceptors
@@ -46,55 +51,70 @@
{
return new WicketFilter()
{
-
private ClassLoader classLoader;
@Override
public void init(FilterConfig filterConfig) throws ServletException
{
- Map<String, String> parameters = new HashMap<String, String>();
- try
- {
-
- ClassLoader parent = Thread.currentThread().getContextClassLoader();
- File dir = getRealFile(filterConfig.getServletContext(), DEFAULT_WICKET_COMPONENT_DIRECTORY_PATH);
- if (dir == null)
+ try
+ {
+ // We need the Application context active in order to lookup the WebApplication component
+ Lifecycle.setupApplication();
+ Map<String, String> parameters = new HashMap<String, String>();
+ try
{
- log.warn("No wicket components directory specified to give Seam super powers to");
- this.classLoader = parent;
+ ClassLoader parent = Thread.currentThread().getContextClassLoader();
+
+ /* if there is a directory specified for which we should instrument wicket components,
+ * create a WicketClassLoader to do that. Otherwise, just use the contextClassLoader
+ */
+ File dir = getRealFile(filterConfig.getServletContext(), DEFAULT_WICKET_COMPONENT_DIRECTORY_PATH);
+ if (dir == null)
+ {
+ log.warn("No wicket components directory specified to give Seam super powers to");
+ this.classLoader = parent;
+ }
+ else
+ {
+ this.classLoader = new WicketClassLoader(Thread.currentThread().getContextClassLoader(), new ClassPool(), dir).instrument();
+ }
}
- else
+ catch (NotFoundException e)
{
- this.classLoader = new WicketClassLoader(Thread.currentThread().getContextClassLoader(), new ClassPool(), dir).instrument();
+ throw new ServletException(e);
}
- }
- catch (NotFoundException e)
- {
- throw new ServletException(e);
- }
- catch (CannotCompileException e)
- {
- throw new ServletException(e);
- }
- catch (ClassNotFoundException e)
- {
- throw new ServletException(e);
- }
- if (filterConfig.getInitParameter("applicationClassName") == null)
- {
- String applicationClass = WebApplication.instance().getApplicationClass();
- if (applicationClass != null)
+ catch (CannotCompileException e)
{
- parameters.put("applicationClassName", applicationClass);
+ throw new ServletException(e);
}
- else
+ catch (ClassNotFoundException e)
{
- throw new IllegalStateException("Must set application-class using <wicket:web-application /> in components.xml");
+ throw new ServletException(e);
}
+ /*
+ * If no applicationClassName has been specified on the filter, use the name specified with
+ * <wicket:web-application/> in components.xml
+ */
+ if (filterConfig.getInitParameter("applicationClassName") == null)
+ {
+ String applicationClass = WebApplication.instance().getApplicationClass();
+ if (applicationClass != null)
+ {
+ parameters.put("applicationClassName", applicationClass);
+ }
+ else
+ {
+ throw new IllegalStateException("Must set application-class using <wicket:web-application /> in components.xml");
+ }
+ }
+ super.init(new FilterConfigWrapper(filterConfig, parameters));
}
- super.init(new FilterConfigWrapper(filterConfig, parameters));
+ finally
+ {
+ Lifecycle.cleanupApplication();
+ }
}
-
+
@Override
protected ClassLoader getClassLoader()
{
16 years
Seam SVN: r9817 - in trunk/src/wicket/org/jboss/seam/wicket: annotations and 1 other directories.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 11:20:30 -0500 (Mon, 22 Dec 2008)
New Revision: 9817
Added:
trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java
Modified:
trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java
Log:
JBSEAM-3663: @Begin can annotate constructors in wicket
Modified: trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java 2008-12-22 16:17:48 UTC (rev 9816)
+++ trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java 2008-12-22 16:20:30 UTC (rev 9817)
@@ -321,6 +321,7 @@
private void add(Constructor<T> constructor)
{
if ( constructor.isAnnotationPresent(Begin.class) ||
+ constructor.isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) ||
constructor.isAnnotationPresent(End.class) ||
constructor.isAnnotationPresent(StartTask.class) ||
constructor.isAnnotationPresent(BeginTask.class) ||
@@ -362,6 +363,7 @@
}
if ( method.isAnnotationPresent(Begin.class) ||
+ method.isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) ||
method.isAnnotationPresent(End.class) ||
method.isAnnotationPresent(StartTask.class) ||
method.isAnnotationPresent(BeginTask.class) ||
Added: trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java (rev 0)
+++ trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java 2008-12-22 16:20:30 UTC (rev 9817)
@@ -0,0 +1,42 @@
+//$Id: Begin.java 6884 2007-12-03 06:26:39Z sbryzak2 $
+package org.jboss.seam.wicket.annotations;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.jboss.seam.annotations.FlushModeType;
+/**
+ * A version of the core @Begin annotation which can be placed on wicket component constructors.
+ * The wicket interceptor will scan for this as well as the default @Begin annotation. They
+ * are identical in function, but java does not allow annotation inheritance. In addition, the
+ * deprecated ifOutcome and id methods have been removed, and the pageflow method as well, as it is
+ * not as yet supported in wicket.
+ */
+@Target({METHOD,CONSTRUCTOR})
+@Retention(RUNTIME)
+@Documented
+public @interface Begin
+{
+ /**
+ * If enabled, and if a conversation is already active,
+ * begin a nested conversation, instead of continuing
+ * in the context of the existing conversation.
+ */
+ boolean nested() default false;
+ /**
+ * If false (the default), invocation of the begin
+ * method in the scope of an existing conversation
+ * will cause an exception to be thrown.
+ */
+ boolean join() default false;
+ /**
+ * Set the FlushMode for any EntityManager used in
+ * this conversation.
+ */
+ FlushModeType flushMode() default FlushModeType.AUTO;
+
+}
Modified: trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java 2008-12-22 16:17:48 UTC (rev 9816)
+++ trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java 2008-12-22 16:20:30 UTC (rev 9817)
@@ -125,6 +125,11 @@
!invocationContext.getAccessibleObject().getAnnotation(Begin.class).join() &&
!invocationContext.getAccessibleObject().getAnnotation(Begin.class).nested()
) ||
+ (
+ invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) &&
+ !invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).join() &&
+ !invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).nested()
+ ) ||
invocationContext.getAccessibleObject().isAnnotationPresent(BeginTask.class) ||
invocationContext.getAccessibleObject().isAnnotationPresent(StartTask.class)
);
@@ -137,6 +142,7 @@
boolean simpleBegin =
invocationContext.getAccessibleObject().isAnnotationPresent(StartTask.class) ||
invocationContext.getAccessibleObject().isAnnotationPresent(BeginTask.class) ||
+ invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) ||
( invocationContext.getAccessibleObject().isAnnotationPresent(Begin.class) && invocationContext.getAccessibleObject().getAnnotation(Begin.class).ifOutcome().length==0 );
if ( simpleBegin )
{
@@ -147,6 +153,10 @@
{
nested = invocationContext.getAccessibleObject().getAnnotation(Begin.class).nested();
}
+ else if ( invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) )
+ {
+ nested = invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).nested();
+ }
beginConversation( nested, getProcessDefinitionName(invocationContext) );
setFlushMode(invocationContext); //TODO: what if conversation already exists? Or a nested conversation?
}
@@ -173,6 +183,10 @@
{
flushMode = invocationContext.getAccessibleObject().getAnnotation(Begin.class).flushMode();
}
+ else if (invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class))
+ {
+ flushMode = invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).flushMode();
+ }
else if (invocationContext.getAccessibleObject().isAnnotationPresent(BeginTask.class))
{
flushMode = invocationContext.getAccessibleObject().getAnnotation(BeginTask.class).flushMode();
16 years
Seam SVN: r9816 - trunk/src/main/org/jboss/seam/web.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 11:17:48 -0500 (Mon, 22 Dec 2008)
New Revision: 9816
Modified:
trunk/src/main/org/jboss/seam/web/RedirectFilter.java
Log:
JBSEAM-3678: RedirectFilter should only act during a faces request
Modified: trunk/src/main/org/jboss/seam/web/RedirectFilter.java
===================================================================
--- trunk/src/main/org/jboss/seam/web/RedirectFilter.java 2008-12-22 16:16:34 UTC (rev 9815)
+++ trunk/src/main/org/jboss/seam/web/RedirectFilter.java 2008-12-22 16:17:48 UTC (rev 9816)
@@ -52,7 +52,9 @@
@Override
public void sendRedirect(String url) throws IOException
{
- if ( Contexts.isEventContextActive() && !Contexts.getEventContext().isSet(REDIRECT_FROM_MANAGER) )
+ if ( FacesContext.getCurrentInstance() != null
+ && Contexts.isEventContextActive()
+ && !Contexts.getEventContext().isSet(REDIRECT_FROM_MANAGER) )
{
if ( !url.startsWith("http:") && !url.startsWith("https:") ) //yew!
{
16 years
Seam SVN: r9815 - trunk/src/wicket/org/jboss/seam/wicket/web.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 11:16:34 -0500 (Mon, 22 Dec 2008)
New Revision: 9815
Modified:
trunk/src/wicket/org/jboss/seam/wicket/web/WicketRedirectFilter.java
Log:
JBSEAM-3679: WicketRedirectFilter should only be active on wicket requests
Modified: trunk/src/wicket/org/jboss/seam/wicket/web/WicketRedirectFilter.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/web/WicketRedirectFilter.java 2008-12-22 16:14:50 UTC (rev 9814)
+++ trunk/src/wicket/org/jboss/seam/wicket/web/WicketRedirectFilter.java 2008-12-22 16:16:34 UTC (rev 9815)
@@ -2,7 +2,6 @@
import static org.jboss.seam.ScopeType.APPLICATION;
import static org.jboss.seam.annotations.Install.FRAMEWORK;
-import static org.jboss.seam.core.Manager.REDIRECT_FROM_MANAGER;
import java.io.IOException;
@@ -13,6 +12,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
+import org.apache.wicket.Application;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@@ -29,7 +29,7 @@
* @author
*/
@Scope(APPLICATION)
-@Name("org.jboss.seam.web.redirectFilter")
+@Name("org.jboss.seam.wicket.web.redirectFilter")
@Install(precedence = FRAMEWORK, classDependencies="org.apache.wicket.Application")
@BypassInterceptors
@Filter
@@ -49,7 +49,7 @@
@Override
public void sendRedirect(String url) throws IOException
{
- if ( Contexts.isEventContextActive() && !Contexts.getEventContext().isSet(REDIRECT_FROM_MANAGER) )
+ if ( Application.exists() && Contexts.isEventContextActive())
{
if ( Contexts.isConversationContextActive() )
{
16 years
Seam SVN: r9814 - trunk/src/wicket/org/jboss/seam/wicket/ioc.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 11:14:50 -0500 (Mon, 22 Dec 2008)
New Revision: 9814
Modified:
trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java
Log:
JBSEAM-3859: Wicket shouldn't instrument classes annotated with @Name
Modified: trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java 2008-12-22 16:12:27 UTC (rev 9813)
+++ trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java 2008-12-22 16:14:50 UTC (rev 9814)
@@ -12,6 +12,7 @@
import javassist.NotFoundException;
import javassist.CtField.Initializer;
+import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.wicket.WicketComponent;
@@ -146,7 +147,26 @@
private static boolean isInstrumentable(CtClass clazz)
{
int modifiers = clazz.getModifiers();
- return !(Modifier.isInterface(modifiers) || Modifier.isEnum(modifiers));
+ if (Modifier.isInterface(modifiers) || Modifier.isEnum(modifiers))
+ {
+ return false;
+ }
+
+ try
+ {
+ for (Object a : clazz.getAnnotations())
+ {
+ if (a instanceof Name)
+ {
+ return false;
+ }
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return true;
}
}
16 years
Seam SVN: r9813 - trunk/src/main/org/jboss/seam/transaction.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 11:12:27 -0500 (Mon, 22 Dec 2008)
New Revision: 9813
Modified:
trunk/src/main/org/jboss/seam/transaction/TransactionInterceptor.java
Log:
JBSEAM-3807: Transactional Attribute doesn't allow override at method level
Modified: trunk/src/main/org/jboss/seam/transaction/TransactionInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/transaction/TransactionInterceptor.java 2008-12-22 16:07:32 UTC (rev 9812)
+++ trunk/src/main/org/jboss/seam/transaction/TransactionInterceptor.java 2008-12-22 16:12:27 UTC (rev 9813)
@@ -104,9 +104,9 @@
private boolean isNewTransactionRequired(Method method, Class beanClass, boolean transactionActive)
{
TransactionMetadata metadata = lookupTransactionMetadata(method);
- if (metadata.isNewTransactionRequired(transactionActive))
+ if (metadata.isAnnotationPresent())
{
- return true;
+ return metadata.isNewTransactionRequired(transactionActive);
}
else
{
16 years
Seam SVN: r9812 - trunk/src/main/org/jboss/seam/init.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2008-12-22 11:07:32 -0500 (Mon, 22 Dec 2008)
New Revision: 9812
Modified:
trunk/src/main/org/jboss/seam/init/Initialization.java
Log:
JBSEAM-3671
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-12-21 13:59:40 UTC (rev 9811)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-12-22 16:07:32 UTC (rev 9812)
@@ -349,7 +349,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Error loading element " + elemName + " with component name " + name + " and component class " + className);
+ throw new RuntimeException("Error loading element " + elemName + " with component name " + name + " and component class " + className,e);
}
//finally, if we could not get the name from the XML name attribute,
16 years