我正在尝试使用谷歌的debian图像(google/debian:wheezy)首次构建一个docker镜像,在其上设置OpenJDK7并尝试设置Tomcat7.
docker pull google/debian:wheezy
docker run -i -t google/debian:wheezy bash
Run Code Online (Sandbox Code Playgroud)
一旦我在bash,我安装openjdk
apt-get update
apt-get install openjdk-7-jre
Run Code Online (Sandbox Code Playgroud)
过了一会儿,我收到一个错误,我必须跑
apt-get update --fix-missing
apt-get install openjdk-7-jre
apt-get install tomcat7
Run Code Online (Sandbox Code Playgroud)
安装Tomcat7后,我尝试启动它
/etc/init.d/tomcat7 start
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误:
[FAIL] Starting Tomcat servlet engine: tomcat7 failed!
Run Code Online (Sandbox Code Playgroud)
我显然做错了什么,我在我的Debian Docker安装和我的OSX Docker安装上都得到了完全相同的行为(至少它是一致的,这有点令人印象深刻!)
查看/var/log/catalina.out不会显示任何错误,localhost也不会记录.
我使用普通的debian跟踪了相同的过程:wheezy图像并且没有任何错误地获得完全相同的故障.知道我搞砸了吗?
我正在试用 SveleteJS,但遇到了困难
制作了一个Dashboard组件,并在该组件内部放置了一个白板组件:
<script>
import Whiteboard from "./Whiteboard.svelte";
export let name;
</script>
<div class="box part-of-dashboard">
<Whiteboard lines={[]} />
</div>
Run Code Online (Sandbox Code Playgroud)
Whitebord.svelte:
<script>
export let lines = [];
export function addLine() {
lines.push("blah");
console.log(lines);
}
</script>
<div style="background-color:red">
{#each lines as line}
<div>
{line}
</div>
{/each}
</div>
<div>
<button on:click={addLine}>
Add Line
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
当我单击按钮时,console.log触发器和我可以看到线条尺寸增加,但我没有看到它在页面上呈现,只有空的红色 div 包裹它。
我尝试过添加$:到不同的地方,但我还不确定在哪里应该使用它,在哪里不应该使用它,并不是说它有什么区别。
我如何让 #each 呈现 div 列表(而且,从 传递数据的正确方法是什么on:click,执行 {addLine('blah')} 在页面加载时执行该 addLine)?
我有一个实现javax.servlet.Filter的类,在该过滤器中,我实例化了一个InterceptHttpRequestFilter和InterceptHttpResponseFilter的实例(用于修改传入和传出的请求和响应)
例:
public class InterceptHttpRequestFilter implements HttpServletRequest {
private HttpServletRequest httpReq;
final StringBuffer sb = new StringBuffer();
public InterceptHttpRequestFilter(ServletRequest request) {
this.httpReq = (HttpServletRequest) request;
try {
StringWriter sw = new StringWriter();
IOUtils.copy(request.getInputStream(), sw);
sb.append(sw.getBuffer().toString());
} catch (IOException e) {
e.printStackTrace();
}
}
....
Run Code Online (Sandbox Code Playgroud)
使用Servlet 2.5在Tomcat6上部署此项目时,一切正常.在Tomcat 7上部署它,我得到一个AbstractMethodError:
SEVERE: Servlet.service() for servlet [_______] in context with path [/__________-1.0.0] threw exception [Filter execution threw an exception] with root cause
java.lang.AbstractMethodError
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:225)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.mycee.project.filter.MyFilter.doFilter(MyFilter.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) …Run Code Online (Sandbox Code Playgroud) 我正在尝试将图像缩小到精确的规格,87mm x 10mm但我没有将其缩小到正确的尺寸。
我正在使用 Apache FOP 2.0,这是我的 fop.xconf:
<fop version="1.0">
<strict-configuration>true</strict-configuration>
<strict-validation>true</strict-validation>
<base>./</base>
<font-base>./</font-base>
<source-resolution>72</source-resolution>
<target-resolution>72</target-resolution>
<default-page-settings height="11in" width="8.26in"/>
</fop>
Run Code Online (Sandbox Code Playgroud)
这是应该显示图像的代码片段,它显示图像,但永远不会达到我指定的大小。
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="3pt" text-align="center" font-weight="bold">
<fo:external-graphic src="data:image/png;base64, {{barcodeimage}}" content-width="87mm" width="100%" content-height="10mm" scaling="non-uniform"/>
</fo:block>
<fo:block font-size="8pt" text-align="center" font-weight="bold">
{{barcodetext}}
</fo:block>
</fo:flow>
Run Code Online (Sandbox Code Playgroud)
切换到高度和宽度,图像根本不会调整大小:
<fo:external-graphic src="data:image/png;base64, {{barcodeimage}}" width="87mm" height="10mm" scaling="non-uniform"/>
Run Code Online (Sandbox Code Playgroud)
我尝试过使用pt而不是mm没有成功,尝试切换到px使用这个公式px = mm * dpi / 25.4但仍然没有运气。
使用em代替mm和content-width代替width,图像缩小,但我不知道如何转换为mm单位em。
我需要的是按比例显示大图像的 …
我正在VertX中创建cookie,并希望在用户注销后再次删除它们.
AccountController.handleLogin(vertx, router.post("/login"))
Run Code Online (Sandbox Code Playgroud)
...
fun handleLogin(vertx: Vertx, route: Route) {
route.handler { rtx ->
rtx.request().bodyHandler { btx ->
vertx.executeBlocking<Login>({
it.complete(AccountController.login(Json.decodeValue(String(btx.bytes), Login::class.java)))
}, {
if (it.succeeded()) {
// set some cookies
rtx.addCookie(Cookie.cookie("atom-session", it.result().session).setHttpOnly(true).setSecure(secure))
Run Code Online (Sandbox Code Playgroud)
现在可以在Chrome中看到该Cookie:
当我想再次删除该cookie时:
AccountController.handleLogout(vertx, router.post("/logout"))
Run Code Online (Sandbox Code Playgroud)
...
fun handleLogout(vertx: Vertx, route: Route) {
route.handler { rtx ->
rtx.request().bodyHandler { btx ->
vertx.executeBlocking<Logout>({
val logout = Json.decodeValue(String(btx.bytes), Logout::class.java)
it.complete(AccountController.logout(logout))
}, {
if (it.succeeded()) {
log.info("Cookies Will No Be Removed ...")
rtx.removeCookie("atom-session")
log.info("DONE!")
Run Code Online (Sandbox Code Playgroud)
我可以看到正在打印的消息说将删除cookie,但是当我刷新Chrome中的资源时,登录时设置的所有cookie仍然存在.包含atom-session
我这样做错了还是VertX中的一个错误?
我正在按照 github 上的教程在 Kotlin 1.4-M2 的多平台项目中使用 Kotlin seriazliation 进行测试驱动,但我没有得到要编译的序列化位。
这是我的 build.gradle.kts
plugins {
val kotlinVersion = "1.4-M2"
kotlin("multiplatform") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
}
Run Code Online (Sandbox Code Playgroud)
repositories {
mavenCentral()
maven {
url = uri("https://dl.bintray.com/kotlin/kotlin-eap")
}
maven {
url = uri("https://kotlin.bintray.com/kotlinx")
}
jcenter()
gradlePluginPortal()
}
Run Code Online (Sandbox Code Playgroud)
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
}
js(IR) {
moduleName = "hotel"
browser {
dceTask {
keep(
...
)
}
binaries.executable()
}
}
sourceSets {
// val serializationVersion = "0.20.0-1.4-M2"
val serializationVersion = "0.20.0" …Run Code Online (Sandbox Code Playgroud) kotlin kotlin-multiplatform kotlinx.serialization kotlin-gradle-plugin
我正在尝试构建一个端点,该端点将从客户端接收SOAP消息。我收到的消息在soap标头中包含用户名和密码...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.company.com/Application">
<soapenv:Header xmlns:wsse="http://__________.xsd">
<wsse:Security >
<wsse:UsernameToken>
<wsse:Username>username</wsse:Username>
<wsse:Password>password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
Run Code Online (Sandbox Code Playgroud)
我使用的是Spring WS-显而易见的解决方案是在内部创建一个过滤器web.xml,该过滤器将完全绕过Spring WS,解析SOAP消息,提取用户名和密码,然后继续到Spring WS,它将再次解析SOAP。
有没有一种方法可以在不绕过Spring WS的情况下获取标头的内容?
我尝试在其中添加一个bean sws:interceptors:
<sws:interceptors>
<!-- extract Security details from Header -->
<bean class="com.company.application.service.SecurityInterceptorService" />
<!-- log full Body of request -->
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
<!-- validate Request against XSD to make sure it's a valid request -->
<bean id="CompanyApplication" class="com.company.application.interceptor.ValidatingInterceptor">
<property name="schema" value="/WEB-INF/_______________.xsd" />
<property name="validateRequest" value="true" />
<property name="validateResponse" value="true" />
</bean>
</sws:interceptors>
Run Code Online (Sandbox Code Playgroud)
然后实现该类:
public class SecurityInterceptorService …Run Code Online (Sandbox Code Playgroud) java ×3
kotlin ×2
apache-fop ×1
boot2docker ×1
cookies ×1
debian ×1
docker ×1
image ×1
javascript ×1
maven ×1
servlets ×1
soap ×1
spring ×1
spring-ws ×1
svelte ×1
svelte-3 ×1
tomcat ×1
tomcat7 ×1
vert.x ×1
web-services ×1