Can anyone confirm that the webflow plugin is working in 2.0.0M1? I've installed the plugin but my "*Flow" actions don't seem to be treated differently then my other actions. I've additionally tried rebuilding grails-core from GitHib (2.0.0.BUILD-SNAPSHOT) and the behavior is the same.
Here's the action in question:
def baselineFlow() {
showQuestion {
on("checkout").to "enterPersonalDetails"
on("continueShopping").to "displayCatalogue"
}
}
When I go to controllerName/baseline it acts as if baseline.gsp isn't there (404 on controllerName/baseline) as opposed to trying to resolve baseline/showQuestion.gsp I do have a controllerName/baseline/showQuestion.gsp in place in views. The same action works in 1.3.7.
This looks like a bug. I suggest you create an issue in the Grails bug tracker. Attach your application to the issue and provide instructions for reproducing the error. In my experience, the Grails team are very good at resolving reported bugs. If you do it now, it should be fixed for the final release of 2.0.0
Related
I've a rest-api-plugin in grails 3.3.9 that has a couple of gson views for rendering the controller methods. When I include this plugin in another new grails project either the gson views are not called at all or they cannot be found (depending on wether I am using render/respond and specifiying the view).
I've tried specifying plugin in the render call but this doesn't help. I can see the gson files in the included plugin. In the new rest-api profile project, when the view is specified in the plugin it looks like DefaultGroovyPageLocator is trying to find something like .json.gsp and nothing is looking for .gson (not sure if something should be?).
Any ideas as to how I might sort this?
Thanks.
...DefaultGroovyPageLocator is trying to find something like .json.gsp and nothing is looking for .gson
If that is true that nothing is looking for .gson, that is a bug. Please report an issue at https://github.com/grails/grails-views/issues and we can investigate. Thanks.
I am trying the common issue of configuring different URLs according to Roles using grails 2.3.3 and spring security spring-security-core:2.0-RC2.
I've found the following posts:
first post and a
modification in a second post http://desmontandojava.blogspot.com/2013/08/grails-tip-different-url-depending-on.html
but none of them work for my version, references didn't work for my version or packages are different now, they are all based on Burt Beckwith excellent presentation about hacking the spring security plugin, but they seem to be outdated, has anyone tried this with a recent version of grails and spring-security-core spring-security-ui?
I also tried the simple version of simply asking in a controller for the role and redirecting but it didn't work either, it had an odd behavior.
This Link worked for me:http://desmontandojava.blogspot.com/2013/08/grails-tip-different-url-depending-on.html
But only after I commented out this line in UrlMappings.groovy
// "/"(controller:"console", action:"myaction")
I was able to accomplish the task, however I had a problem, when logged out, the application was redirected to root and I did not have index.gsp so there was an error, then the only thing I did was add this property to Config.groovy.
grails.plugin.springsecurity.logout.afterLogoutUrl='/login/auth'
I have a plugin with domain, controller and view pages. (Using grails 1.3.6)
I run the plugin as standalone, the views work fine. URL: http://localhost:8080/sample-plugin/gp/list. I am able to view the list page.
I installed the plugin into a main application i.e. plugin-test. Start as run-app within STS and browse to http://localhost:8080/plugin-test/gp/list. I am able to view the list page.
I bundle the application as war i.e. plugin-test.war and deploy to tomcat. When I browse to http://localhost:8181/plugin-test/gp/list I get a 404 error! I am not sure what I am doing wrong.
I have been trying to resolve it for quite sometime now and still no luck. The same main application works fine in STS but not in tomcat.
HTTP Status 404 - /plugin-test/WEB-INF/grails-app/views/gp/list.jsp
type Status report
message /plugin-test/WEB-INF/grails-app/views/gp/list.jsp
description The requested resource (/plugin-test/WEB-INF/grails-app/views/gp/list.jsp) is not available.
Please help.
Thank you.
Jay Chandran.
This sounds worryingly familiar, as I spent a while figuring out this (or a very similar) issue. I ended up raising this Grails bug report:
Plugin layout not found in war when installed from BuildConfig.groovy
Have you installed the plugin as using the new BuidConfig dependency technique? The JIRA documents my workaround.
Sharing some of my lessons learned after experiencing the same exact issue (1.3.7):
Double check your HTML source to make sure that your template really isn't being included. Mine was being included, but my CSS/image URLs were wrong (only while running as a war)...so I wrongly assumed that my template wasn't there.
Don't use the ui performance tags for referencing your static content...doesn't appear to work, even if the plugin attribute is specified.
Don't name your layout main.gsp. You're guaranteed to have conflicts.
Don't use absolute=true on your g:resource tags. This doesn't appear to append the pluginContextPath to the absolute url, even if you specify dir="${pluginContextPath}"
Don't use pluginContextPath, as it's no longer required: http://grails.org/doc/latest/guide/single.html#6.3%20Tag%20Libraries (search "Plugin Paths")
In your g:resource tags in your plugin layout, make sure you specify the plugin attribute. Set it to the name of your plugin.
Move your static images/css from your plugin to a web server. If each application using your plugin has its own copy, your users aren't going to benefit from caching when bouncing between apps.
Note that all of the above applies to the layout gsp in your plugin project, not your consuming application.
I created a grails plugin in which some domain classes, controllers and views were added. After creating the plugin, I imported it in a grails application by using "grails.plugin.location.'...' = '.....'" in BuildConfig.groovy.
Everything is okay when the application starts up. And, everything is nice when online modifying the view GSPs in the plugin.
But, when I modified any controller in the plugin, the grails cannot find the view files corresponding to the modified controller in the plugin. Tomcat reported "HTTP Status 404" error. And, everything becomes okay again after restarting grails.
I am using Grails 1.3.3 and Groovy 1.7.2.
After googling, I found it was an unresolved bug. Please refer to the following URL:
http://jira.codehaus.org/browse/GRAILS-5869
In the bug page, there is a workaround reported. You can add annotation for the controller class of your plugin to make everything okay. Following is an example:
import org.codehaus.groovy.grails.plugins.metadata.GrailsPlugin
#GrailsPlugin(name='...', version='...')
class ... {
....
}
Wonder if anyone has come accross this problem. I have created a demo portlet using the grails portlet and liferay plugins.
After installing the grails plugins in a project i simply ran the following commands
grails create-portlet MyFirst
grails generate-portlet-views MyFirst
grails liferay-deploy
The portlet deploys fine. However when i try to add the portlet to a page then i get the following stacktrace. Anyone have any ideas ?
23:04:52,134 ERROR [jsp:165] javax.servlet.ServletException: File "/WEB-INF/grails-app/views/myfirst/render.jsp" not found
I am running liferay version 5.2.3 that has tomcat version 6.0.18 embedded. I am also using JVM 1.6
thanks in advance.
The current versjon of the Grails portlet plugin (0.7) doesn't support portletnames with capital cases. Change MyFirst to myfirst and it will work like a charm (well, almost ;)
Regards
Armaz
It looks like it's not able to find render.gsp (the default gsp for a porltet if no mode specific view is found).
What did generate-portlet-views generate for you?
Take a closer look to your stacktrace - it attempts to look for render.jsp, not gsp. render.jsp is the default template LR attempts to find if it does not find what it is looking for depending on the action.
Read Armaz's answer, he is correct. You must change template folder name to lower case: myFirst => myfirst.
The next problem you might experience is solved here: Grails Liferay portlet not invoking action ;)