@SuppressWarnings("serial")
@Override
protected VaadinServletRequest buildVaadinRequest(String location) {
return new SpringVaadinServletRequest(request,(VaadinServletService) vaadinSession.getService(),false) {
/*
* (non-Javadoc)
* @see javax.servlet.ServletRequestWrapper#getParameter(java.lang.String)
*/
@Override
public String getParameter(String name) {
if ("v-loc".equals(name)) {
return location;
}
return super.getParameter(name);
}
};
}
项目:holon-vaadin7
文件:AbstractVaadinTest.java
/**
* Build VaadinServletRequest using a location
* @param location Page location
* @return VaadinServletRequest
*/
@SuppressWarnings("serial")
protected VaadinServletRequest buildVaadinRequest(final String location) {
return new VaadinServletRequest(buildHttpServletRequest(),(VaadinServletService) vaadinSession.getService()) {
/*
* (non-Javadoc)
* @see javax.servlet.ServletRequestWrapper#getParameter(java.lang.String)
*/
@Override
public String getParameter(String name) {
if ("v-loc".equals(name)) {
return location;
}
return super.getParameter(name);
}
};
}
项目:osc-core
文件:UiServlet.java
/**
* Every incoming request should set the current user context
*/
@Override
protected VaadinServletRequest createVaadinRequest(HttpServletRequest request) {
VaadinServletRequest vaadinRequest = super.createVaadinRequest(request);
VaadinSession vaadinSession;
try {
vaadinSession = getService().findVaadinSession(vaadinRequest);
} catch (Exception e) {
// This exception will be handled later when we try to service
// the request
vaadinSession = null;
}
if(vaadinSession != null) {
this.userContext.setUser((String) vaadinSession.getAttribute("user"));
} else {
this.userContext.setUser(null);
}
return vaadinRequest;
}
@SuppressWarnings("serial")
@Override
protected VaadinServletRequest buildVaadinRequest(String location) {
return new SpringVaadinServletRequest(request,false) {
/*
* (non-Javadoc)
* @see javax.servlet.ServletRequestWrapper#getParameter(java.lang.String)
*/
@Override
public String getParameter(String name) {
if ("v-loc".equals(name)) {
return location;
}
return super.getParameter(name);
}
};
}
项目:holon-vaadin
文件:AbstractVaadinTest.java
/**
* Build VaadinServletRequest using a location
* @param location Page location
* @return VaadinServletRequest
*/
@SuppressWarnings("serial")
protected VaadinServletRequest buildVaadinRequest(final String location) {
return new VaadinServletRequest(buildHttpServletRequest(),(VaadinServletService) vaadinSession.getService()) {
/*
* (non-Javadoc)
* @see javax.servlet.ServletRequestWrapper#getParameter(java.lang.String)
*/
@Override
public String getParameter(String name) {
if ("v-loc".equals(name)) {
return location;
}
return super.getParameter(name);
}
};
}
项目:cherry-web
文件:ControlServlet.java
@Override
protected boolean isstaticResourceRequest(HttpServletRequest request) {
// set user and trace ...
boolean ret = super.isstaticResourceRequest(request);
if (!ret) {
try {
VaadinServletRequest vs = createVaadinRequest(request);
VaadinSession vaadinSession = getService().findVaadinSession(vs);
request.setAttribute("__vs",vaadinSession);
for (UI ui : vaadinSession.getUIs()) {
if (ui instanceof ControlUi)
((ControlUi)ui).requestBegin(request);
}
} catch (Throwable t) {
}
}
return ret;
}
项目:hypothesis
文件:PublicPacksPresenter.java
private String constructStartUrl(String uid,boolean returnBack) {
StringBuilder builder = new StringBuilder();
String contextUrl = ServletUtil.getContextURL((VaadinServletRequest) VaadinService.getCurrentRequest());
builder.append(contextUrl);
builder.append("/process/?");
// client debug
// builder.append("gwt.codesvr=127.0.0.1:9997&");
builder.append("token=");
builder.append(uid);
builder.append("&fs");
if (returnBack) {
builder.append("&bk=true");
}
String lang = ControlledUI.getCurrentLanguage();
if (lang != null) {
builder.append("&lang=");
builder.append(lang);
}
return builder.toString();
}
项目:minimal-j
文件:MjVaadinServlet.java
@Override
protected VaadinServletRequest createVaadinRequest(HttpServletRequest request) {
VaadinServletRequest vaadinServletRequest = super.createVaadinRequest(request);
Subject.setCurrent((Subject) vaadinServletRequest.getWrappedSession().getAttribute("subject"));
// System.out.println("Set subject to " + (Subject.getCurrent() != null ? Subject.getCurrent().getName() : "-"));
return vaadinServletRequest;
}
项目:ilves
文件:OpenIdUtil.java
/**
* Gets verification result based on session and request parameters. This should be called when
* processing the OpenId return request.
* @param siteUrl the site URL
* @param returnViewName the return view name
*
* @return the verification result
* @throws discoveryException if discovery exception occurs.
* @throws MessageException if message exception occurs.
* @throws AssociationException if association exception occurs.
*/
public static VerificationResult getVerificationResult(final String siteUrl,final String returnViewName) throws MessageException,discoveryException,AssociationException {
final ConsumerManager consumerManager = UI.getCurrent().getSession().getAttribute(ConsumerManager.class);
final discoveryinformation discovered = UI.getCurrent().getSession().getAttribute(
discoveryinformation.class);
UI.getCurrent().getSession().setAttribute(ConsumerManager.class,null);
UI.getCurrent().getSession().setAttribute(discoveryinformation.class,null);
final HttpServletRequest request = ((VaadinServletRequest) VaadinService.getCurrentRequest())
.getHttpServletRequest();
final StringBuffer urlBuilder = new StringBuffer(siteUrl + returnViewName);
final String queryString = request.getQueryString();
if (queryString != null) {
urlBuilder.append('?');
urlBuilder.append(queryString);
}
final String requestUrl = urlBuilder.toString();
final ParameterList openidResp = new ParameterList(request.getParameterMap());
// verify the response
return consumerManager.verify(requestUrl,openidResp,discovered);
}
项目:hypothesis
文件:PublicPacksPresenter.java
private String constructStartJnlp(String uid) {
StringBuilder builder = new StringBuilder();
String contextUrl = ServletUtil.getContextURL((VaadinServletRequest) VaadinService.getCurrentRequest());
builder.append(contextUrl);
builder.append("/resource/browserapplication.jnlp?");
builder.append("jnlp.app_url=");
builder.append(contextUrl);
builder.append("/process/");
builder.append("&jnlp.close_key=");
builder.append("close.html");
builder.append("&jnlp.token=");
builder.append(uid);
return builder.toString();
}
@Override
protected VaadinServletRequest buildVaadinRequest() {
return new SpringVaadinServletRequest(request,false);
}
@Override
protected VaadinServletRequest buildVaadinRequest() {
return new SpringVaadinServletRequest(request,false);
}
项目:minimal-j
文件:MjSpringVaadinServlet.java
@Override
protected VaadinServletRequest createVaadinRequest(HttpServletRequest request) {
VaadinServletRequest vaadinServletRequest = super.createVaadinRequest(request);
Subject.setCurrent((Subject) vaadinServletRequest.getWrappedSession().getAttribute("subject"));
return vaadinServletRequest;
}
项目:ilves
文件:OpenIdLoginViewlet.java
/**
* SiteView constructSite occurred.
*/
@Override
public void enter(final String parameterString) {
final EntityManager entityManager = getSite().getSiteContext().getobject(EntityManager.class);
final Company company = getSite().getSiteContext().getobject(Company.class);
final HttpServletRequest request = ((VaadinServletRequest) VaadinService.getCurrentRequest())
.getHttpServletRequest();
try {
final VerificationResult verification = OpenIdUtil.getVerificationResult(company.getUrl(),"openidlogin");
final Identifier identifier = verification.getVerifiedId();
if (identifier == null) {
((AbstractSiteUI) UI.getCurrent()).redirectTo(company.getUrl(),"login",getSite().localize("message-login-Failed")
+ ":" + verification.getStatusMsg(),Notification.Type.ERROR_MESSAGE
);
}
final User user = UserDao.getUserByOpenIdIdentifier(entityManager,company,identifier.getIdentifier());
if (user == null) {
LOGGER.warn("User OpenID login Failed due to not registered Open ID identifier: "
+ identifier.getIdentifier()
+ " (IP: " + request.getRemoteHost() + ":" + request.getRemotePort() + ")");
((AbstractSiteUI) UI.getCurrent()).redirectTo(company.getUrl(),getSite().localize("message-login-Failed"),Notification.Type.WARNING_MESSAGE);
return;
}
if (user.isLockedOut()) {
LOGGER.warn("User login Failed due to user being locked out: " + user.getEmailAddress()
+ " (IP: " + request.getRemoteHost() + ":" + request.getRemotePort() + ")");
((AbstractSiteUI) UI.getCurrent()).redirectTo(company.getUrl(),Notification.Type.WARNING_MESSAGE);
return;
}
LOGGER.info("User login: " + user.getEmailAddress()
+ " (IP: " + request.getRemoteHost() + ":" + request.getRemotePort() + ")");
AuditService.log(getSite().getSiteContext(),"openid password login");
final List<Group> groups = UserDao.getUserGroups(entityManager,user);
SecurityService.updateUser(getSite().getSiteContext(),user);
((SecurityProviderSessionImpl) getSite().getSecurityProvider()).setUser(user,groups);
((AbstractSiteUI) UI.getCurrent()).redirectTo(company.getUrl(),getSite().getCurrentNavigationVersion().getDefaultPageName(),getSite().localize("message-login-success") + " (" + user.getEmailAddress() + ")",Notification.Type.HUMANIZED_MESSAGE);
} catch (final Exception exception) {
LOGGER.error("Error logging in OpenID user.",exception);
((AbstractSiteUI) UI.getCurrent()).redirectTo(company.getUrl(),getSite().localize("message-login-error"),Notification.Type.ERROR_MESSAGE);
}
}
项目:holon-vaadin7
文件:AbstractVaadinTest.java
/**
* Build the UICreateEvent to pass to UIProvider
* @param uiClass UI class
* @param location Optional Page location
* @return UICreateEvent
*/
protected UICreateEvent buildUiCreateEvent(Class<? extends UI> uiClass,String location) {
VaadinServletRequest request = (location != null) ? buildVaadinRequest(location) : buildVaadinRequest();
CurrentInstance.set(VaadinRequest.class,request);
CurrentInstance.set(VaadinSession.class,vaadinSession);
return new UICreateEvent(request,uiClass,TEST_UIID);
}
项目:holon-vaadin
文件:AbstractVaadinTest.java
项目:holon-vaadin7
文件:AbstractVaadinTest.java
/**
* Build VaadinServletRequest
* @return VaadinServletRequest
*/
protected VaadinServletRequest buildVaadinRequest() {
return new VaadinServletRequest(buildHttpServletRequest(),(VaadinServletService) vaadinSession.getService());
}
项目:holon-vaadin
文件:AbstractVaadinTest.java
/**
* Build VaadinServletRequest
* @return VaadinServletRequest
*/
protected VaadinServletRequest buildVaadinRequest() {
return new VaadinServletRequest(buildHttpServletRequest(),(VaadinServletService) vaadinSession.getService());
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。