Spring integration

Thanks for keeping us update . i have just tried the sample with shiro integration, and i noticed a strange behaviour .

git clone git://github.com/xpoft/vaadin-samples.git vaadin-samples
cd apache-shiro
mvn jetty:run

for example when i login with the admin user , in my understanding i should be able to navigate to << Role “admin” View (disabled, if user doesn’t have access)>>
but in my case instead of getting the RoleAdminView i just get the Error message as if the admin user was not allowed to see the RoleAdminView.

Regarding your question on permission, i guess if someone need to have a more fine grain control on permission for more complexe application with no trivial enterprise organisation then maybe Yes a need @RequiresPermission will surely surface .

Cheers
12612.png

I Don’t know but maybe it has something to do with the cachedView, because it only happens when i first login as normal user then i logout . Then if try to login as admin user i can’t no more Access the privilège View , RoleAdminView. it throw me the same error message as if i signed in as “user” role.

cheers

Hi Alexander

IS it possible to disable the cache fonctionnality ?

cheers

Ok. I’ve fixed it. 1.6.1

I’ve just updated the add-on.
Add @RequiresPermissions support. And Logical attribute. Please, try it.

Really cool Alexander, I’ll try it and let you know how it goes for me .

Thanks

Cheers

I believe there is a bug in the DiscoveryNavigator when manually adding views. In 1.6.2, when I manually add a view, I get an error:

However I have this view defined in my Spring context:

<bean
    name="stationHomeView"
    scope="prototype"
    class="org.p.c.p.ui.view.StationHomeViewImpl"/>

I believe the problem is at line 115 in the DiscoveryNavigator:

String[] beanNames = SpringApplicationContext.getApplicationContext().getBeanNamesForType(viewClass);
        if (beanNames.length != 0)
        {
            throw new IllegalArgumentException("cant't resolve bean name for class :" + viewClass.getName());
        }

The logic should be:


if (beanNames.length == 0) { ... }

-mike

Ok. I’ve fixed it. Thanks.

It looks like beta10 breaks this add-on. The VaadinServiceSession was renamed:

Caused by: java.lang.NoSuchMethodError: com.vaadin.server.SessionInitEvent.getSession()Lcom/vaadin/server/VaadinServiceSession;
	at ru.xpoft.vaadin.SpringVaadinServlet$1.sessionInit(SpringVaadinServlet.java:84)
...

I attached a minimal patch to update it.

-mike
12659.txt (1.44 KB)

Hoi Alex,

do you plan to work on the addon and fix the issue?

Oliver

I’ve updated addon. Please, try it.

It ´s working fine. Thanks a lot

I upgrade spring-vaadin-integration to version 1.6.5 with vaadin 7.0.0.beta10
I update and test spring-security demo from vaadin-samples but after login ok, vaadin say this message “Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js”
before version run perfectly.
What is the error?

Today I was starting to look at using UiProvider to return a separate UI for mobile/touch clients. I was looking at the Wiki article here: https://vaadin.com/wiki/-/wiki/Main/Creating%20an%20application%20with%20different%20features%20for%20different%20clients

I found that your spring integration implementation registers its own SpringUiProvider which uses the Spring bean name. This seems to prevent the functionality of returning different views to different clients. One work around I was thinking of would be to map two different servlets such as /app and /mobile and then use a servlet filter to redirect the user appropriately. That would let me configure two different bean names in the different servlets.

However it would be nice if I could use the native UIProvider functionality or have a hook in the SpringUiProvider to dynamically return a bean name. Maybe the “beanName” parameter should be replaced with a “beanNameProvider” parameter that must implement an interface similar to UIProvider but returns a bean name instead of a class.

-mike

Hi.

I’m new to Vaadin and I have started working with Vaadin 7 and your Spring Addon and it is realy easy to use. Big thanks for that.
I thought about using Google Appengine for hosting my application and I found out that Vaadin offers a special Servlet for the GAE.

Is it possible that you offer another “springyfied” GAE-Servlet in your addon?

Thanks a lot
Regards
Christian

I have the same problem with version 1.6.5 and vaadin 7.0.0.rc1.
Did anyone find the problem ?

I sugest to remove freemarker form in apache shiro sample, you can simply use vaadin form.

Is it possible to use the SpringVaadinServlet in combination with the “no web.xml” configuration?

This is what I have but it gives me an NullPointerException. The setup with web.xml did work.


public class WebAppInitializer implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {

        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new ru.xpoft.vaadin.SpringVaadinServlet());
		
            dispatcher.setLoadOnStartup(1);
            dispatcher.addMapping("/*");
            dispatcher.setInitParameter("beanName", "myUI");
        }
    }

If by “no web.xml” you mean running with embedded Jetty, here’s the code snippet that works for me:

    ServletHolder appLoader = new ServletHolder(new ru.xpoft.vaadin.SpringVaadinServlet());
    appLoader.setInitParameter("beanName", "MyUI");
    appLoader.setInitParameter("widgetset", "MyWidgetSet");

The application starts up fine, I use Spring’s @Component and @Autowired everywhere and it works fine.
The app also finds the widget set fine (I can see my icons).

The problem I have is with not seeing the new (7.0) themes, but that’s an entirely separate problem and has nothing to do with your question.

Hope this helps…

– Jacek

I’m running Tomcat, but that shouldn’t matter for the “no web.xml” approach.

It is explained here: http://blog.springsource.org/2011/06/10/spring-3-1-m2-configuration-enhancements/

The suggested code is:


public class MyWebAppInitializer implements WebApplicationInitializer {
 
    @Override
    public void onStartup(ServletContext container) {
      XmlWebApplicationContext appContext = new XmlWebApplicationContext()
      appContext.setConfigLocation("/WEB-INF/spring/dispatcher-config.xml");
 
      ServletRegistration.Dynamic dispatcher =
        container.addServlet("dispatcher", new DispatcherServlet(appContext));
      dispatcher.setLoadOnStartup(1);
      dispatcher.addMapping("/");
    }
 
}

But that is for the normal servlet, I want to load the SpringVaadinServlet.