Remark : 한페이지에서 Ajax 로 데이타 저장시 시간이 많이 걸릴 경우, 버튼이중 클릭시 중복저장됩니다. 버튼 disable 처리는 속성처리라 한번만 가능 ajax async: false 는 추천하지 않는 방식. 버튼에 vaule=”0″ 값 주어 처리
[글쓴이:] 관리자
JMX APIs
Remark : JMX Monitoring Java Management Extensions (JMX) is a technology that lets you implement management interfaces for Java applications. JConsole is a JMX-compliant monitoring tool, which comes with the Java Development Kit (JDK) 1.5 or later versions. Therefore, when you use a WSO2 product, JMX is enabled by default, which allows you to …
JMX APIs 더보기
Log4j
Remark : 프로그램의 로그를 기록해주는 라이브러리로 이클립스, IntelliJ IDEA, 안드로이드 스튜디오 드에 추가 해서 프로그램 실행시 자동으로 지정한 경로에 로그를 저장해 주는 기능 취약점 발견 : JNDI와 LDAP를 이용한 Log4J 취약점 이용 막기 : vi /etc/environment 추가
CentOS7 아파치(Apache2) 톰캣(Tomcat8) 연동
remark : WAS (톱켓) 8080 포트 대신 80 포트로 변환기하 위해 Tomcat Connectors 인 mod_jk를 세팅해 보자. 1. Download Site link : https://tomcat.apache.org/download-connectors.cgi 2. Download /tmp 3. tar 풀기 4. configure 명령어를 이용해서 make 파일 생성 4.1 Error solution 4.2 mod_jk.so file check 5. mod_jk.conf configuration 6. workers.properties configuration 7. Tomcat8 server.xml configuration add 8. …
CentOS7 아파치(Apache2) 톰캣(Tomcat8) 연동 더보기
사이트 Open SSL letsencrypt 세팅 오류
Overview 사이트 Open SSL letsencrypt 세팅 오류 원인 톱켓에서 포트가 다르기 때문에 letsencrypt 에러가 발생 한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
root@localhost:/# sudo certbot --apache -d test.test.co.kr Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for test.test.co.kr Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Failed authorization procedure. test.test.co.kr (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://test.test.co.kr/.well-known/acme-challenge/4VLsecxgL5gDxQz8u5UriG6T7ZieAGkSp9ELg1[111.111.111.111]: "<!doctype html><html lang=\"en\"><head><title>HTTP Status 404 \u2013 Not Found</title><style type=\"text/css\">h1 {font-family:Tahoma,A" IMPORTANT NOTES: - The following errors were reported by the server: Domain: test.test.co.kr Type: unauthorized Detail: Invalid response from http://test.test.co.kr/.well-known/acme-challenge/4VLsecxgL5gDxQz8u5UriG6T7ZieAGkSp9ELg1 [111.111.111.111]: "<!doctype html><html lang=\"en\"><head><title>HTTP Status 404 – Not Found</title><style type=\"text/css\">h1 {font-family:Tahoma,A" To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address. |
[html] explore 에서 화면이 깨지는 경우
chrome 에서 이상 없으나 explore 에서 화면이 깨지는 경우 아래 meta 테그 추가 하면 됩니다.
1 2 3 |
<meta http-equiv="X-UA-Compatible" content="IE=Edge;" /> |
그래도 깨지는 경우 맨위에 dtd 추가 하면 됩니다.
[java] Transformations sample
html 로 보기 persons.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
<breakfast_menu> <food> <name>Belgian Waffles</name> <price>$5.95</price> <description>Two of our famous Belgian Waffles with plenty of real maple syrup</description> <calories>650</calories> </food> <food> <name>Strawberry Belgian Waffles</name> <price>$7.95</price> <description>Light Belgian waffles covered with strawberries and whipped cream</description> <calories>900</calories> </food> <food> <name>Berry-Berry Belgian Waffles</name> <price>$8.95</price> <description>Light Belgian waffles covered with an assortment of fresh berries and whipped cream</description> <calories>900</calories> </food> <food> <name>French Toast</name> <price>$4.50</price> <description>Thick slices made from our homemade sourdough bread</description> <calories>600</calories> </food> <food> <name>Homestyle Breakfast</name> <price>$6.95</price> <description>Two eggs, bacon or sausage, toast, and our ever-popular hash browns</description> |
persons.xsl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?xml version="1.0" encoding="UTF-8"?> <html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE"> <xsl:for-each select="breakfast_menu/food"> <div style="background-color:teal;color:white;padding:4px"> <span style="font-weight:bold"><xsl:value-of select="name"/> - </span> <xsl:value-of select="price"/> </div> <div style="margin-left:20px;margin-bottom:1em;font-size:10pt"> <p> <xsl:value-of select="description"/> <span style="font-style:italic"> (<xsl:value-of select="calories"/> calories per serving)</span> </p> </div> </xsl:for-each> </body> </html> |
XsltTransformation.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import java.io.File; public class XsltTransformation { private static Document document; public static void main(String[] args) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); File xml = new File("D:\\persons.xml"); File xsl = new File("D:\\persons.xsl"); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(xml); // Use a Transformer for output TransformerFactory transformerFactory = TransformerFactory.newInstance(); StreamSource style = new StreamSource(xsl); Transformer transformer = transformerFactory.newTransformer(style); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(System.out); transformer.transform(source, result); } } |
[jsp] The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path 1. 작성중 프로젝트 폴더에서 왼쪽 마우스 -> Properties 선택 2. Proejct Facets -> java -> Runtimes 의 Apache Tomcet v8.0 버전 체크 후 APPLY
[java] HttpURLConnection Get post 로 날려 값 받기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
package test02; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.io.PrintWriter; import java.io.StringWriter; public class test01 { private static final String USER_AGENT = "Mozilla/5.0"; private static final String GET_URL = "https://data.auctionpro.co.kr/airline?code=ke"; private static final String POST_URL = "https://data.auctionpro.co.kr/airline"; private static final String POST_PARAMS = "code=oz"; public static void main(String[] args) throws IOException { sendGET(); System.out.println("GET DONE"); sendPOST(); System.out.println("POST DONE"); } private static void sendGET() throws IOException { URL obj = new URL(GET_URL); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); try { con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); con.setRequestProperty("Content-Length", "length"); //con.setRequestProperty("Accept-Charset", "UTF-8"); int responseCode = con.getResponseCode(); //GET Response Code :: 200 System.out.println("GET Response Code :: " + responseCode); if (responseCode == HttpURLConnection.HTTP_OK) { // success BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(),"UTF-8")); String inputLine = null; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine).append("\r\n"); } in.close(); // print result System.out.println(response.toString()); } else { System.out.println("GET request not worked"); } } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); sw.toString(); // stack trace as a string System.out.println(sw.toString()); } finally { if (con != null) { con.disconnect(); } } } private static void sendPOST() throws IOException { URL obj = new URL(POST_URL); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); try { con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); // For POST only - START con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(POST_PARAMS.getBytes()); os.flush(); os.close(); // For POST only - END int responseCode = con.getResponseCode(); System.out.println("POST Response Code :: " + responseCode); if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(),"UTF-8")); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine).append("\r\n");; } in.close(); // print result System.out.println(response.toString()); } else { System.out.println("POST request not worked"); } } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); sw.toString(); // stack trace as a string System.out.println(sw.toString()); } finally { if (con != null) { con.disconnect(); } } } } |
[jsp] 페이지 이동 방법
페이지 이동 방법 1. Forward – request 스코프에 담긴 값이 다음 페이지에 전달된다. – 이동된 페이지지 주소가 화면에 안보임(기존 페이지 주소와 같음)
1 2 3 4 5 6 7 8 9 |
1) <% pageContext.forward("https://google.com"); %> 2) <jsp:forward page="https://google.com"/>; 3) <% RequestDispatcher rd = request.getRequestDispatcher("https://google.com"); rd.forward(request.response); %> |
2. Redirect – 클라이언트가 새로운 페이지를 요청한 것과 같이 페이지 이동 – 이동된 페이지지 주소가 화면에 보임(기존 페이지 주소와 다름)
1 2 3 4 5 |
<% response.sendRedirect("https://www.google.com"); %> |
참조 : https://installed.tistory.com/entry/8-JSP-%ED%8A%B9%EC%A0%95%ED%8E%98%EC%9D%B4%EC%A7%80%EB%A1%9C-%EC%9D%B4%EB%8F%99%EB%B0%A9%EB%B2%95