We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is scala code. We should generalize this and make it as part of the builder.
import java.net.URI import org.codehaus.httpcache4j.uri.{QueryParams, URIBuilder} import scalaz.\/ object URIFactory { val Extractor = "(http|https)://(\\w+\\.\\w+)(:\\d+)?(/[^\\?#]*)?(\\?.*)?#?(.*)?".r def parse(s: String): String \/ URI = { \/.fromTryCatch{ URI.create(s) }.orElse(\/.fromTryCatch { s match { case Extractor(scheme, host, port, path, query, fragment) => { URIBuilder.empty(). withScheme(scheme). withHost(host). withPort(Option(port).map(_.stripPrefix(":").toInt).getOrElse(-1)). withRawPath(path). withParameters(QueryParams.parse(Option(query).map(_.stripPrefix("?")).orNull)). withFragment(Option(fragment).filterNot(_.isEmpty).orNull). toURI } } }).leftMap(_ => s) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is scala code. We should generalize this and make it as part of the builder.
The text was updated successfully, but these errors were encountered: