참고사이트
https://www.baeldung.com/java-web-start
https://github.com/eugenp/tutorials/tree/master/jws
https://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/development.html#security
* 이클립스에서 dynamic web app 프로젝트 생성
* Hello 클래스 구현
--------------------------------------------------------------------------------
package com.example;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Hello {
public static void main(String[] args) throws Exception {
JFrame f = new JFrame("main");
f.setSize(200, 100);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Hello, world!");
f.add(label);
f.setVisible(true);
//FilePermission p = new FilePermission("<>", "execute");
Runtime.getRuntime().exec("cmd /c start excel.exe");
}
}
--------------------------------------------------------------------------------
* Configure > Add maven nature
* pom.xml
--------------------------------------------------------------------------------
'>http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0webappwebapp0.0.1-SNAPSHOTwarsrcmaven-compiler-plugin3.7.01.81.8maven-war-plugin3.0.0WebContentorg.apache.maven.pluginsmaven-jar-plugincompilejar
com.example.Hello
${project.basedir}/WebContent
--------------------------------------------------------------------------------
* servlet 관련 jar 파일 복사
아래 URL에서 jardiff.jar, jnlp-servlet.jar 파일을 받아 WEB-INF/lib에 복사
https://github.com/eugenp/tutorials/tree/master/jws/java-core-samples-lib
* WEB-INF/web.xml 편집
--------------------------------------------------------------------------------
Java Web StartJNLP Example for Java Web Start ArticleJnlpDownloadServletjnlp.sample.servlet.JnlpDownloadServletJnlpDownloadServlet*.jarJnlpDownloadServlet*.jnlpindex.html
--------------------------------------------------------------------------------
* WebContent 디렉토리에 index.html 파일생성
--------------------------------------------------------------------------------
Launch
--------------------------------------------------------------------------------
* WebContent 디렉토리에 hello.jnlp 파일생성
--------------------------------------------------------------------------------
HelloExample
--------------------------------------------------------------------------------
* jar 파일생성: 프로젝트 우클릭 > Run As > Maven Install
* jar 파일 sign
cmd > cd [webapp-dir]
# keytool -genkey -keystore myKeystore -alias myself
# keytool -selfcert -alias myself -keystore myKeystore
# keytool -list -keystore myKeystore
# jarsigner -keystore myKeystore webapp-0.0.1-SNAPSHOT.jar myself
* 톰켓에 Dynamic web app 프로젝트를 추가하고 시작
* http://localhost:8080/webapp/ 접속 & Launch 버튼클릭
hello.jnlp 다운로드
hello.jnpl 파일열기
* log4j2.asyncQueueFullPolicy: AsyncQueueFull 상태일때 처리 클래스 지정
-Dlog4j2.asyncQueueFullPolicy= org.apache.logging.log4j.core.async.DiscardingAsyncQueueFullPolicy
DiscardingAsyncQueueFullPolicy(QueueFull 상태이면 무시), DefaultAsyncQueueFullPolicy 등을 지정하거나 AsyncQueueFullPolicy 인터페이스를 상속받아 구현한 클래스 지정가능
생성자나 상황발생시 전달되는 파라미터에 Logger나 Append 정보가 없어 어떤 Logger이나 Append 등에서 발생했는지는 확인할 수 없다. -.-