Skip to content

Instantly share code, notes, and snippets.

View timperrett's full-sized avatar
🚧

Timothy Perrett timperrett

🚧
View GitHub Profile
val _rawResponseStream: InputStream = post.getResponseBodyAsStream()
val processedResponse: List[String] = getProcessedResponse
private var _outputList: List[String] = List()
private def getProcessedResponse: List[String] = {
var _readStream: BufferedReader = new BufferedReader(
new InputStreamReader(_rawResponseStream)
)
package net.liftweb.paypal
import net.liftweb.util.Helpers
import Helpers._
import net.liftweb.util._
import _root_.org.apache.commons.httpclient._
import _root_.org.apache.commons.httpclient.methods._
import _root_.java.io._
/**
NameError (uninitialized constant MyModule::Job::GetStatus):
/vendor/rails/activesupport/lib/active_support/dependencies.rb:442:in `load_missing_constant'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:77:in `const_missing'
/lib/mymodule/job/base.rb:14:in `status'
/app/controllers/visitors_controller.rb:73:in `get_job_status'
/vendor/rails/actionpack/lib/action_controller/base.rb:1253:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:1253:in `perform_action_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/**
* Get the resource bundle for the current locale
*/
def resourceBundles: List[ResourceBundle] = {
_resBundle.value match {
case Nil => _resBundle.set(LiftRules.resourceNames.flatMap(name => tryo(
List(ResourceBundle.getBundle(name, locale))
) openOr Nil))
_resBundle.value
case bundles => bundles
def resourceBundles: List[ResourceBundle] = {
_resBundle.value match {
case Nil => {
_resBundle.set(LiftRules.resourceNames.flatMap(name => tryo(
List(ResourceBundle.getBundle(name, locale))
).openOr(
LiftRules.resourceBundleFactories.toList.find(_.isDefinedAt(locale)).toList.map(_.apply(locale))
)))
_resBundle.value
}
LiftRules.resourceBundleFactories.prepend {
case locale if locale.getISO3Language == "eng" => new MyResources
case locale if locale.getISO3Language == "swe" => new MyResources_sv
case locale =>
}
def buildSetStringValue(accessor : Method, columnName : String): (T, String) => Unit = (inst, v) => doField(inst, accessor, {case f: MappedText[T] =>
val toSet = v match {
case null => null
case other => other
}
f.data() = toSet
f.orgData() = toSet
})
// set the locale calculator
LiftRules.localeCalculator = Localizer.localeCalculator _
// bundle factor
LiftRules.resourceBundleFactories.prepend {
case (basename, locale) if localeAvalible_?(locale) => CacheResourceBundle(locale)
case _ => CacheResourceBundle(new java.util.Locale("en","GB"))
}
bind("reg", xhtml,
"passwordField" -> text("", Pilot.password(_)) % ("size" -> "8") % ("id" -> "passwordField")
)
val myReWriter: LiftRules.RewritePF = NamedPF("DemoBind") {
case RewriteRequest(ParsePath("user" :: id :: Nil, "", true, false), GetRequest, _) => {
RewriteResponse(ParsePath("path" :: "to" :: "template" :: Nil, "", true, false), Map("id" -> id))
}
}
LiftRules.rewrite.append(myReWriter)