Questions tagged [groovlet]

Groovlet are Groovy Scripts with JSP like implicit variables bounded.

Grrovlets are invoked by GroovyServlet, which hands these Groovy scripts implicit variables, request, response, session, params etc.

The script can generate web-content by println statements or MarkupBuilder.

Look at this for more details

17 questions
2
votes
1 answer

Opening a local file in Groovy

I want to use a File object to read a local file in the same directory as a groovlet. However, using a relative path to the file (either "example.txt" or "./example.txt") doesn't do the trick. If I give it an absolute path (e.g., "/example.txt"),…
Steve Nay
  • 2,819
  • 1
  • 30
  • 41
2
votes
2 answers

Groovlet + Tomcat: "unable to resolve class" when importing libraries

I'm having some trouble running a groovy servlet (groovlet) in tomcat that imports a library class. When I don't import anything the groovlet works correctly, but if I do import something that I expect to be on the classpath (I can import the same…
Rob Hruska
  • 118,520
  • 32
  • 167
  • 192
2
votes
1 answer

Is is possible to bind my own closures and variables to groovlet?

There are some variables and closures in groovlet like request, response, out, forward, redirect... Is it possible to bind my own variables and closures to groovlet automatically? I want this feature for ${escapeHtml(params.value)} like things.
KwonNam
  • 686
  • 1
  • 8
  • 19
1
vote
1 answer

Set Groovlet session object within a class?

I have a Groovy class, MyRequest, that is used to process each HTTP request. In the constructor, this class sets an instance variable, _session, to be the value of request.getSession(true) (where request is the current HttpServletRequest). In my…
James Sumners
  • 14,485
  • 10
  • 59
  • 77
1
vote
1 answer

Logging from a groovlet

Is there a way to write into the server log from a groovlet script? I've tried the following to no avail: Create a class with @Log4j annotation within the groovlet (@Log4j works fine in the rest of the project) @Log4j('LOGGER') class Log { …
m0skit0
  • 25,268
  • 11
  • 79
  • 127
1
vote
2 answers

Duplicate class error with Groovlets

I am trying to work with a Catch-all groovy script for my groovlets. This is what I did public class GroovletServletCatchAll extends GroovyServlet { public URLConnection getResourceConnection(String name) throws ResourceException { …
Paddy
  • 609
  • 7
  • 25
1
vote
0 answers

Groovlet ServletContextListener failing to close SQL connection on destroy

I have a Groovlet (Groovy Servlet) which is working perfectly in every way, except when it's time to blow the context and deploy an update. When I delete the war file, the ServletContextListener.destroy is called on my implementation, which in turn…
Piko
  • 4,132
  • 2
  • 21
  • 13
1
vote
1 answer

Tomcat log http request and invoke java code

I have a small project that is written in Groovy and deployed as a groovlet on Tomcat 6.0. My issue now that I need to monitor all incoming requests and perform on each request custom logging. First I thought to include into each class a short code…
MeIr
  • 7,236
  • 6
  • 47
  • 80
0
votes
1 answer

Groovy servlet can't find JAR files in Tomcat

I've created a groovlet that will act as a sort of HTTP proxy. It accepts GET requests and then makes web service calls based on the URL provided in the request. Here's the code I've got so…
Steve Nay
  • 2,819
  • 1
  • 30
  • 41
0
votes
1 answer

How do I delegate building to a method?

I am writing a Groovlet and would like to delegate part of the HTML builder to a method but am having trouble getting it to work. Below is what I have: def pages = [page1: html.p("page1")] html.html { p("p") pages[page1] } I am expecting the…
dromodel
  • 9,581
  • 12
  • 47
  • 65
0
votes
1 answer

Shorter URL in Groovlet

Consider the following Groovlet: html.html { head { title("Groovy Test") } body { center { img(src:"getPlot.groovy?name=name&value=value") } } } Is there a better way to generate the URL? I'm looking to eliminate the…
dromodel
  • 9,581
  • 12
  • 47
  • 65
0
votes
1 answer

Groovlet not working in GWT project, container : embedded Jetty in google plugin

I am working on a GWT application which uses GWT-RPC. I just made a test groovlet to see if it worked, but ran into some problems here's my groovlet package groovy.servlet; print "testing the groovlet"; Every tutorial said we don't need to…
xask
  • 473
  • 7
  • 13
0
votes
1 answer

Gaelyk: returned truncated JSON

I am "piping" a json feed (in some cases quite big) that is returned from an external service, to hide an access api-key to the client (the access key is the only available authentication system for that service). I am using Gaelyk and I wrote this…
Randomize
  • 8,651
  • 18
  • 78
  • 133
0
votes
2 answers

Does Sitemesh work with Gaelyk ? Does anybody have a working guide?

Has anyone been able to get sitemesh and gaelyk working together? This seems to be possible as mentioned here http://blogs.bytecode.com.au/glen/2009/12/14/getting-sitemesh-running-on-google-app-engine.html. However I unable to get this working with…
aldrin
  • 4,482
  • 1
  • 33
  • 50
0
votes
1 answer

JSP PageContext from a Groovlet (Groovy Servlet)

I'm trying to use Groovlets in place of JSPs in an integration framework but one of the vendor's libraries relies on the javax.servlet.jsp.PageContext available in a JSP. I found the GroovyPagesPageContext class that's part of Grails for GSPs. …
mbrevoort
  • 5,075
  • 6
  • 38
  • 48
1
2