You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2009/01/15 18:37:29 UTC
svn commit: r734763 - in /tapestry/tapestry5/trunk:
tapestry-core/src/main/java/org/apache/tapestry5/services/
tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/
tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/
ta...
Author: hlship
Date: Thu Jan 15 09:37:28 2009
New Revision: 734763
URL: http://svn.apache.org/viewvc?rev=734763&view=rev
Log:
TAP5-443: Clicking an action link when using tapestry-upload always throws an exception
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceResourcesImpl.java
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/UploadExceptionFilter.java
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=734763&r1=734762&r2=734763&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Thu Jan 15 09:37:28 2009
@@ -1286,7 +1286,7 @@
* Builds the component action request handler for traditional (non-Ajax) requests. These typically result in a
* redirect to a Tapestry render URL.
*/
- @Marker(Traditional.class)
+ @Marker({ Traditional.class, Primary.class })
public ComponentEventRequestHandler buildComponentEventRequestHandler(
List<ComponentEventRequestFilter> configuration, Logger logger,
@Autobuild ComponentEventRequestHandlerImpl terminator)
@@ -1300,7 +1300,7 @@
* pipeline} around {@link org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler}. Filters on the
* request handler are supported here as well.
*/
- @Marker(Ajax.class)
+ @Marker({ Ajax.class, Primary.class })
public ComponentEventRequestHandler buildAjaxComponentEventRequestHandler(
List<ComponentEventRequestFilter> configuration, Logger logger,
@Autobuild AjaxComponentEventRequestHandler terminator)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceResourcesImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceResourcesImpl.java?rev=734763&r1=734762&r2=734763&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceResourcesImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceResourcesImpl.java Thu Jan 15 09:37:28 2009
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
import org.apache.tapestry5.ioc.OperationTracker;
import org.apache.tapestry5.ioc.ServiceBuilderResources;
import org.apache.tapestry5.ioc.def.ServiceDef;
-import static org.apache.tapestry5.ioc.internal.util.Defense.notNull;
+import org.apache.tapestry5.ioc.internal.util.Defense;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.ioc.internal.util.Invokable;
import org.apache.tapestry5.ioc.services.ClassFactory;
@@ -138,20 +138,29 @@
}
@Override
- public <T> T autobuild(Class<T> clazz)
+ public <T> T autobuild(final Class<T> clazz)
{
- notNull(clazz, "clazz");
+ Defense.notNull(clazz, "clazz");
- Constructor constructor = InternalUtils.findAutobuildConstructor(clazz);
+ return registry.invoke("Autobuilding instance of class " + clazz.getName(),
+ new Invokable<T>()
+ {
+ public T invoke()
+ {
+ Constructor constructor = InternalUtils.findAutobuildConstructor(clazz);
- if (constructor == null)
- throw new RuntimeException(IOCMessages.noAutobuildConstructor(clazz));
+ if (constructor == null)
+ throw new RuntimeException(IOCMessages.noAutobuildConstructor(clazz));
- String description = classFactory.getConstructorLocation(constructor).toString();
+ String description = classFactory.getConstructorLocation(constructor).toString();
- ObjectCreator creator = new ConstructorServiceCreator(this, description, constructor);
+ ObjectCreator creator = new ConstructorServiceCreator(ServiceResourcesImpl.this,
+ description,
+ constructor);
- return clazz.cast(creator.createObject());
+ return clazz.cast(creator.createObject());
+ }
+ });
}
public OperationTracker getTracker()
Modified: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/UploadExceptionFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/UploadExceptionFilter.java?rev=734763&r1=734762&r2=734763&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/UploadExceptionFilter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/UploadExceptionFilter.java Thu Jan 15 09:37:28 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2009 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
import org.apache.commons.fileupload.FileUploadException;
import org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper;
+import org.apache.tapestry5.ioc.annotations.Primary;
import org.apache.tapestry5.runtime.Component;
import org.apache.tapestry5.services.*;
import org.apache.tapestry5.upload.services.MultipartDecoder;
@@ -35,7 +36,8 @@
private ComponentSource componentSource;
- public UploadExceptionFilter(MultipartDecoder decoder, @Traditional ComponentEventResultProcessor resultProcessor,
+ public UploadExceptionFilter(MultipartDecoder decoder,
+ @Traditional @Primary ComponentEventResultProcessor resultProcessor,
ComponentSource componentSource)
{
this.decoder = decoder;
@@ -54,7 +56,7 @@
ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(resultProcessor);
- page.getComponentResources().triggerEvent(UploadEvents.UPLOAD_EXCEPTION, new Object[] {uploadException},
+ page.getComponentResources().triggerEvent(UploadEvents.UPLOAD_EXCEPTION, new Object[] { uploadException },
callback);
// If an event handler exists and returns a value, then the callback will be aborted and a response
Modified: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java?rev=734763&r1=734762&r2=734763&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java Thu Jan 15 09:37:28 2009
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2009 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,7 +17,10 @@
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.FileCleaner;
-import org.apache.tapestry5.ioc.*;
+import org.apache.tapestry5.ioc.Configuration;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.OrderedConfiguration;
+import org.apache.tapestry5.ioc.ScopeConstants;
import org.apache.tapestry5.ioc.annotations.Autobuild;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Scope;
@@ -88,8 +91,7 @@
* upload exception event}.
*/
public static void contributeComponentEventRequestHandler(
- OrderedConfiguration<ComponentEventRequestFilter> configuration,
- ObjectLocator locator)
+ OrderedConfiguration<ComponentEventRequestFilter> configuration)
{
configuration.addInstance("UploadException", UploadExceptionFilter.class, "after:Secure",
"before:Ajax");