This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ResId { | |
def toASCIIString: String | |
} | |
object ResId { | |
def apply(uri: String): ResId = new StringUri(uri) | |
def apply(uri: URI): ResId = new StringUri(uri.toString) | |
private def validated(uri: String): String = URI.create(uri).toString | |
case class StringUri(value: String) extends ResId { | |
override val toASCIIString: String = validated(value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Runtime.getRuntime().addShutdownHook(new Thread(() -> consumer(server::close))); | |
File tempFile = propagate(() -> File.createTempFile("util-tests", ".tmp")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* https://github.com/json4s/json4s/issues/39 | |
* | |
* Validation Monad instance removed from Scalaz7. | |
* https://github.com/scalaz/scalaz/blob/v6.0.4/core/src/main/scala/scalaz/Validation.scala#L133-L147 | |
* | |
* need explicitly convert to `scalaz.\/` (aka disjunction) if you want use the `Kleisli` composition | |
*/ | |
object Main extends App { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
@Controller | |
@RequestMapping("/person/{id}/overview") | |
public class MyController { | |
... | |
@ModelAttribute | |
public Person getPerson(@PathVariable final long id, final HttpServletRequest request) { | |
final Person soknad = personRepository.fetch(id); | |
return soknad; |