Comments (3)
Can't update the readme right at the moment, but it should just be import org.scalatra.RailsPathPatternParser
.
You can also test route patterns interactively if you're using sbt. From the sbt prompt, run console
, and then:
scala> import org.scalatra._
import org.scalatra._
scala> val ppp = SinatraPathPatternParser("/:id.json")
ppp: org.scalatra.PathPattern = PathPattern(^/([^/?#]+)\.json$,List(id))
scala> ppp("/foo.json")
res3: Option[org.scalatra.ScalatraKernel.MultiParams] = Some(Map(id -> ListBuffer(foo)))
scala> ppp("/foo.xml")
res4: Option[org.scalatra.ScalatraKernel.MultiParams] = None
So, for this case, the SinatraPathPatternParser should also work.
from scalatra.
Thanks a lot! For some reason it didn't work for me though. Maybe because I wasn't using the most recent version of scalatra?
One detail that i came across:
implicit override val string2RouteMatcher(path: String) =
RailsPathPatternParser(path)
should be
implicit override def string2RouteMatcher(path: String) =
RailsPathPatternParser(path)
because it's a method.
from scalatra.
Yes, I think you're right on def vs. val. It was originally a function value, and I changed it back into a method. It's a def in the unit test.
The rails parser was added for 2.0.0.M3. It should work there.
from scalatra.
Related Issues (20)
- Expiring domain, seeking transfer HOT 2
- fileParams doesn't provide function to get the list of values HOT 5
- RichRequest.remoteAddress does not account for multiple IP addresses in X-Forwarded-For header HOT 5
- Please add support for plain standard websocket!!! HOT 4
- Deprecate Scalate HOT 5
- Issue with mongoDB example on website HOT 1
- Shouldn't we release Scalatra 2.8?
- drop support Scala 2.11
- Deprecate Atmosphere HOT 2
- Scala 3 HOT 10
- Release Scalatra 2.8.0 HOT 2
- object json4s is not a member of package org HOT 1
- Update org.apache.commons:commons-text to 1.10 for Scalatra 2.8.x HOT 1
- Consider releasing a Jakarta-based flavour of Scalatra 3.x HOT 11
- Scalatra 3.0.0-Mx artifacts contain Java 17 bytecode HOT 8
- Trying to generate classes using openapi.yaml results in compilation errors.
- Release schedule for Scalatra 3.0 HOT 9
- scalatra.org is down HOT 2
- `java.util.Locale` deprecation warnings
- Ok(404l) returns an actual 404 error code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalatra.