Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vaadin-Spring + Spring security prevents WidgetSet addSessionInitListener #7

Open
gokhanoner opened this issue Nov 27, 2015 · 18 comments

Comments

@gokhanoner
Copy link

I'm using vaadin-spring, Spring security 4. I have an HTML login page, after successfull login, my Vaadin app. is loading. Problem is, When WidgetSet init. after session creation, Vaadin Service is null. it's initialized after login.

What I did, I extended SpringVaadinServlet and override servletInitialized() method & added the listener and other params from WidgetSet.

Is there a better way to do it?

@gokhanoner
Copy link
Author

Is there any workaround on this one ?

@mstahv
Copy link
Member

mstahv commented Jun 13, 2016

Could you try with Vaadin 7.7.0.alpha3 (and its CDD mode for widgetset) ? That don't use web listener anymore, so it might work without workarounds.

@gokhanoner
Copy link
Author

I'm using like below but it doesnt compile the widgetset ? What am i missing?

        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>${vaadin.plugin.version}</version>
            <configuration>
                <theme>gbtheme</theme>
                <warSourceDirectory>${basedir}/src/main/resources</warSourceDirectory>
                <widgetsetMode>local</widgetsetMode>
            </configuration>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>compile-theme</goal>
                        <goal>update-widgetset</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

@gokhanoner
Copy link
Author

gokhanoner commented Jun 13, 2016

btw, I removed <update-widgetset> and used cdnoption. still not working. + I need to be able to download the widgetset. Is fetch option designed for that ?

@mstahv
Copy link
Member

mstahv commented Jun 13, 2016

I think both update and compile should(/can) be there. fetch mode just compiles the widgetset in the cloud, but hosts in from your war file.

Do you have some small example project I could try and debug?

@gokhanoner
Copy link
Author

Just preparing a small example. But please correct me if I understand correctly:

  • update-widgetset was used to create widgetset from .gwt.xml file, which I dont have. I'm using spring-boot + wscdn-maven-plugin based setup. And now removed the wscdn-maven-plugin and just added new config setup.
  • I cannot see any error + anything that indicates that widgetset compilation is done.

@gokhanoner
Copy link
Author

gokhanoner commented Jun 13, 2016

Update: I managed to make it work:

  • local option wait for .gwt.xml.
  • cdn options create the necessary AppWidgetset class. Only thing maybe is to create it inside a named package rather than the default apckage.
  • fetch option works but I guess it needs a url to fetch it ?
  • some logginng conf. warnings inside maven plugin.
  • multiple theme compilations or, at least, logs.

Please see attched picture

image

@gokhanoner
Copy link
Author

I looked to the source code. I suppose fetchdoesn't download, actually couldn't figure out what it's doing. And when I use the local option, it just creates a gwt.xml file. No compiled addons.

@samie
Copy link
Contributor

samie commented Jun 14, 2016

That "Public URL: null" does not look right. Before that add-on detection goes ok.

@mstahv
Copy link
Member

mstahv commented Jun 14, 2016

It works, it is just that the logging is invalid when the mode "fetch" is used.

@mstahv
Copy link
Member

mstahv commented Jun 14, 2016

I created an issue about this: https://dev.vaadin.com/ticket/19944

@gokhanoner
Copy link
Author

Matti,

You sad it worked. In which folder the widgetset downloaded ?? And how can I control it ? Because it's a spring-boot setup, my app, it should be in a src/main/resources/VAADIN/widgetsets folder

@mstahv
Copy link
Member

mstahv commented Jun 14, 2016

Those are generated resources and should NOT go under src directory . By default those go to target/classes/, where they are served by the VaadinServlet, also in Spring Boot based app.

@gokhanoner
Copy link
Author

gokhanoner commented Jun 14, 2016

image

This is target/classes folder, I can see AppWidgetset.class file, but cannot see compiled widgetset files , js files ? And in my case, addons are not working.

@mstahv
Copy link
Member

mstahv commented Jun 14, 2016

Remove your warSourceDirectory configuration and execute "mvn clean install"

@gokhanoner
Copy link
Author

Below is the current config. It's still same. widgetset created/downloaded to anywhere.

        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>${vaadin.plugin.version}</version>
            <configuration>
                <theme>gbtheme</theme>
                <!-- <warSourceDirectory>${basedir}/src/main/resources</warSourceDirectory> -->
                <widgetsetMode>fetch</widgetsetMode>
            </configuration>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>compile-theme</goal>
                        <goal>update-widgetset</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

@mstahv
Copy link
Member

mstahv commented Jun 14, 2016

You are missing the compile goal:

<goal>compile</goal>

@gokhanoner
Copy link
Author

Perfect. Now it's working. Thanks for help & advice. Hope to see 7.7.0 GA in near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants