use of com.github.bordertech.wcomponents.Environment in project wcomponents by BorderTech.
the class InfoDump method dumpWEnvironment.
/**
* Appends the current environment to the console.
*/
private void dumpWEnvironment() {
StringBuffer text = new StringBuffer();
Environment env = getEnvironment();
text.append("\n\nWEnvironment" + "\n------------");
text.append("\nAppId: ").append(env.getAppId());
text.append("\nBaseUrl: ").append(env.getBaseUrl());
text.append("\nHostFreeBaseUrl: ").append(env.getHostFreeBaseUrl());
text.append("\nPostPath: ").append(env.getPostPath());
text.append("\nTargetablePath: ").append(env.getWServletPath());
text.append("\nAppHostPath: ").append(env.getAppHostPath());
text.append("\nThemePath: ").append(env.getThemePath());
text.append("\nStep: ").append(env.getStep());
text.append("\nSession Token: ").append(env.getSessionToken());
text.append("\nFormEncType: ").append(env.getFormEncType());
text.append('\n');
appendToConsole(text.toString());
}
use of com.github.bordertech.wcomponents.Environment in project wcomponents by BorderTech.
the class WWindowInterceptor method serviceRequest.
/**
* Temporarily replaces the environment while the request is being handled.
*
* @param request the request being responded to.
*/
@Override
public void serviceRequest(final Request request) {
// Get window id off the request
windowId = request.getParameter(WWindow.WWINDOW_REQUEST_PARAM_KEY);
if (windowId == null) {
super.serviceRequest(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
// Setup the Environment on the context
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
if (attachWindow) {
attachUI(target.getComponent());
}
UIContextHolder.pushContext(target.getContext());
try {
super.serviceRequest(request);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
}
Aggregations