New issue

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

Encoding problems (not using encoding from WSDL but defaults to dispatch's default?) #231

Closed
hedefalk opened this Issue Dec 16, 2013 · 5 comments

Comments

Projects
None yet
3 participants
@hedefalk

This comment has been minimized.

Show comment
Hide comment
@hedefalk

hedefalk Dec 16, 2013

Awesome! Thanks a bunch!

Awesome! Thanks a bunch!

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Dec 16, 2013

Owner

It's funny @jcranky had already found a workaround 2 month ago and reported it as dispatch/reboot#68

Owner

eed3si9n commented Dec 16, 2013

It's funny @jcranky had already found a workaround 2 month ago and reported it as dispatch/reboot#68

@hedefalk

This comment has been minimized.

Show comment
Hide comment
@hedefalk

hedefalk Dec 16, 2013

Cool!

Do I understand it correctly that a temporary workaround for me using scalaxb would then be to do:

trait DispatchHttpClients extends HttpClients {
  lazy val httpClient = new DispatchHttpClient {}

  trait DispatchHttpClient extends HttpClient {
    import dispatch._

    def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
      val req = url(address.toString).setBodyEncoding("encoding") << in <:< headers
      val s = Http(req > as.String)
      s()
    }
  }
}

Cool!

Do I understand it correctly that a temporary workaround for me using scalaxb would then be to do:

trait DispatchHttpClients extends HttpClients {
  lazy val httpClient = new DispatchHttpClient {}

  trait DispatchHttpClient extends HttpClient {
    import dispatch._

    def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
      val req = url(address.toString).setBodyEncoding("encoding") << in <:< headers
      val s = Http(req > as.String)
      s()
    }
  }
}
@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Dec 16, 2013

Owner

I haven't tried it yet, but think it would look like:

package scalaxb

trait DispatchHttpClients extends HttpClients {
  lazy val httpClient = new DispatchHttpClient {}

  trait DispatchHttpClient extends HttpClient {
    import dispatch._, Defaults._
    val http = new Http()

    def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
      val req = url(address.toString).underlying({ _.setBodyEncoding("UTF-8") }) << in <:< headers
      val s = http(req > as.String)
      s()
    }
  }
}
Owner

eed3si9n commented Dec 16, 2013

I haven't tried it yet, but think it would look like:

package scalaxb

trait DispatchHttpClients extends HttpClients {
  lazy val httpClient = new DispatchHttpClient {}

  trait DispatchHttpClient extends HttpClient {
    import dispatch._, Defaults._
    val http = new Http()

    def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
      val req = url(address.toString).underlying({ _.setBodyEncoding("UTF-8") }) << in <:< headers
      val s = http(req > as.String)
      s()
    }
  }
}
@jcranky

This comment has been minimized.

Show comment
Hide comment
@jcranky

jcranky Dec 18, 2013

My problem was that before reboot, it was possible to set the encoding directly. On reboot, the option simply disappeared.

So, you do need the underlying - or you can use the toRequestBuilder method. I guess both are the same: they give you access to an async-http-client object, which contain the setRequestEncoding method.

I don't know how automatically scalaxb handle this, but the problem happened to me in a context completely independent of it. =)

jcranky commented Dec 18, 2013

My problem was that before reboot, it was possible to set the encoding directly. On reboot, the option simply disappeared.

So, you do need the underlying - or you can use the toRequestBuilder method. I guess both are the same: they give you access to an async-http-client object, which contain the setRequestEncoding method.

I don't know how automatically scalaxb handle this, but the problem happened to me in a context completely independent of it. =)

@ghost ghost assigned eed3si9n Jan 6, 2014

@eed3si9n eed3si9n closed this in 66af83c Jun 8, 2014

eed3si9n added a commit that referenced this issue Jun 9, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment