bowler-framework / bowler Goto Github PK
View Code? Open in Web Editor NEWRESTful Web Framework based on Scala, built on top of Scalatra & Scalate
Home Page: http://bowlerframework.org
License: BSD 3-Clause "New" or "Revised" License
RESTful Web Framework based on Scala, built on top of Scalatra & Scalate
Home Page: http://bowlerframework.org
License: BSD 3-Clause "New" or "Revised" License
This is wrong because the variable name should not change.
Currently, if you forget to register a StringValueTransformer, you just get a default value of the type to be transformed for an argument of that type. This is undesirable.
App Engine apps have restricted access to the classloader, which lift-json tries to access to load a class.
headline is self-explanatory
When controllers are instantiated using mix-in instead of declaring them as class (root type isn't Controller) they are not detected and active in bowler.
Example:
http://pastie.org/2393166
Thanks a lot!
java.lang.NullPointerException
at org.fusesource.scalate.RenderContext$.capture(RenderContext.scala:36)
occurs if you try to pass a template block to a Scala function.
When trying to use Scaml or Jade templates I get the following exception:
org.fusesource.scalate.InvalidSyntaxException: string matching regex \r?\n' expected but
!' found at 1.24
at org.fusesource.scalate.scaml.ScamlParser.parse(ScamlParser.scala:375)
at org.fusesource.scalate.jade.JadeCodeGenerator.generate(JadeCodeGenerator.scala:38)
This bug is likely caused by the way these files are loaded from the classpath by the com.recursivity.commons.StringInputStreamReader util, which simply concats all lines effectively stripping the newlines.
sbt 0.7.x is no longer maintained and the plugin ecosystem has moved on.
You get an exception.
Not sure if this is a real issue or a "don't do that".
This is with template precompilation.
On JSON rendering, when validation errors occur, the server should return a HTTP 400 Code and render a JSON formatted list of error messages.
Only the generic 400 page is shown on jetty when doing this. Possibly have to tweak Jetty settings to render this properly?
A workaround is to use some kind of DynamicVariable, but this is messy.
In Java, you can do request.getRequestDispatcher(new_url).forward(request, response)
to forward requests (rather than redirect) which is very useful if you are setting values in the request rather than session. Please add this functionality to the BowlerHttpRequest
class.
On App Engine you can't write files, period.
Bowler ignores the fact that it's meant to be optional.
There are some things in Bowler that are currently undocumented. I would appreciate some guidance from @wfaler on this issue, as it's possible some features are "unfinished".
I should probably also go through the closed issues and consider if any of them indicate something missing in the docs.
Getting org.scala-sbt sbt 0.7.5.RC0 ...
:: problems summary ::
:::: WARNINGS
module not found: org.scala-sbt#sbt;0.7.5.RC0
==== local: tried
/home/robin/.ivy2/local/org.scala-sbt/sbt/0.7.5.RC0/ivys/ivy.xml
==== typesafe-ivy-releases: tried
http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.7.5.RC0/ivys/ivy.xml
==== Maven Central: tried
http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.7.5.RC0/sbt-0.7.5.RC0.pom
==== sonatype-snapshots: tried
https://oss.sonatype.org/content/repositories/snapshots/org/scala-sbt/sbt/0.7.5.RC0/sbt-0.7.5.RC0.pom
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-sbt#sbt;0.7.5.RC0: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.7.5.RC0: not found
Error during sbt execution: Error retrieving required libraries
(see /home/robin/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.7.5.RC0
You're mixing tabs and spaces in your indentation.
Cf. BowlerParentProject.scala.
If a registered StringValueTransformer
returns None
, bowler tries to call the method with None
as argument, even if its formal parameter is not of type Option[T]
. This results in an exception from inside java.lang.reflect
which is not clear as to what the real problem is.
work out if there is a way to get a base app path/context for a filter based webapp.
This thwarts validation.
It seems that the JSON renderer arbitrarily renders empty JSON objects some of the time for case classes that are retrieved from a persistent store with JPA or Squeryl.
The two common denominators seem to be:
I initially thought it was the no-args constructor that was the issue, but it seems that it is a mix of the issues that somehow collude - no-args constructors are fine on non-persistent objects.
This is probably a lift-json library issue, however if that is the case, maybe replacing it is an option with another implementation of JsonViewRenderer
per the slf4j documentation, slf4j implementations are only for applications, not for frameworks.
This issue breaks testing with ScalatraSpec
, because no stack traces are available when something goes wrong in a test.
Scalatra 2.1 depends on Servlet 3.0, so this will lose us Servlet 2.5 support.
Example: java.net.URL variables should be named url, not uRL.
Even though Bowler rewrites redirect URLs, it doesn't understand the rewritten URLs when this "feature" is enabled in the servlet container.
As @wfaler has previously mentioned he was thinking about these things: Is there anything that might be better off folded into Scalatra? Is there anything that should be removed and replaced with similar functionality in Scalatra (or even possibly the Java Servlet API)?
Any other design issues?
Comments welcome!
Note: Personally I want to support running on Servlet API 2.5 and above in a putative future Bowler Framework 1.0, but that may change (based on feedback from users or my requirements changing).
Hi
We have an issue with bowler and file uploads. It looks like files that are uploaded that are larger than 10kb is saved and there path is stored inside the StoreLocation "variable" of the string that comes into our action. With these large files the file is ok and can be read.
However if the file uploaded to Bowler is less than 10kb the path inside of StoreLocation is pointing to a file that does not exists. I there for get a FileNotFound exception.
The file that is uploaded should be properly saved to the path, and should be able to be read.
These are my versions;
"org.bowlerframework" %% "core" % "0.5.1",
"org.slf4j" % "slf4j-nop" % "1.6.0" % "runtime",
"javax.servlet" % "servlet-api" % "2.5" % "provided",
"org.eclipse.jetty" % "jetty-webapp" % "7.4.2.v20110526" % "container",
"org.eclipse.jetty" % "jetty-webapp" % "7.4.2.v20110526",
"org.scalatra" %% "scalatra-scalatest" % "2.1.0-SNAPSHOT" % "test",
"org.specs2" % "specs2_2.9.0" % "1.3" % "test",
"net.liftweb" %% "lift-json" % "2.3" % "test",
"net.java.dev.jets3t" % "jets3t" % "0.8.1",
"org.scala-tools.time" %% "time" % "0.5",
"org.bowlerframework" %% "squeryl-mapper" % "0.5.1",
"com.h2database" % "h2" % "1.2.144",
"c3p0" % "c3p0" % "0.9.1.2",
"org.squeryl" %% "squeryl" % "0.9.5-RC1",
"postgresql" % "postgresql" % "8.4-701.jdbc4",
"org.imgscalr" % "imgscalr-lib" % "4.1",
"net.databinder" %% "dispatch-http" % "0.8.7"
Deal with slash forward and lack of slash equally (append slash/remove slash on additional route)
Application crashes during startup when a . is in the path of a route in FunctionNameConventionRoutes.
This is likely due to dots not being translated during startup when routes are reflectively read ("." needs to be translated into it's JVM "$something")
I'm not sure what the root problem is here, but there is odd behaviour around content-types and the accept header. I have a resource at /foo
which accepts GET
and returns a json response, by calling render(my_case_class_instance)
. There is no HTML view (.mustache, etc) for that resource.
If I make a request with:
Accept: application/json
I get back my JSON representation, but with a Content-type
header of text/plain
(bug #1?)
If I make a request with:
Accept: text/plain
or Accept: text/html
Then, I get an error 500 from the service, with the message Could not find a template of type .html, .xhtml, .xml, .mustache, .ssp, .jade or .scaml with path: classpath:///views/GET/foo
(bug #2?)
I would expect to get 406 here, although I have not specified in code that application/json
is the only content-type I can produce, that is how imagine the resource to be defined. (side issue: how do I specify in code what content-type I am producing?)
If I make a request with:
Accept: */*
or
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
(chrome default)
Then, I get an error 500 from the service, with the message Could not find a template of type .html, .xhtml, .xml, .mustache, .ssp, .jade or .scaml with path: classpath:///views/GET/foo
(bug #3?)
As these both accept */*
, I expect the json representation to be returned.
These 3 situations seem to be connected, but if you would rather I raise 3 separate bugs, I can do that.
From the mailing list:
My scenario is of someone following an "expired" link from another
website, email, bookmark...
But this can be any invalid request that comes from somewhere else so
there is no previous GET URL.
What I would like to do is to use the validationErrors in the view of
the current request. Or to be able to set the view that will display
the validationErrors
The idea is that you have ephemeral state which only exists for the next request and is then deleted. This can be used for e.g. redirecting to another page and displaying a "success" widget - the success message would be stored in the flash map / flash cookie.
A problem with this (at least, as they are implemented in Play 2.0.1) is it doesn't play well with multiple tabs being used by the same user at the same time.
Scalatra does already have a flash map implementation but I'm unclear on how this could be used from Bowler.
With this minimal Controller:
class MyController extends Controller with Renderable {
get("/widget")((request, response) => {
render( some_json_thing )
})
}
Attempts to POST to that resource result in a 404. Also, OPTIONS on that resource returns:
Content-Length: 0
Server: Jetty(6.1.22)
Allow: GET, HEAD, POST, TRACE, OPTIONS
Content-Type: text/plain; charset=utf-8
I think that POST should result in 405 and should not be in the Allow header.
Hey, I've been getting the following IllegalArgumentException:
java.lang.IllegalStateException
at org.eclipse.jetty.server.session.AbstractSessionManager$Session.setAttribute(AbstractSessionManager.java:1186)
at org.bowlerframework.http.BowlerHttpSession.setLastGetPath(BowlerHttpSession.scala:43)
at org.bowlerframework.view.scalate.ScalateViewRenderer.render(ScalateViewRenderer.scala:34)
at org.bowlerframework.view.scalate.BrowserViewRenderer$class.renderView(BrowserViewRenderer.scala:52)
at org.bowlerframework.view.scalate.ScalateViewRenderer.renderView(ScalateViewRenderer.scala:10)
at org.bowlerframework.view.Renderable$class.renderSeq(Renderable.scala:67)
at org.bowlerframework.view.Renderable$class.render(Renderable.scala:60)
This only happens on the first request for a user, so I assume it's complaining about there being nothing to set. For this, I'm using the FunctionNameConventionRoutes and jetty-7.4.1.v20110513.
Hope that's enough information!
Want to be able to (in one line of code) prefer sending an XHTML content type over an HTML content type, regardless of what the user agent says it prefers. This should not be the default of course, because you have to deliberately create XHTML in a layout.
Want to be able to (in one line of code) drop GET, POST etc. from the view path, for applications which follow a design of using the same view for GETs and POSTs to the same URL (when they render anything at all for that URL, as opposed to sending e.g. a redirect or a HTTP error).
Controllers that are inner classes work, but only if the controller's methods have no parameters. This is with FunctionNameConventionRoutes
.
Note to self: First check whether there is a newer version of lift-json that supports this.
Investigating...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.