本文整理汇总了Java中org.apache.wicket.NonResettingRestartException类的典型用法代码示例。如果您正苦于以下问题:Java NonResettingRestartException类的具体用法?Java NonResettingRestartException怎么用?Java NonResettingRestartException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NonResettingRestartException类属于org.apache.wicket包,在下文中一共展示了NonResettingRestartException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDefaultResponsePageIfNecessary
import org.apache.wicket.NonResettingRestartException; //导入依赖的package包/类
private void setDefaultResponsePageIfNecessary()
{
// This does not work because it was Spring Security that intercepted the access, not
// Wicket continueToOriginalDestination();
String redirectUrl = getRedirectUrl();
if (redirectUrl == null || redirectUrl.contains(".IBehaviorListener.")
|| redirectUrl.contains("-logoutPanel-")) {
log.debug("Redirecting to welcome page");
setResponsePage(getApplication().getHomePage());
}
else {
log.debug("Redirecting to saved URL: [{}]", redirectUrl);
if (isNotBlank(form.urlfragment) && form.urlfragment.startsWith("!")) {
Url url = Url.parse("http://dummy?" + form.urlfragment.substring(1));
UrlRequestParametersAdapter adapter = new UrlRequestParametersAdapter(url);
LinkedHashMap<String, StringValue> params = new LinkedHashMap<>();
for (String name : adapter.getParameterNames()) {
params.put(name, adapter.getParameterValue(name));
}
Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, params);
}
throw new NonResettingRestartException(redirectUrl);
}
}
示例2: loginButtonOnSubmit
import org.apache.wicket.NonResettingRestartException; //导入依赖的package包/类
private void loginButtonOnSubmit(Button button) {
boolean valid = Session.get().signIn(this.login, this.password);
if (valid) {
if (this.originalUrl != null) {
String url = RequestCycle.get().getUrlRenderer().renderUrl(this.originalUrl);
throw new NonResettingRestartException(url);
} else {
setResponsePage(getApplication().getHomePage());
}
} else {
this.loginField.error(new ValidationError().addKey("incorrect"));
this.passwordField.error(new ValidationError().addKey("incorrect"));
}
}
示例3: export
import org.apache.wicket.NonResettingRestartException; //导入依赖的package包/类
private FileResourceStream export()
{
File downloadFile = null;
String username = state.getObject().getMode()
.equals(Mode.AUTOMATION)
&& preferences.getObject().documentType
.equals(SELECTEXPORT.AUTOMATED.toString()) ? "CORRECTION_USER"
: SecurityContextHolder.getContext().getAuthentication()
.getName();
try {
downloadFile = importExportService.exportAnnotationDocument(
state.getObject().getDocument(), username,
importExportService.getWritableFormats()
.get(importExportService
.getWritableFormatId(preferences.getObject().format)),
state.getObject().getDocument().getName(),
state.getObject().getMode());
}
catch (Exception e) {
LOG.error("Export failed", e);
error("Export failed:" + ExceptionUtils.getRootCauseMessage(e));
// This will cause the open dialog to pop up again, but at least
// the error feedback message will be visible. With the
// RestartResponseException the feedback message only flashes.
throw new NonResettingRestartException(getPage().getPageClass());
}
return new FileResourceStream(downloadFile);
}
示例4: HomePage
import org.apache.wicket.NonResettingRestartException; //导入依赖的package包/类
public HomePage(final PageParameters parameters) {
super(parameters);
StringBuilder redirectUrl = new StringBuilder("/app/");
if (!parameters.get("errorMessage").isNull()) {
redirectUrl.append("#!self?errorMessage=");
appendMessage(redirectUrl, parameters.get("errorMessage").toString());
} else if (!parameters.get("successMessage").isNull()) {
redirectUrl.append("#!self?successMessage=");
appendMessage(redirectUrl, parameters.get("successMessage").toString());
}
throw new NonResettingRestartException(redirectUrl.toString());
}