use of org.apache.tapestry5.internal.plastic.asm.Handle in project tapestry-5 by apache.
the class PageRenderRequestHandlerImpl method handle.
public void handle(PageRenderRequestParameters parameters) throws IOException {
Page page = cache.get(parameters.getLogicalPageName());
if (request.getAttribute(InternalConstants.BYPASS_ACTIVATION) == null) {
if (pageActivator.activatePage(page.getRootElement().getComponentResources(), parameters.getActivationContext(), resultProcessor)) {
return;
}
if (!parameters.isLoopback()) {
page.pageReset();
}
}
pageResponseRenderer.renderPageResponse(page);
}
use of org.apache.tapestry5.internal.plastic.asm.Handle in project tapestry-5 by apache.
the class AjaxFilter method handle.
public void handle(ComponentEventRequestParameters parameters, ComponentEventRequestHandler handler) throws IOException {
ComponentEventRequestHandler next = request.isXHR() ? ajaxHandler : handler;
next.handle(parameters);
}
use of org.apache.tapestry5.internal.plastic.asm.Handle in project tapestry-5 by apache.
the class Remapper method mapValue.
/**
* Returns the given value, remapped with this remapper. Possible values are {@link Boolean},
* {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double},
* {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays
* of primitive types .
*
* @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values
* are remapped.
* @return the given value, remapped with this remapper.
*/
public Object mapValue(final Object value) {
if (value instanceof Type) {
return mapType((Type) value);
}
if (value instanceof Handle) {
Handle handle = (Handle) value;
return new Handle(handle.getTag(), mapType(handle.getOwner()), mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()), handle.getTag() <= Opcodes.H_PUTSTATIC ? mapDesc(handle.getDesc()) : mapMethodDesc(handle.getDesc()), handle.isInterface());
}
if (value instanceof ConstantDynamic) {
ConstantDynamic constantDynamic = (ConstantDynamic) value;
int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount];
for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
remappedBootstrapMethodArguments[i] = mapValue(constantDynamic.getBootstrapMethodArgument(i));
}
String descriptor = constantDynamic.getDescriptor();
return new ConstantDynamic(mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor), mapDesc(descriptor), (Handle) mapValue(constantDynamic.getBootstrapMethod()), remappedBootstrapMethodArguments);
}
return value;
}
use of org.apache.tapestry5.internal.plastic.asm.Handle in project tapestry-5 by apache.
the class ComponentEventRequestHandlerImpl method handle.
public void handle(ComponentEventRequestParameters parameters) throws IOException {
Page activePage = cache.get(parameters.getActivePageName());
if (pageActivator.activatePage(activePage.getRootElement().getComponentResources(), parameters.getPageActivationContext(), resultProcessor)) {
return;
}
Page containerPage = cache.get(parameters.getContainingPageName());
TrackableComponentEventCallback callback = new ComponentResultProcessorWrapper(resultProcessor);
environment.push(ComponentEventResultProcessor.class, resultProcessor);
environment.push(TrackableComponentEventCallback.class, callback);
ComponentPageElement element = containerPage.getComponentElementByNestedId(parameters.getNestedComponentId());
boolean handled = element.triggerContextEvent(parameters.getEventType(), parameters.getEventContext(), callback);
if (!handled) {
throw new TapestryException(String.format("Request event '%s' (on component %s) was not handled; you must provide a matching event handler method in the component or in one of its containers.", parameters.getEventType(), element.getCompleteId()), element, null);
}
environment.pop(TrackableComponentEventCallback.class);
environment.pop(ComponentEventResultProcessor.class);
if (callback.isAborted()) {
callback.rethrow();
return;
}
if (!response.isCommitted()) {
resultProcessor.processResultValue(activePage.getName());
}
}
use of org.apache.tapestry5.internal.plastic.asm.Handle in project tapestry-5 by apache.
the class AppModule method setupCustomBaseURLSource.
@Contribute(ServiceOverride.class)
public void setupCustomBaseURLSource(MappedConfiguration<Class, Object> configuration) {
BaseURLSource source = new BaseURLSource() {
public String getBaseURL(boolean secure) {
String protocol = secure ? "https" : "http";
// This is all a bit jury-rigged together. This is for running the app
// interactively; Selenium doesn't seem to handle the transition to https.
int port = secure ? 8443 : 9090;
return String.format("%s://localhost:%d", protocol, port);
}
};
configuration.add(BaseURLSource.class, source);
}
Aggregations