Hi All!
I have a strange problem with Zone and maybe you have an idea...
This works as expected in a page (injecting the required services and
return a zone or body/block from an event handler):
@Inject private AjaxResponseRenderer _arr;
@Inject private Request _request;
@InjectComponent(value = "saveButtonZone") private Zone
_zoneSaveButton;
@InjectComponent(value = "eventsZone") private Zone _zone;
1 (zone update):
...
return (_request.isXHR() ? _zoneSaveButton.getBody() : null);
2 (multiple zone update):
...
if (_request.isXHR()) {
_arr.addRender(_zone).addRender(_zoneSaveButton);
}
return null;
Next I wanted to further simply my page by removing _arr and _request
and replaced the "if" by a service method. Therefore my module looks like:
@Scope(ScopeConstants.PERTHREAD)
public static IZoneService buildZoneService(final Request request,
final AjaxResponseRenderer arr)
{
return new ZoneService(request, arr);
}
The service interface is defined as:
import org.apache.tapestry5.Block;
import org.apache.tapestry5.corelib.components.Zone;
public interface IZoneService
{
Object refresh(final Zone... zones);
Block refresh(final Zone zone);
}
The Service implementation is:
import org.apache.tapestry5.Block;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;
public class ZoneService implements IZoneService
{
private final Request _request;
private final AjaxResponseRenderer _arr;
public ZoneService(final Request request, final
AjaxResponseRenderer arr)
{
_request = request;
_arr = arr;
}
@Override
public Object refresh(final Zone... zones)
{
if (_request.isXHR()) {
for (final Zone zone : zones) {
_arr.addRender(zone);
}
}
return null;
}
@Override
public Block refresh(final Zone zone)
{
return (_request.isXHR() ? zone.getBody() : null);
}
}
My Page class changed to:
@Inject private IZoneService _zoneService;
...
return _zoneService.refresh(_zoneSaveButton);
...
But triggering the event now fails with:
java.lang.LinkageError: loader constraint violation: when resolving
interface method
"de.xyz.client.services.util.IZoneService.refresh(Lorg/apache/tapestry5/corelib/components/Zone;)Lorg/apache/tapestry5/Block;"
the class loader (instance of
org/apache/tapestry5/internal/plastic/PlasticClassLoader) of the current
class, de/xyz/client/pages/Homework, and the class loader (instance of
org/eclipse/jetty/webapp/WebAppClassLoader) for resolved class,
de/xyz/client/services/util/IZoneService, have different Class objects
for the type org/apache/tapestry5/corelib/components/Zone used in the
signature
at
de.xyz.client.pages.Homework.advised$onDeleteCheckboxChanged_1309a058b1d86bfa(Homework.java:299)
at
de.xyz.client.pages.Homework$Invocation_onDeleteCheckboxChanged_1309a058b1d86bf9.proceedToAdvisedMethod(Unknown
Source)
at
org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
at
org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice$1.proceed(BridgeClassTransformation.java:339)
at
org.tynamo.security.ShiroAnnotationWorker$1.advise(ShiroAnnotationWorker.java:71)
at
org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:325)
I also tried a static util class passing all required argument to the
static refresh methods instead of a per thread service, but the effect
is the same. Any idea, what's going on here and how to avoid it?
Jens
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org