노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

 

표준 프레임워크 개발 환경 구성: 원문링크1, 참조링크1

1. Eclipse설치: Download 64bit

2. Eclipse설치가 되면, Spring Core IDE설치:  dist.springframework.org/release/IDE

3. Eclipse설치가 되면, eGovFramework, 표준 프레임워크 설치

1) 3.8 : maven.egovframe.kr:8080/update_3.8

2) 3.5.1 : maven.egovframe.kr:8080/update

*설치후에 Perspective추가

*필수, 추가 설치: 참조링크

--JUnit(이클립스에 포함되어 설치됨)

--UML2 Extention

download.eclipse.org/releases/xxxxxxx,  Modeling->UML2 Extender SDK

--Subversive SVN Team Provider/ SVN Connector

: polarion download, Latest Stable Bulld for Eclipse

 

eGovFrame, New Web Project 만들기, 원문링크

-- Tomcat 8+, JDK 7+, Eclipse 2019-06, eGov 3.7 +, Spring Framework 4.2+, Maven 4.0+

-- 프로젝트 생성 에러: Java 버젼 및 Path 확인

--pom.xml 에러: Failed to read artifact xxxxx egovframework.rte xxxx 3.5.0

: 표준 프레임웍 레파지토리 주소 변경, 원문링크

: www.egovframe.go.kr/maven ==> maven.egovframe.kr:8080/maven/ 

 

-- web.xml Missing 에러 : src/main/webapp/WEB-INF/에 web.xml생성

 

# 기타, 실행 환경 Migration (3.5 -> 3.6)

 

egovframework:rtemigration3.6 [eGovFrame]

표준프레임워크 3.6는 기존 표준프레임워크 3.X와의 호환성을 염두해두고 실행환경의 버전 업그레이드를 진행하였으나, 전체 오픈소스SW 업그레이드에 따라 일부 변경이 필요합니다. 또한, 각 프로젝트의 상황 및 환경에 따라서 버전 업그레이드에 따른 충돌, 버그, 불안정성이 발생할 수도 있으니 충분한 테스트 후 진행하시기 바랍니다. 표준프레임워크 3.6는 JDK 1.7이 필요합니다. 이에 따라 우선 관련된 WAS 등 적용되어 있는 SW 등이 JDK 1.7을 지

www.egovframe.go.kr

 

# eGovFrame 버젼별 차이

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

# 이클립스에서 메이븐 프로젝트 만들기 ( Create a Meven Web Project with Eclipse)

 

 

>> 참조

# 이클립스에서 메이븐 참조 추가 (Import Maven Preferences in Eclipse)

-- 메이븐 원격 archetype 목록을 이클립스에서 import

 

>> 참조

* https://search.maven.org에서 검색 결과(June 2019)

# Web Application 프로젝트 개발 순서 (예제)

1.Create Maven Web Application

2.Add Dependencies - pom.xml File

3.Project Structure : Class Diagram

4.AppInitializer - Register a DispatcherServlet using Java-based Spring configuration

5.PersistenceJPAConfig - Spring and Hibernate Integration using Java-based Spring configuration

6.WebMvcConfig - Spring MVC Bean Configuration using Java-based Spring configuration

7.JPA Entity - Customer.java

8.Spring MVC Controller Class - CustomerController.java

9.Service Layer - CustomerService.java and CustomerServiceImpl.java

10.DAO Layer - CustomerDAO.java and CustomerDAOImpl.java 11 JSP Views - customer-form.jsp and list-customers.jsp

11.Serve Static Resources - CSS and JS

12.Build and Run an application

>> Class Diagram

-- AppInitializer, AppContext, WebMvcConfig

-- CustomerController, Customer

-- CustomerServiceImpl, CustomerService

-- CustomerDAOImpl, CustomerDAO

>> 참조

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

# 설정

1.그룹(채팅)을 개설하고,

2. LINE Notify를 그룹 멤버로 초대하고,

3. https://notify-bot.line.me에 로그인하고, MyPage에서 해당 그룹에 대한 Token을 발행

 

# 구현 예제, 코드

4. 프로그램 작성(Java) : https://github.com/sketchout/GroupNotifyLINE

 

# 참조

> 슬랙(Slack) 메신저로 메시지(알림) 보내기

https://blog.naver.com/macyoo/221388852982

 

'Web Tech. > Spring Framework' 카테고리의 다른 글

전자 정부 프레임웍, 설치 with MacBook  (0) 2019.08.08
Maven Project 생성하기  (0) 2019.06.28
thread-safe하도록 servlet작성하기  (0) 2018.07.20
Tomcat Memory Leak  (0) 2018.07.18
Java Spring + Slack Web Hook API  (0) 2018.03.13
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

Cloud9 Ruby, DB 변경 하기 (sqlite3 -> mysql )



1. 기본 Template선택


2. MySQL 설치하기



3. Config변경하기

- 복사본 만들기 : cp config/database.yml config/database.yml.sqlite3

- Gemfile추가하기 : gem 'mysql2' 

- bundle 설치 : bundle install

- config/database.yml 변경하기

4. Database생성하기

> mysql-ctl cli

> create database scaffold2_development;

> create database scaffold2_test;


5. Table 생성하기

- bash 쉘 열기

>rake db:migrate



6. rake db:migrate 오류 발생시 


- Rails Specified 'mysql2' for database adapter, but the gem is not loaded.


https://medium.com/sudogem/rails-specified-mysql2-for-database-adapter-but-the-gem-is-not-loaded-add-gem-mysql2-to-your-gemfile-d35bb40eb961


#gem 'rails', '4.2.5'

#gem 'mysql2', '~> 0.3.20'


* Scaffold 프로젝트 생성하기


>rails g scaffold post title:string content:string

>rake db:migrate


# Run Project

# Preview


'Web Tech. > Ruby on Rails' 카테고리의 다른 글

Cloud9 Ruby Rails의 MySQL설정  (0) 2018.10.11
Ruby on Rails 설치하기 ( VMware + Ubuntu )  (0) 2018.04.17
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Cloud9 Ruby Rails의 MySQL설정


1. c9 가입후 workspace생성


- Ruby template은 sqlite3로 설정되어서, Blank template를 선택

- Workspace Name은 'ror'로 임의 부여



2. Terminal에서 MySQL 사용 설정

- mysql-ctl install 실행


mysql-ctl cli를 통해 mysql console 접속(show databases등 명령어 실행)


3. Rails 설치 

: gem install rails


4. Ruby on Rails MySQL 프로젝트 생성

 : rails new scaffold1 -d mysql



5. Database 생성하기

 : mysql-ctl cli로 console접속


- create database scaffold1_development

- create database scaffold1_test



6. config/database.yml 수정 (필요한 부분)


- username : <%= ENV['C9_USER'] %>

- database :

- host : 


7. 서버 실행 

- rails -s -b $IP -p $PORT


8. 접속 주소 확인 

: 메뉴상의 Preview를 통해서 확인

 

9. MVC패턴으로 만들기

Controller생성>rails g controller home
Action 만들기

: 요청을 받고 이를 처리하는 최소 단위
app/controllers/home_controller.rb

def index
end
Action에 대응하는 View 생성하기
app/view/home/index.html.erb

<h1>Hello, World</h1>
Layout (기본 제공)
app/views/layout/application.html.erb

<%= yield %>
Route 명시하기

: 특정 경로를 Controller의 Action에 매칭
HttpType(get,post) 'path'=>'Controller#action'
config/routes.rb

get '/'=>'home#index'



블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

thread-safe하도록 servlet작성하기


만약 자바로 웹 어플리케이션을 작성한다면, 서블릿이 가장 친숙한다. JSP로 작성하거나 일반 서블릿으로 작성하든 관계 없이, 서블릿이 제공하는 장점을 받게 된다.

thread-safe라는 것은? 여러 thread가 프로그램의 단일 instance을 실행하여, 메모리를 공유할때, 동일한 위치(영역, 값)를 읽고 쓰려고 시도 할 수 있습니다.


자바 프로그램과 마찬가지로 서블릿은 JVM내에서 실행되어야 하지만, 웹 어플리케이션의 경우 서블릿 컨테이너가 HTTP요청이 들어 오는 곳에서 처리를 합니다.
서블릿의 생명주기의 상당 부분을 프로그래머가 제어 할 수 없고, 생성 및 파괴시에 메모리 사용에 대해 걱정하지 않는다. 
Google이나 Amazon처럼 많은 각 요청에 대해 서블릿은 인스턴스화를 하는 것은 실용적이지 않으며, 서블릿 컨테이너가 multi thread를 처리합니다.



1. thread-safe하냐?

변수 counter는 인스턴스 변수이고, 클래스내에서 정의되어, 클래스 인스턴스에 속합니다.
이 값은 method호출간에 유지되며, 문제는 서블릿 컨테이너가 multi thread이고, 다중 요청을 위해 서블릿의 단일 인스턴스를 공유한다는 점이다.

이 서블릿을 동시에 실행할때 어떤 일이 발생하는지 살펴보자. 처리에 지연을 위해 sleep()를 사용한다. HTML프레림을 사용하여 동시 요청을 만듭니다.

쓰레드 안전하지 않은 서블릿 코드는 다음과 같은 결과를 생성한다.

2.첫번째 방어 : 회피

각 쓰레드에 대해 고유한 변수 인스턴스를 갖도록하기 위해 클래스 내에서 변수 선언한 내용을 method내로 변수 선언을 이동하기만 하면 된다. 차이점은 method에 대한 각 호출에 대해 새 변수가 만들어진다.

3.두번째 방어: 부분 동기화

쓰레드 동기화는 알아야 할 중요한 기술이지만, 필요하지 않으면 이걸 솔루션으로 채택하지 마세요. 코드 블록을 동기화 할때마다 시스템에 병목 현상이 발생합니다. 코드 블록을 동기화할때, 주어진 순간에 동기화된 코드 블록내에 하나의 스레드만 있을 수 있다고 JVM 알려줍니다. 다중 쓰레드에서 동기화된 코드 블록으로 스레드가 실행되면, 2번째 스레드는 1번쨰 스레드가 해당 블록을 종료할때까지 대기해야 합니다.

4.마지막 방어: 전체 동기화

서블릿 컨테이너에 쓰레드가 안전하지 않다는 것을 알려주기 위해서, 빈 인터페이스를 구현해야 합니다. 구현하려는 tag는 SingleThreadModel인터페이스 입니다. 인터페이스를 적용하면, 2개의 쓰레드가 동시에 실행 될 수 없음을 보장 합니다. (블록이 발생하므로, 되도록 사용하면 안되겠죠?)

원문 : Jul 12, 2004
https://www.javaworld.com/article/2072798/java-web-development/write-thread-safe-servlets.html?page=2 

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

Tomcat Memory Leak

VisualVM을 사용해서, 메모리 누수를 찾기 위해, Tomcat 연결 하기


1. VisaulVM 다운로드

> Download 주소 : https://visualvm.github.io/download.html

> Monitor : CPU, Heap/Metaspace, Classes, Threads

> Plugin Download: https://visualvm.github.io/plugins.html


2. Tomcat setenv.sh 설정하기

위치 : ~tomcat/bin

#!/bin/sh

export CATALINA_OPTS="$CATALINA_OPTS

 -Dcom.sun.management.jmxremote.authenticate=false"

export CATALINA_OPTS="$CATALINA_OPTS

 -Dcom.sun.management.jmxremote.port=9999"

export CATALINA_OPTS="$CATALINA_OPTS

 -Dcom.sun.management.jmxremote.ssl=false"

export CATALINA_OPTS="$CATALINA_OPTS 

-Djava.rmi.server.hostname=localhost"


3. Tomcat 재시작


4. 연결하기 : ViusalVM - Remote - Add Host - Add Jmx Connection

* localhost가 서버인 경우에는 IP와 hostname를 매칭을 해 주세요. 

(/etc/hosts에 등록을 해도 됩니다.)


5. Heap Dump 

- 원격 Dump는 8-900M를 압축해서 다운로드

- Eclipse에서 Memory Analyzer(http://www.eclipse.org/mat/) 열기를 수행하면,
leak problem suspect를 접근 가능


> 원문 : java.lang.OutOfMemoryError: Metaspace

Tomcat는 1.25GB를 넘게 설정된 MaxMetaspaceSize지만,....
remote JMX 연결을 허용해서, VisualVM을 통해, metaspace를 살펴본다

https://apollogic.com/en/2017/05/fixing-memory-leaks-tomcat/


> 참조 : Metaspace란?

Java 7의 PermGen(Permanent Generation) Java 8에서는 사라지고, Metaspace라는 네이티브 메모리 영역으로 클래스 메타데이터들이 모두 이동했다...
heap영역에서 사용할 수 있는 메모리가 늘어났다...

http://starplatina.tistory.com/entry/JDK8%EC%97%90%EC%84%A0-PermGen%EC%9D%B4-%EC%99%84%EC%A0%84%ED%9E%88-%EC%82%AC%EB%9D%BC%EC%A7%80%EA%B3%A0-Metaspace%EA%B0%80-%EC%9D%B4%EB%A5%BC-%EB%8C%80%EC%8B%A0-%ED%95%A8

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



OS 설치하기 ( VMware + Ubuntu )



# VMware 설치 : VMware Workstation 12 Player 다운로드 & 설치


# Ubuntu ISO 다운로드 : www.ubuntu.com , Download -> Desktop




참조 : http://recipes4dev.tistory.com/111




Ruby on Rails ( ROR ) 설치 하기 with RVM



# gpg command contact a public key server and request a key


> gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB



# curl command download the RVM installation script

> cd /tmp

> curl -sSL https://get.rvm.io -o rvm.sh

> cat /tmp/rvm.sh | bash -s stable --rails


- Add $PATH : ~/.rvm/scripts/rvm 또는 ./ 


# install specific ruby and rails versions

>rvm install 2.4.1

>rvm use 2.4.1 

>gem install rails -v 4.2.7


>rvm list known

>rvm list

>gem search '^rails$' --all 


# install java script runtime (node.js)





참조 : https://www.digitalocean.com/community/tags/ruby-on-rails?type=tutorials



'Web Tech. > Ruby on Rails' 카테고리의 다른 글

Cloud9 Ruby DB 변경 하기 (sqlite3 -> mysql )  (0) 2018.10.16
Cloud9 Ruby Rails의 MySQL설정  (0) 2018.10.11
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

Java Spring + Slack Web Hook API



슬랙으로 메시지를 보내기



1. 슬랙에서 채널을 생성


2. 원하는 채널을 선택하고, 접근API를 생성


- 메뉴 : https://my.slack.com/services/new/incoming-webhook/

- 설명 : api.slack.com -> incoming webhooks




3. 연동(Java) 모듈 생성



  String hooksSlack = "https://hooks.slack.com/services/xx/yy/zz";


CloseableHttpClient client = HttpClients.createDefault();

HttpPost httpPost = new HttpPost(hooksSlack);


String message = " " ;

String json = "{ \"text\": \""+ message.toString() + "\" }";

StringEntity entity = new StringEntity(json);

httpPost.setEntity(entity);

httpPost.setHeader("Accept", "application/json");

httpPost.setHeader("Content-type", "application/json");

CloseableHttpResponse response = client.execute(httpPost);

log.error("getStatusCode : " + response.getStatusLine().getStatusCode() );

//assertThat( response.getStatusLine().getStatusCode(), equalTo(200) );

client.close();



- 실행 결과 (샘플)




# Spring Slack Integration


http://wooriworld2006.tistory.com/382



# POST with JSON


http://www.baeldung.com/httpclient-post-http-request



# Webhook URL 


https://stackoverflow.com/questions/37423129/slack-incoming-web-hook-and-getting-it-to-work-with-httppost

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

checkbox로 <div>를 감추거나 보여주거나



<input type="checkbox">를 통해서 <div>영역을 감추거나 보여주거나 처리 하는 예제




'Web Tech. > PHP, Web' 카테고리의 다른 글

sqlmap - a penetration testing tool  (0) 2017.11.20
github에 업로드 하기 ( from Window )  (0) 2017.06.14
Chrome, Inspect  (0) 2017.04.05
Bootstrap 시작 하기  (0) 2017.02.07
3. OctoberCMS , Creating Themes  (0) 2017.01.20
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


sqlmap - a penetration testing tool



1. 다운로드 : sqlmap.org 



git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev





2. 사용법


https://github.com/sqlmapproject/sqlmap/wiki/Usage



>python sqlmap.py -u "URL" --dbs

'Web Tech. > PHP, Web' 카테고리의 다른 글

checkbox로 <div>를 감추거나 보여주거나  (0) 2017.11.24
github에 업로드 하기 ( from Window )  (0) 2017.06.14
Chrome, Inspect  (0) 2017.04.05
Bootstrap 시작 하기  (0) 2017.02.07
3. OctoberCMS , Creating Themes  (0) 2017.01.20
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


페이스북 Graph API 사용하기



페이스북 정보를 가져오기 ( 웹스크랩을 대체 )





홈 : http://restfb.com/ 



restfb


RestFB is a simple and flexible Facebook Graph API client written in Java.

It is open source software released under the terms of the MIT License.







깃허브 : https://github.com/restfb/restfb




초기화



함수 사용



- page.getLikesCount(), page.getNewLIkeCount() : Only Visible to a page admin.



* 엑세스 토큰과 앱 시크릿 : https://developers.facebook.com

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Bash , Kill $pids




- 프로세스 찾기

- 문자열 null 비교

- Kill 명령어 실행


#!/bin/bash

lsof -i | grep 8117
pids=`lsof -i | grep 8117 | grep -v grep | awk '{print $2}'`
echo $pids
if [ ! -z "$pids" ] 
then
	kill -9 $pids
else
	echo "Not Found!"
fi


블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Python IDLE에서 Shift+Tab이 안되는 경우



1. 옵션  -> Cofigure IDLE
2. Keys탭을 선택

3. "dedent-region"를 목록에서 선택
4. "Get New Keys for Selection"버튼 클릭

5. Shift선택하고, Tab을 목록에서 고른다.







참조 : 

https://stackoverflow.com/questions/790711/how-to-remove-tab-indent-from-several-lines-in-idle

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

AWS S3 파일 업로드 연동하기 (with Java)


AWS S3와 연동하기 위해서는 아래 참조의 경우를 살펴보면, 장단점등이 있으며, 이를 보완할 필요가 있다. 

물론, 연동을 위해서는 Java용 AWS SDK가 필요하다.( aws.amazon.com/ko/sdk-for-java ) 



1. SDK를 포함후에 확인된 Dependency


- jackson-annotations-x.x.x.jar, jackson-core-x.x.x.jar, jackson-databind-x.x.x.jar

- joda-time-x.x.x.jar

- http-core-x.x.x.jar

- http-client-x.x.x.jar


실행시에 ClasssNotFoundException이 발생한다면, 해당 Dependency들을 추가 해야 한다.



2. 연동 클래스 만들기


1) 생성자부분


AmazonS3 amazonS3;


AWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey);

amazonS3 = AmazonS3ClientBuild.standard()

.withCredential(creds)

.withRegions(Regions.XXX)

.withForceGlobalBucketAccessEnable(true)

.build();


* withRegions()이 없으면
: SdkClientException이 발생한다.(
Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.)


http://docs.aws.amazon.com/ko_kr/general/latest/gr/rande.html

1) us-east-2 : 미국 동부 오하이오

2) us-east-1 : 미국 동부 버지니아 북부

3) us-west-1 : 미국 서부 캘리포니아 북부

4) us-west-2 : 미국 서부 오레곤

5) ap-south-1 : 아시아 태평양 뭄바이

6) ap-northeast-2 : 아시아 태평양 서울

7) ap-northeast-1 : 아시아 태평양 도쿄

8) ap-southeast-1 : 아시아 태평양 싱가프로

9) ap-southeast-2 : 아시아 태평양 시드니

... eu-central-1, eu-west-1, eu-west-2, sa-east-1, ca-central-1


2) File Upload부분


PutObjectRequest putObjectRequest = new PutObjectRequest(buckeName, fileName, file);


//file permission

putObjectRequest.setCannedAcl(CannedAccessControlList.PublicRead);


// fill upload

PutObjectResult ret = amazonS3.putObject(pubObjectRequest);





3) 소스 예제



참조 1, [Java] Java를 이용해 AWS S3 파일 업로드 하기

http://dwfox.tistory.com/57


- AmazonS3Client는 deprecated된 상태로 변경이 필요하다.



참조2, Amazon S3 Tutorial – The ULTIMATE Guide

https://www.javacodegeeks.com/2017/03/amazon-s3-tutorial.html


- AmazonS3ClientBuilder를 잘 설명하고 있으나, 다소 복잡한 면이 있다.


참조3, Working with AWS Credentials

http://docs.aws.amazon.com/ko_kr/sdk-for-java/v1/developer-guide/credentials.html

- AWSCredentials인터페이스는 BasicAWSCredentials를 AWS access key와 secret key를 사용해서 생성한다. 이떄 환경설정등에서 가져 오는 방법과 명시적으로 지정하는 방법을 알 수 있다.


참조4, Amazon S3 Examples ( using AWS SDK for Java )

http://docs.aws.amazon.com/ko_kr/sdk-for-java/v1/developer-guide/examples-s3.html 


참조5, Amazon S3,  버킷 생성, 

https://docs.aws.amazon.com/ko_kr/AmazonS3/latest/UG/BucketOperations.html 


Amazon S3에 저장한 모든 객체는 버킷에 존재합니다. 디렉토리로 파일 시스템 내 파일을 그룹화하듯 버킷으로 관련 객체를 그룹화할 수 있습니다. 버킷은 액세스 권한 및 버전 관리 상태 등의 속성을 지니며, 사용자는 버킷이 속할 리전을 원하는 대로 설정할 수 있습니다.


참조6, Amazon S3,  폴더 작업

https://docs.aws.amazon.com/ko_kr/AmazonS3/latest/UG/FolderOperations.html

Amazon S3에서 버킷과 객체는 기본 리소스이며 객체가 버킷에 저장됩니다. Amazon S3에서는 일반적인 파일 시스템에서와 같이 계층이 없는 단순한 구조입니다. 하지만 간결한 구성을 위해 Amazon S3 콘솔에서는 객체를 그룹화하는 수단으로 폴더 개념을 지원합니다.


블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,