com.vaadin.server.VaadinServletRequest的实例源码

项目:holon-vaadin7    文件AbstractVaadinspringTest.java   
@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;
}
项目:holon-vaadin    文件AbstractVaadinspringTest.java   
@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();
}
项目:holon-vaadin7    文件AbstractVaadinspringTest.java   
@Override
protected VaadinServletRequest buildVaadinRequest() {
    return new SpringVaadinServletRequest(request,false);
}
项目:holon-vaadin    文件AbstractVaadinspringTest.java   
@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   
/**
 * 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,TEST_UIID);
}
项目: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());
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...