本文整理汇总了Java中com.vaadin.server.VaadinRequest.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java VaadinRequest.getParameter方法的具体用法?Java VaadinRequest.getParameter怎么用?Java VaadinRequest.getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.server.VaadinRequest
的用法示例。
在下文中一共展示了VaadinRequest.getParameter方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public void init(VaadinRequest request) {
logger.info("New Vaadin UI created");
String invitation = request.getParameter("invitation");
logger.info("Invitation: {} of sessions : {}", invitation);
setSizeFull();
GazpachoViewDisplay viewDisplay = new GazpachoViewDisplay();
setContent(viewDisplay);
navigator = new Navigator(this, (ViewDisplay) viewDisplay);
navigator.addProvider(viewProvider);
navigator.setErrorProvider(new GazpachoErrorViewProvider());
if (isUserSignedIn()) {
navigator.navigateTo(QuestionnaireView.NAME);
} else {
navigator.navigateTo(LoginView.NAME);
}
}
示例2: initializeLocale
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
public static void initializeLocale(VaadinRequest request) {
WrappedSession session = request.getWrappedSession();
HttpSession httpSession = ((WrappedHttpSession) session).getHttpSession();
ServletContext servletContext = httpSession.getServletContext();
String defaultLanguage = servletContext.getInitParameter(LOCALE_CONFIG_DEFAULT_LANGUAGE);
defaultLocale = new Locale(defaultLanguage);
String language = request.getParameter(LOCALE_PARAM_LANGUAGE);
if (null == language) {
currentLocale = defaultLocale;
} else {
currentLocale = new Locale(language);
}
Messages.initMessageSource(currentLocale);
}
示例3: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
String attr;
OAuthData data;
if ((attr=request.getParameter(DATA_PARAM_NAME))==null) {
throw new IllegalStateException(
String.format("No URI parameter named \"%s\".\n", DATA_PARAM_NAME) +
"Please use OAuthPopupButton or some of its subclass to open OAuthPopup.");
}
else if ((data = (OAuthData) getSession().getAttribute(attr))==null) {
throw new IllegalStateException(
String.format("No session attribute named \"%s\" found.\n", attr) +
"Please use OAuthPopupButton or some of its subclass to open OAuthPopup.");
}
else {
Token requestToken = data.createNewRequestToken();
addCallbackHandler(requestToken, data);
goToAuthorizationUrl(requestToken, data);
}
}
示例4: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
if (request.getParameter("treetable") != null) {
setContent(new ContextMenuTreeTable());
} else {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
layout.addComponent(createVaadin7Grid());
}
}
示例5: initParameters
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
private void initParameters(VaadinRequest request) {
tokenString = request.getParameter(TOKEN_PARAMETER);
String fullScreen = request.getParameter(FULLSCREEN_PARAMETER);
if (fullScreen != null && !"false".equalsIgnoreCase(fullScreen)) {
requestFullscreen = true;
}
String canBack = request.getParameter(BACK_PARAMETER);
if (null == canBack || !"true".equalsIgnoreCase(canBack)) {
requestBack = false;
} else {
requestBack = true;
}
}
示例6: createRequestHandler
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
/**
* Creates the parameter handler that will be invoked when the user returns
* from the OAuth service.
*
* @return the parameter handler
*/
protected RequestHandler createRequestHandler() {
return new RequestHandler() {
public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response)
throws IOException {
if (request.getParameterMap().containsKey(getVerifierName())) {
String v = request.getParameter(getVerifierName());
Verifier verifier = new Verifier(v);
accessToken = service
.getAccessToken(requestToken, verifier);
User user = getUser();
VaadinSession.getCurrent().removeRequestHandler(handler);
handler = null;
//String url = getAuthUrl();
//callbackPage.open(url, "Authentificate", 400, 300, BorderStyle.DEFAULT);
authListener.userAuthenticated(user);
} else if (getFailureParameters() != null) {
for (String key : getFailureParameters()) {
if (request.getParameterMap().containsKey(key)) {
authListener.failed(request.getParameter(key));
break;
}
}
}
return true;
}
};
}
示例7: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@SuppressWarnings("serial")
@Override
protected void init(VaadinRequest request) {
getUI().setLocale(BBPlay.getLanguage(request.getLocale().getLanguage()));
I18n.init(i18n);
getPage().setTitle("BBPlay");
String token = request.getParameter("token");
if (token == null || token.isEmpty()) {
BBPlay.error(I18n.t("noToken"));
return;
}
User user = userService.checkToken(token);
if (user == null) {
BBPlay.error(I18n.t("wrongPasswordToken"));
return;
}
FormLayout loginForm = new FormLayout();
loginForm.setSizeUndefined();
passwordField = new PasswordField(I18n.t("changePassword.new"));
passwordFieldRepeat = new PasswordField(I18n.t("changePassword.confirm"));
passwordFieldRepeat.setImmediate(false);
passwordFieldRepeat.addValidator(new AbstractStringValidator(I18n
.t("changePassword.errorMatch")) {
@Override
protected boolean isValidValue(String value) {
return value.equals(passwordField.getValue());
}
});
reset = new Button(I18n.t("reset"));
loginForm.addComponent(passwordField);
loginForm.addComponent(passwordFieldRepeat);
loginForm.addComponent(reset);
reset.addStyleName(ValoTheme.BUTTON_PRIMARY);
reset.setClickShortcut(ShortcutAction.KeyCode.ENTER);
reset.addClickListener(event -> reset(user));
VerticalLayout loginLayout = new VerticalLayout();
loginLayout.setSpacing(true);
loginLayout.setSizeUndefined();
loginLayout.addComponent(loginForm);
loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);
VerticalLayout rootLayout = new VerticalLayout(loginLayout);
rootLayout.setSizeFull();
rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
setContent(rootLayout);
setSizeFull();
}
示例8: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
if (!(SecurityContextHolder.getContext().getAuthentication() instanceof AnonymousAuthenticationToken)) {
getUI().getPage().setLocation("/#!");
}
getUI().setLocale(BBPlay.getLanguage(request.getLocale().getLanguage()));
I18n.init(i18n);
getPage().setTitle("BBPlay");
FormLayout loginForm = new FormLayout();
loginForm.setSizeUndefined();
userName = new TextField(I18n.t("username"));
passwordField = new PasswordField(I18n.t("password"));
rememberMe = new CheckBox(I18n.t("rememberMe"));
login = new Button(I18n.t("login"));
forgetPassword = new Button(I18n.t("forgetPassword"));
loginForm.addComponent(userName);
loginForm.addComponent(passwordField);
loginForm.addComponent(new LanguageComboBox(getUI().getLocale()));
loginForm.addComponent(rememberMe);
loginForm.addComponent(login);
loginForm.addComponent(forgetPassword);
forgetPassword.addStyleName(ValoTheme.BUTTON_LINK);
forgetPassword.addClickListener(event -> UI.getCurrent().addWindow(new ForgetPasswordWindow(userService)));
login.addStyleName(ValoTheme.BUTTON_PRIMARY);
login.setDisableOnClick(true);
login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
login.addClickListener(event -> login());
VerticalLayout loginLayout = new VerticalLayout();
loginLayout.setSpacing(true);
loginLayout.setSizeUndefined();
loginLayout.addComponent(msgLabel = new Label());
loginLayout.setComponentAlignment(msgLabel, Alignment.BOTTOM_CENTER);
msgLabel.setSizeUndefined();
msgLabel.setVisible(false);
if (request.getParameter("logout") != null) {
msgLabel.setValue(I18n.t("loggedOut"));
msgLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
msgLabel.setVisible(true);
}
if (request.getParameter("changed") != null) {
msgLabel.setValue(I18n.t("changePassword.success"));
msgLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
msgLabel.setVisible(true);
}
loginLayout.addComponent(loginForm);
loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);
VerticalLayout rootLayout = new VerticalLayout(loginLayout);
rootLayout.setSizeFull();
rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
setContent(rootLayout);
setSizeFull();
}
示例9: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
setLocale(Locale.ENGLISH);
FormLayout loginForm = new FormLayout();
loginForm.setSizeUndefined();
loginForm.addComponent(userName = new TextField("Username"));
loginForm.addComponent(passwordField = new PasswordField("Password"));
loginForm.addComponent(rememberMe = new CheckBox("Remember me"));
loginForm.addComponent(login = new Button("Login"));
login.addStyleName(ValoTheme.BUTTON_PRIMARY);
login.setDisableOnClick(true);
login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
login.addClickListener(new Button.ClickListener() {
/**
*
*/
private static final long serialVersionUID = 7813011112417170727L;
@Override
public void buttonClick(Button.ClickEvent event) {
login();
}
});
VerticalLayout loginLayout = new VerticalLayout();
loginLayout.setSpacing(true);
loginLayout.setSizeUndefined();
if (request.getParameter("logout") != null) {
loggedOutLabel = new Label("You have been logged out!");
loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
loggedOutLabel.setSizeUndefined();
loginLayout.addComponent(loggedOutLabel);
loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
}
loginLayout.addComponent(loginFailedLabel = new Label());
loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
loginFailedLabel.setSizeUndefined();
loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
loginFailedLabel.setVisible(false);
loginLayout.addComponent(loginForm);
loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);
VerticalLayout rootLayout = new VerticalLayout(loginLayout);
rootLayout.setSizeFull();
rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
setContent(rootLayout);
setSizeFull();
}
示例10: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
getPage().setTitle("Vaadin Shared Security Demo Login");
FormLayout loginForm = new FormLayout();
loginForm.setSizeUndefined();
userName = new TextField("Username");
passwordField = new PasswordField("Password");
rememberMe = new CheckBox("Remember me");
login = new Button("Login");
loginForm.addComponent(userName);
loginForm.addComponent(passwordField);
loginForm.addComponent(rememberMe);
loginForm.addComponent(login);
login.addStyleName(ValoTheme.BUTTON_PRIMARY);
login.setDisableOnClick(true);
login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
login.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
login();
}
});
VerticalLayout loginLayout = new VerticalLayout();
loginLayout.setSpacing(true);
loginLayout.setSizeUndefined();
if (request.getParameter("logout") != null) {
loggedOutLabel = new Label("You have been logged out!");
loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
loggedOutLabel.setSizeUndefined();
loginLayout.addComponent(loggedOutLabel);
loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
}
loginLayout.addComponent(loginFailedLabel = new Label());
loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
loginFailedLabel.setSizeUndefined();
loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
loginFailedLabel.setVisible(false);
loginLayout.addComponent(loginForm);
loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);
VerticalLayout rootLayout = new VerticalLayout(loginLayout);
rootLayout.setSizeFull();
rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
setContent(rootLayout);
setSizeFull();
}
示例11: handleRequest
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response) throws IOException {
if (!data.isCallbackForMe(request)) {
return false;
}
String verifier = request.getParameter(data.getVerifierParameterName());
if (verifier != null) {
// Got verifier!
data.setVerifier(requestToken, new Verifier(verifier));
finish(session, response);
return true;
}
// No verifier in the parameters. That's most likely because the user
// denied the OAuth.
// TODO: current error message reporting (below) is not very useful
String error = null;
for (String errorName : data.getErrorParameterNames()) {
error = request.getParameter(errorName);
if (error != null) {
break;
}
}
String errorMessage;
if (error==null) {
errorMessage = "OAuth failed.";
}
else {
errorMessage = "OAuth denied: " + error;
}
data.setDenied(errorMessage);
finish(session, response);
return true;
}
示例12: extractIdFromCallback
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public String extractIdFromCallback(VaadinRequest request) {
return request.getParameter(CALLBACK_ID_NAME);
}