我想使用类似http服务器的akka-http(例如tomcat或nginx服务器).
使用这个简单的代码可以从Web浏览器加载html源代码,但无法加载链接在html文件上的其他源代码.
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import scala.io.StdIn
object MainRunner extends App {
implicit val system = ActorSystem("mySystem")
implicit val materializer = ActorMaterializer()
implicit val ec = system.dispatcher
val staticResources =
get {
path("admin") {
getFromResource("admin/index.html")
} ~ pathPrefix("admin") {
getFromResourceDirectory("admin")
}
}
val bindingFuture = Http().bindAndHandle(staticResources, "localhost", 8080)
println(s"Server online at http://localhost:8080/\nPress RETURN to stop...")
StdIn.readLine() // let it run until user presses return
bindingFuture
.flatMap(_.unbind()) // trigger unbinding from the port
.onComplete(_ => system.terminate()) …
Run Code Online (Sandbox Code Playgroud) 我有使用Spring开发Java Web应用程序的经验,但与SOA的世界不同.我正在阅读有关SCA-SCA4J的内容 - http://www.service-conduit.org/user-guide.pdf - 其中很多内容与Spring非常相似.
我试图了解SCA将会有什么用处,但仍然不了解SCA提供的使用Spring独立版的功能/优点.
我找到了这篇旧博客文章 - http://rajith.2rlabs.com/2007/08/05/sca-vs-spring-a-reply-to-dans-post/ - 但是没有什么能够从SOA中脱颖而出行话.
我很感激,如果有人能给出一个更适合春天开发人员的解释(他在SOA术语/方法论的世界里非常环保).
谢谢
我在build.gradle中使用以下配置来运行HP Fortify扫描:
// Fortify configuration
configurations {
fortify { extendsFrom compile }
}
// pull in the fortify libs for the new configuration
dependencies {
fortify 'com.fortify:sourceanalyzer:3.90'
}
task fortifyReport(dependsOn: compileJava) << {
ant.properties['build.compiler']='com.fortify.dev.ant.SCACompiler'
ant.typedef(name: 'sca', classname: 'com.fortify.dev.ant.SourceanalyzerTask', classpath: configurations.fortify.asPath)
ant.sca(jdk:"1.7",
debug:true ,
verbose:true ,
failonerror:true ,
scan:true ,
logFile:file("$buildDir/reports/fortify/Fortify.log"),
resultsFile:file("$buildDir/reports/fortify/${project.name}.fpr")
){
fileset(dir:'src/main') {
include(name:'**/*.java')
}
}
}
Run Code Online (Sandbox Code Playgroud)
但在执行时,我得到以下内容:
* What went wrong:
Execution failed for task ':fortifyReport'.
> Could not resolve all dependencies for configuration 'detachedConfiguration157'.
> Could not …
Run Code Online (Sandbox Code Playgroud)