score:0
Accepted answer
with the help of other users of the play! framework google group, here is how to access the request inside a custom parthandler.
//create a body parser
val mybodyparser = bodyparser { request =>
parse.multipartformdata(myparthandler(request)).apply(request)
}
def uploadfile() = action(mybodyparser)
{request =>ok("done")}
def myparthandler(request: requestheader) : bodyparsers.parse.multipart.parthandler[multipartformdata.filepart[result]] = {
parse.multipart.handlefilepart {
case parse.multipart.fileinfo(partname, filename, contenttype) =>
println(request.session.get("myvaluekey"));
Source: stackoverflow.com
Related Query
- Accessing session information inside a custom PartHandler in Play! Framework 2.0
- Accessing session information inside a custom PartHandler in Play! Framework 2.0
- How do you change the Play 2.1! Framework session cookie name
- Custom JSON validation constraints in Play Framework 2.3 (Scala)
- Can I call session in template/view on Play Framework
- Play framework handling session state
- Better ways to implement more secure Play Scala framework session via cookie
- Play Framework 2.6 CSRF and Session
- How to set up play framework ApplicationLoader and Macwire to work with custom routes?
- Play Framework 2.2 action composition returning a custom object
- Play 2.0 Framework - Custom Form Field
- Using scala and java in play framework 2.1 : Session usage
- Set session cookies in play framework testing using selenium hd
- Scala Play Framework Slick session doesn't work
- Scala Play framework 2.2 - How to get information about a users loginstatus in template
- how can I remove codes creating session in unit test for Play framework and slick
- Play framework Scala - get session value in a form
- Play Framework How to update a the session within a request
- Integration testing play framework using custom header in a request
- Play Framework - Store Information About Current Request
- Play Framework 2 - How to create a custom log file in scala
- Play Framework JSON Reader and custom JSErrors
- Error while accessing List[String] in play framework
- Server-side session in play framework
- Play Framework - Getting Session Data in Views
- Converting a Scala Session Object to a Java Session Object in Play Framework
- Play framework custom headers ignored
- Play Framework 2.4.1: How to migrate custom plugins
- Add data to session in play framework filter
- How can I perform session based logging in Play Framework
More Query from same tag
- Overriding parent method in scala
- Difference between >> and >>> in Scala
- GeoTools transform from CRS in meters to CRS in degree (WGS84)
- Remove JSON array element in scala
- cats' NonEmptyList vs scala stdlib ::
- How to split List into segments
- forEach loop on array with fat arrow
- Scala Tree/Graph Implementation
- CollectionConverters always return the original source object?
- Error converting Java HashMap to Scala Array[Object] generating JasperReport
- Extract value from array in Spark
- implicit function that compares two closed classes in Scala
- How to preserve original type in match without resorting to asInstanceOf?
- Nullable column causes SlickException when trying to write null value
- "Stable identifer required" error during companion object import
- Convert Epoch value into 12 hours format timestamp
- (scalaz) to optionally invoke a chained method
- How to init a Enum based on the int value safely?
- How to resolve a non-jar (dll/jnilib) library dependencies in sbt?
- Scala - Add element:MyType to Array = option[MyType] expected
- sbt multiproject without common root
- Play Framework is hiding the intial exception
- Group ScalaTest tests and run in order
- order by desc on column type double is not working in scala dataframework
- Scala Implicit convertions: 2 way to invoke
- How can I avoid not-exhaustive-match warnings with Scala RegexParsers
- Upsert with increment of embedded object value in MongoDB / Casbah / Scala /
- Match empty list using case/match or if/else?
- duplicate case class name in the same package under different files in Scala
- Overloaded method filter