Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Its possible to use console plugin in a grails 3 rest-api profile? #53

Open
ilmoralito opened this issue Jun 27, 2016 · 8 comments
Open

Comments

@ilmoralito
Copy link

I am trying to use console plugin in a grails 3 rest-api profile. When i try http://localhost:8080/console i get the following error in the console

ERROR org.grails.web.errors.GrailsExceptionResolver - MissingMethodException occurred when processing request: [GET] /console
No signature of method: org.grails.plugins.console.ConsoleController.createLink() is applicable for argument types: (java.util.LinkedHashMap) values: [[action:index, absolute:true]]. Stacktrace follows:
java.lang.reflect.InvocationTargetException: null
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: groovy.lang.MissingMethodException: No signature of method: org.grails.plugins.console.ConsoleController.createLink() is applicable for argument types: (java.util.LinkedHashMap) values: [[action:index, absolute:true]]
    at grails.artefact.gsp.TagLibraryInvoker$Trait$Helper.methodMissing(TagLibraryInvoker.groovy:92)
    ... 3 common frames omitted

I am using grails 3.1.8 and grails-console 2.0.6

I tried the plug in with a grails 3 web profile and it is working as excepted

@davidkuster
Copy link
Contributor

This is because there's no view layer in the rest-api profile. It would be possible to create a version of the plugin that only includes the server-side components and you're on your own for the UI. I tried this in a Spring Boot app using Sublime for the UI with a little plugin to POST the contents to the server and show the results in a separate pane. The Sublime side mostly worked, but Groovy and Java 8 syntax don't get along, so it kind of didn't.

Here's the start of the Sublime side in case anyone wanted to pick this up and run with it: https://gist.github.com/davidkuster/634f286d24d7654b7232934ea3911262

@ilmoralito
Copy link
Author

Thanks for the information. A sublime plug in sound amazing.

@AleksanderGrzybowski
Copy link

I just hit this today, I tried to use httpie to directly hit /console/execute, but some problems with CSRF tokens appeared, anyway I worked around the problem this way: I created my own controller method that uses consoleService from this plugin and returns stuff from Evaluation object in some JSON form. Works for me perfectly.

@sheehan
Copy link
Owner

sheehan commented Oct 20, 2016

fyi - you can disable the CSRF protection with grails.plugin.console.csrfProtection.enabled = false

@AleksanderGrzybowski
Copy link

AleksanderGrzybowski commented Oct 20, 2016

Wow, I've spent half an hour looking all around grails docs for this! Should have looked here first. Thanks, will try it.

@sctse999
Copy link

sctse999 commented Apr 12, 2017

Hi all,

Not sure if I understand your question correctly. I have added this line to enable gsp support and the console is running smoothly under rest-api profile.

``compile 'org.grails:grails-plugin-gsp'

@aretche
Copy link

aretche commented Nov 21, 2018

In Grails 3.3.8 with console 2.1.1:

Add
apply plugin:"org.grails.grails-gsp"
to build.gradle

and in dependencies block:
compile "org.grails.plugins:gsp"

@luizcantoni
Copy link

luizcantoni commented Nov 11, 2021

For a Grails 5.0.1 app with rest-api profile you need to edit your build.gradle (following @aretche answer to Grails 3.3.8 #53 (comment)):

apply plugin:"org.grails.grails-gsp"

dependencies block:

implementation "org.grails.plugins:gsp"
implementation 'org.grails.plugins:grails-console:2.1.1'

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

No branches or pull requests

7 participants