0

My requirement is creating the rest json from the request uri using spray. I am using requestUri directive to get the base URL. When I run it through IDE or through spark-submit locally on my system, I got the proper output. But when I have done spark-submit on the cluster, I am not getting the base url using requestUri directive.The url, I am getting is partial. Because of which the expected output is also not proper.

The code to get the url is

requestUri {
      uri =>
      val reqUri = s"$uri"//uri.toString()
        complete {
        println ("URI " + reqUri)
    }
}

build.sbt looks like this

scalaVersion := "2.10.5"

libraryDependencies += "org.apache.spark" %% "spark-core" % "1.4.0"

resolvers ++= Seq(
  "Akka Repository" at "http://repo.akka.io/releases/")

resolvers ++= Seq("Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
  "Spray Repository"    at "http://repo.spray.io")


libraryDependencies +=
  "com.typesafe.akka" %% "akka-actor" % "2.3.0"


libraryDependencies ++= {
  val sprayVersion      = "1.3.1"
  Seq(
    "io.spray"          %% "spray-can"       % sprayVersion,
    "io.spray"          %% "spray-routing"   % sprayVersion,
    "io.spray"          %% "spray-json"      % sprayVersion

  )
}

Please let me know how I can I fix this issue.All your suggestions are valuable. Thanks in advance.

user1548787
  • 101
  • 1
  • 1
  • 8
  • I assume what you mean with partial is just a path part of the url, is it right? Can you check `Host` header of the requests? – Mustafa Simav Apr 11 '16 at 07:11
  • Thanks Mustafa for your reply. It is working properly when I give url through browser and giving problem when I am using console and use wget url. It is because, it is sending through chunk by chunk. – user1548787 Apr 13 '16 at 11:17

0 Answers0