May 29, 2012 - RestLet (RestFul) 에서 헤더값을 대소문자

출처 : http://www.restlet.org/documentation/2.0/jse/api/org/restlet/util/Series.html

String getFirstValue(String name, boolean ignoreCase) Returns the value of the first parameter found with the given name. String getFirstValue(String name, boolean ignoreCase, String defaultValue) Returns the value of the first parameter found with the given name. String getFirstValue(String name, String defaultValue) Returns the value of the first parameter found with the given name.

getFirstValue(String name, boolean ignoreCase)

import org.restlet.data.Form;
Form headers = new Form();
headers.add("test", "test입니다.");
System.out.println(headers.getFirstValue("Test",true));

결론 : test입니다.

getFirstValue(String name, boolean ignoreCase, String defaultValue)

 import org.restlet.data.Form;
 Form headers = new Form();
 headers.add("test", "test입니다.");
 System.out.println(headers.getFirstValue("Test",false));

결론 : null

getFirstValue(String name, String defaultValue)

import org.restlet.data.Form;
Form headers = new Form();
headers.add("test", "test입니다.");
System.out.println(headers.getFirstValue("Test",false, "test입니까?"));

결론 : test입니까?

만약 대소문자를 구분하려고 하면 false, 대소문자를 구분하지 않기 위해서는 true를 설정하면 됩니다.

May 14, 2012 - IMP-00013: DBA만이 다른 DBA가 엑스포트한 파일을 임포트할 수 있습니다

Import: Release 11.1.0.6.0 - Production on 월 5월 14 11:21:47 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved. 

다음에 접속됨: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

엑스포트 파일은 규정 경로를 거쳐 EXPORT:V10.02.01 에 의해 생성되었습니다

IMP-00013: DBA만이 다른 DBA가 엑스포트한 파일을 임포트할 수 있습니다
IMP-00000: 임포트가 실패로 끝났습니다

Export 시에 시스템권한까지 포함하여 익스포트를 한 경우 임포트 대상도 시스템권한이 부여되어야합니다.

보통은 Grant connect, resource to DB_ID 로 권한을 부여해주는데 DBA권한을 추가해주기 위해서 한가지 조건을 더 붙입니다.

GRANT CONNECT, RESOURCE, DBA TO DB_ID

이렇게 할 경우 정상적으로 임포트가 가능합니다. 익스포트할때 시스템권한으로 익스포트하지 않는게 가장 중요하겠지만요.

Mar 30, 2012 - Amazon 3S Upload 시에 443 이 아니라 80 port로 Upload 하는 방법

참고주소 : http://www.cozyroc.com/ssis/amazon-s3-connection

1. Host
Specify the name or IP address of the Amazon S3 service.
2. Secure connection
Specify to establish secure HTTPS connection with Amazon S3 service on port 443.
3. Regular calling
Specify to connect to Amazon S3 service, using regular calling format. Un-check this option when connecting to EU Amazon S3 service.
4. Access Key
Specify access key for Amazon S3 service.
5. Secret Key
Specify secret key for Amazon S3 service.
6. Time-out (secs)
Specify the number of seconds before timing out session connect. The default value of this property is 100.
7. Test Connection
Confirm connection manager configuration by clicking Test Connection.  

Amazon 3S Upload 시에 443 이 아니라 80 port로 Upload 하는 방법

S3 Upload : org.jets3t.service.impl.rest.httpclient.RestStorageService Class

Amazon S3 Upload 시에 setupConnection 에서 ‘isHttpsOnly()’ 에 값을 가져와, https 로 셋팅할 것인지 http 로 셋팅할것인지를 결정합니다.

protected HttpMethodBase setupConnection(HTTP_METHOD method, String bucketName, String objectKey, Map<String, String> requestParameters) throws ServiceException

isHttpsOnly() 라는 메소드는 org.jets3t.service.StorageService Class 에서 가져옵니다.

private boolean isHttpsOnly = true;

문제는 이 변수가 항상 true로 되어있습니다. 그래서 항상 SSL 방식으로 업로드가 되게 됩니다.

그런데 특정 서버의 경우 443 port 가 막혀 80 port 로만 업로드해야할 경우가 있습니다. 그로인해 isHttpOnly 를 false 로 바꿔주어야합니다.

org.jets3t.service.StorageService Class 에 setMethod를 추가합니다.

public void setHttpsOnly(boolean isHttpsOnly){ this.isHttpsOnly = isHttpsOnly; }

해당 메소드를 그럼 자동으로 파일업로드시 org.jets3t.service.impl.rest.httpclient.RestStorageService 에서 http, https 설정하는 setupConnection method() 에서 자동으로 http 를 셋팅합니다.

사용방법은

org.jets3t.service.S3Service s3Service = new RestS3Service(awsCredentials);
s3Service.setHttpsOnly(isHttpsOnly);
S3Bucket bucket = s3Service.getBucket(bucketName);

S3Service 에서 부모에 있는 setHttpsOnly 메소드를 호출하여 false 로 변경해주면 됩니다.