..
전체 (270)
로컬PC에 파일 일괄다운로드
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package common;
 
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
 
public class FileLocalDownload {
 
    /**
     * 버퍼 사이즈
     */
    final static int size = 1024;
 
 
    public static void fileUrlReadAndDownload(String fileAddress, String localFileName, String downloadDir) {
        OutputStream outStream = null;
        URLConnection uCon = null;
        InputStream is = null;
        try {
            System.out.println("-------Download Start------");
            URL Url;
            byte[] buf;
            int byteRead;
            int byteWritten = 0;
            Url = new URL(fileAddress);
            outStream = new BufferedOutputStream(new FileOutputStream(downloadDir + "\\" + localFileName));
            uCon = Url.openConnection();
            is = uCon.getInputStream();
            buf = new byte[size];
            while ((byteRead = is.read(buf)) != -1) {
                outStream.write(buf, 0, byteRead);
                byteWritten += byteRead;
            }
            System.out.println("Download Successfully.");
            System.out.println("File name : " + localFileName);
            System.out.println("of bytes  : " + byteWritten);
            System.out.println("-------Download End--------");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                is.close();
                outStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
 
    /**
     * 
     * @param fileAddress
     * @param downloadDir
     */
    public static void fileUrlDownload(String fileAddress, String downloadDir) {
        int slashIndex = fileAddress.lastIndexOf("filename=");
        int periodIndex = fileAddress.lastIndexOf(".");
        // 파일 어드레스에서 마지막에 있는 파일이름을 취득
        String fileName = fileAddress.substring(slashIndex + 9);
        if (periodIndex >= 1 && slashIndex >= 0 && slashIndex < fileAddress.length() - 1) {
            fileUrlReadAndDownload(fileAddress, fileName, downloadDir);
        } else {
            System.err.println("path or file name NG.");
        }
    }
    
    public static List getResult(ResultSet rs) throws Exception
    {
        ResultSetMetaData rsmd = rs.getMetaData(); //resultSet의 컬럼정보를 가져온다.
        int columnCount = rsmd.getColumnCount();   //컬럼 갯수
        ArrayList hashMapList = new ArrayList();
 
        HashMap columnMap= new HashMap(); //DB의 Field의 정보 모음
 
        //column 정보 담기
        for(int i = 1; i <= columnCount; i++) {
            String sTypeStr ="string";
            columnMap.put(rsmd.getColumnName(i).toLowerCase(), sTypeStr);
        }
 
        //row 담기
        while(rs.next()) {
            HashMap hashMap= new HashMap();
            Iterator iter = columnMap.keySet().iterator();
            while(iter.hasNext()) {
                String key = (String)iter.next();
                hashMap.put(key.toLowerCase(), rs.getString((key)));
            }
            hashMapList.add(hashMap);
        }
 
        return hashMapList;
    }
 
    public static void main(String[] args) throws Exception {
        
        Connection cn = null;
        String s_id            = "id"/* 수정 : DB정보수정 */
         String s_pwd        = "pwd"/* 수정 : DB정보수정 */
        String jdbc_driver = "oracle.jdbc.driver.OracleDriver";
        String jdbc_url = "jdbc:oracle:thin:@ip:port:sid"/* 수정 : DB정보수정 */
        try{
            Class.forName(jdbc_driver);
            cn = DriverManager.getConnection(jdbc_url, s_id, s_pwd);
        }
        catch(Exception e) {
            System.out.println(e);
        }
        
        ResultSet rs    = null;
        String sql;
        PreparedStatement pstmt = null;
        Statement  st = null;
        List dataList = null;
        List<HashMap> resultList = new ArrayList();
        
        sql = " select filename, realfilename from file_info_table "/* 수정 : SQL 작성하기 */
        
        pstmt = cn.prepareStatement(sql);
        rs = pstmt.executeQuery();
        
        if(rs != null ){
            dataList = getResult(rs);
        }
        
        String downDir = "C:/download"/* 수정 : 다운로드받을 경로 작성 */
        
        for(int i=0; i < dataList.size(); i++){
            HashMap temp = (HashMap)dataList.get(i);
            String url = "http://filedownloadsite.com/filedown.do?filename="+temp.get("realfilename"); /* 수정 : 다운로드받을 url넣기 */
            fileUrlReadAndDownload(url, String.valueOf(temp.get("filename")), downDir);
        }
    }
}
 
cs

'DEV > java' 카테고리의 다른 글

System property file encoding  (0) 2017.10.19
gmail smtp mail발송  (0) 2017.08.22
특수문자 변환  (0) 2017.07.13
  Comments,     Trackbacks
화질 손상없이 이미지 사이즈 줄이기
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

http://picresize.com/

또는 

그림판으로 줄이기

비율로 50% 줄이면 이미지가 매끄럽게 줄어든다.

'DEV > 개발관련 툴' 카테고리의 다른 글

파일질라 jsp파일만 다운로드 받기  (0) 2017.11.08
내컴퓨터 폴더/파일검색 유틸리티(everything)  (0) 2017.08.14
웹 포토샵  (0) 2017.08.14
  Comments,     Trackbacks
webtob WEB-INF 접근 제한 처리
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

# http.m

vhost1          HostName = "xxx.xxx.xxx.xxx",

                   URLRewriteconfig = "~~/tmaxweb/webtob/config/rewrite.conf"



vi rewrite.conf

"rewrite.conf" 1 행, 61 문자 

RewriteRule /[wW][eE][bB]-[iI][nN][fF]/* /forbidden.html [F]


https://technet.tmaxsoft.com/upload/download/online/webtob/pver-20150203-000001/administrator/ch04.html#d4e9598


로그로 403으로 접근거부 뜨는지 확인

tail -f access_yyyymmdd.log | grep xml

xxx.xxx.xxx.xxx - - [dd/mm/yyyy:12:41:28 +0900] "GET /WEB-INF/web.xml HTTP/1.1" 403 xxx

'DEV > WEB WAS' 카테고리의 다른 글

WAS 특정 포트로 접속하기  (0) 2017.11.21
virtualbox solaris 10 / ffmpeg 설치하기  (0) 2017.07.13
jeus webadmin 패스워드  (0) 2014.02.05
  Comments,     Trackbacks
WebtoB / JEUS 간단 운영법
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

#################################

# webtob

#################################


# 이미지 교체 후 반영이 안되는 경우 

 cacherefresh (cr)

WebtoB의 HTTP 응답 캐시에 저장된 응답들을 제거한다.

  • 사용법

    > cacherefresh {-a | -h | -i | -j | -r | -u URL}

    옵션설명
    [-a]캐시된 모든 응답을 제거한다.
    [-h]SVRTYPE이 HTMLS로 처리된 후 캐시된 HTML과 유사 텍스트 응답만 제거한다.
    [-i]SVRTYPE이 HTMLS로 처리된 후 캐시된 IMAGE 타입 응답만 제거한다.
    [-j]SVRTYPE이 JSV으로 처리된 후 캐시된 응답만 제거한다.
    [-r]Reverse Proxy로 처리된 후 캐시된 응답만 제거한다.
    [-u URL]캐시된 응답 중 URL을 지정하여 (fnmatch 방식으로) 매칭된 응답만 제거한다.
  • 예제

    다음은 캐시에 저장된 모든 응답을 제거하는 예제이다.

    $$1 webtob (wsadm) [2014/08/06:14:12:16]:  cacherefresh -a

    다음은 캐시에 저장된 응답 중 "test.domain.com/test.html"을 제거하는 예제이다.

    $$2 webtob (wsadm) [2014/08/06:14:12:26]:  cacherefresh -u test.domain.com/test.html

WebtoB / JEUS 간단 운영법
[출처] http://oneshot.textcube.com/36
===================================================
WebtoB 설치 디렉토리 : /user2/handyr5/webtob
        환경설정파일 : /user2/handyr5/webtob/config/http.m
JEUS 설치 디렉토리   : /user2/handyr5/jeus
   JEUS 환경설정파일 : /user2/handyr5/jeus/config/incheon/JEUSMain.xml (엔진구성 설정)
                       /user2/handyr5/jeus/config/incheon/incheon_servlet_engineX/WEBMain.xml (서블릿 엔진 설정)
 

WebtoB 기동 : $ wsboot
WebtoB 종료 : $ wsdown  (wsdown -i)
* WebtoB는 80포트로 기동되므로 반드시 root로 기동/종료 하여야 한다(현재 8090포트).
 
JEUS 기동   : $ jboot
JEUS 종료   : $ jdown
* JEUS는 반드시 handyr5로 기동/종료 하여야 한다.
 
 
 
**** 모니터링 ****
 
WebtoB(Web Server)
-------------------------------------------
$ wsadmin
> ci -s         동시 접속자 수(browser)
Total Connected Clients = 357
 
> st -s         서비스 상태(수행속도, 요청횟수, 큐잉 등..)
 
 
 
JEUS(WAS)
-------------------------------------------
* jeusadmin
$ jeusadmin `hostname` -Uadministrator -Pjeusadmin
형식 : jeusadmin 호스트명 -U<계정> -P<암호>
 
handy1>pidlist              pid 조회
handy1_container1 : 13722
 
 
* webadmin
$ webadmin `hostname`_servlet_engine1 -U administrator -P jeusadmin
> st            엔진 상태
< memory information >
VM Total Memory    = 535691264 Bytes
VM Free Memory     = 460284912 Bytes
 

> ti           thread info
-- Thread State [MyGroup-hth1(112.100.10.2:19901)] --
[MyGroup-hth1(112.100.10.2:19901)-w0][waiting, wt=2482 ms]
[MyGroup-hth1(112.100.10.2:19901)-w1][active , rt=28322 ms, uri=/servlet/HIServlet]
[MyGroup-hth1(112.100.10.2:19901)-w2][waiting, wt=2128 ms]
....
    wt : waiting time(ms)
    rt : running time(ms)
    uri : 요청 url
 

로그
$WEBTOBDIR/log/ access log가 날짜별로 생성됨
$JEUS_HOME/logs/JeusServer/ JEUS system log가 날짜별로 생성됨. 날짜별 로그.log
               /엔진별로그/... / accesslog / JEUS servlet engine 의 accesslog(수행시간)
 

###### alias #####
alias jcfg 'cd $JEUS_HOME/config/`hostname`'                            JEUSMain.xml이 있는 위치로 이동
alias scfg 'cd $JEUS_HOME/config/`hostname`/`hostname`_servlet_engine1' WEBMain.xml이 있는 위치로 이동
alias scfg1 'cd $JEUS_HOME/config/`hostname`/`hostname`_servlet_engine1'
alias scfg2 'cd $JEUS_HOME/config/`hostname`/`hostname`_servlet_engine2'
alias wcfg 'cd $WEBTOBDIR/config'                                       http.m이 있는 위치로 이동
alias jlog 'cd $JEUS_HOME/logs/JeusServer'                              JEUS system log가 있는 위치로 이동
alias logs 'cd $JEUS_HOME/logs'                                         JEUS 의 로그 디렉토리로 이동
alias vlog 'tail -f $JEUS_HOME/logs/JeusServer/JeusServer_`date +%m%d%Y`.log'   tail -f JEUS_system_log
 
 
 
###### thread dump 뜨는 법 #####
ti 정보를 조회할 때 수행시간이 너무 오래 걸리는 것이 있거나
모든 thread가 full 되어서 서비스가 너무 느려지는 경우
현재 thread의 상태를 조회해서 thread가 어떤 상태인지 조회해 볼수 있다.
java process에 kill -3을 수행하면 해당 jvm 내의 모든 thread의 정보가
JEUS system log에 남겨진다.
위의 pid 조회 방법을 참고로 하여 java process의 pid를 조회한 후
 
$ kill -3 [java_pid]
 
를 수행하면 된다.
즉시 조회하고 싶으면 다른 telnet 창에서 vlog를 수행한 후
kill -3을 수행하면 된다.
 
운영중 문제가 발생하는 경우 thread dump와 로그는 아주 유용한 정보가 되므로
장애발생시 반드시 3~5초 간격으로 3번 정도 thread dump를 남겨서 
엔지니어에게 전달하도록 한다.

'DEV > unix linux' 카테고리의 다른 글

리눅스 레드헷 세션 타임아웃 무제한으로 변경  (0) 2017.11.21
서버정보 확인 - 솔라리스 기준  (0) 2014.02.28
cmd 명령어 정리  (0) 2013.12.19
  Comments,     Trackbacks
gmail smtp mail발송
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/

  Comments,     Trackbacks
프로토콜
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

SMTP

간이 전자 우편 전송 프로토콜(Simple Mail Transfer Protocol, SMTP)은 인터넷에서 이메일을 보내기 위해 이용되는 프로토콜이다. 

사용하는 TCP 포트번호는 25번이다.


IMAP, POP3

IMAP와 POP3는 아웃룩(Outlook), 썬더버드(Thunderbird), 

안드로이드 기본 이메일 앱과 같은 메일 클라이언트에서 이메일에 접속하고자 할 때 사용하는 프로토콜이다.

  Comments,     Trackbacks
내컴퓨터 폴더/파일검색 유틸리티(everything)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

자신의 로컬 PC내의 폴더/파일을 찾을때 유용하다.

폴더/파일을 인덱싱 후 검색을 하기 때문에 속도가 엄청 빠르다.

http://www.voidtools.com/ko-kr/

'DEV > 개발관련 툴' 카테고리의 다른 글

화질 손상없이 이미지 사이즈 줄이기  (0) 2017.08.30
웹 포토샵  (0) 2017.08.14
Open Source APM scouter(스카우터)  (0) 2017.08.03
  Comments,     Trackbacks
웹 포토샵
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개발자가 임시방편으로 이미지버튼 같은 간단한 작업을 하기엔 충분한 포토샵 

https://pixlr.com/editor/

'DEV > 개발관련 툴' 카테고리의 다른 글

내컴퓨터 폴더/파일검색 유틸리티(everything)  (0) 2017.08.14
Open Source APM scouter(스카우터)  (0) 2017.08.03
샤크라  (0) 2014.12.05
  Comments,     Trackbacks
Open Source APM scouter(스카우터)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

제니퍼와 같은 APM을 무료로 사용할 수 있다.

apm open source scouter

https://github.com/scouter-project/scouter/blob/master/scouter.document/main/Quick-Start_kr.md

'DEV > 개발관련 툴' 카테고리의 다른 글

웹 포토샵  (0) 2017.08.14
샤크라  (0) 2014.12.05
제니퍼 팁  (0) 2013.11.29
  Comments,     Trackbacks
Oracle SQL Developer 단축키
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

정렬 : ctrl + F7

'DEV > 개발관련 툴 단축키' 카테고리의 다른 글

erwin tip  (0) 2016.08.02
노트북 마우스 패드 끄기  (0) 2015.02.16
한글 자주사용하는 단축키 정리  (0) 2014.11.28
  Comments,     Trackbacks