Revision 97:02fb4a7c2dcb
b/java/jgsscli/build.xml | ||
---|---|---|
55 | 55 |
<fileset dir="${lib}"/> |
56 | 56 |
</copy> |
57 | 57 |
<copy file="gss.properties" todir="${deploy}"/> |
58 |
<copy file="${src}/log4j-deploy.properties" tofile="${deploy}/log4j.properties"/> |
|
58 | 59 |
<jar destfile="${deploy}/jgsscli.jar"> |
59 | 60 |
<fileset dir="${build}"/> |
60 |
<fileset dir="${src}" includes="*.properties"/>
|
|
61 |
<fileset dir="${deploy}" includes="*.properties"/>
|
|
61 | 62 |
<manifest> |
62 | 63 |
<attribute name="Main-Class" value="jgsscli.cli.GSSClient"/> |
63 | 64 |
<attribute name="Class-Path" value="${mf.classpath}"/> |
b/java/jgsscli/src/jgsscli/httpmethods/HttpMethod.java | ||
---|---|---|
150 | 150 |
httpMethod = new HttpMethod(method, requestDelete, uri, localPath); |
151 | 151 |
break; |
152 | 152 |
} |
153 |
httpMethod.log.debug("uri=" + uri); |
|
154 | 153 |
return httpMethod; |
155 | 154 |
} |
156 | 155 |
|
... | ... | |
170 | 169 |
getInstance(method, methodContext.getURI(), |
171 | 170 |
methodContext.getLocalPath()); |
172 | 171 |
request.fillRequestHeaders(methodContext.getDate(), |
173 |
methodContext.getUserInfo()); |
|
172 |
methodContext.getUserInfo(), methodContext.getRemotePath());
|
|
174 | 173 |
return request; |
175 | 174 |
} |
176 | 175 |
|
... | ... | |
225 | 224 |
/** |
226 | 225 |
* It fills in the headers required by the GSS API. |
227 | 226 |
* |
228 |
* @param request |
|
229 |
* The method request object. |
|
230 | 227 |
* @param timestamp |
231 | 228 |
* The timestamp to be used for the request. |
232 | 229 |
* @param userInfo |
233 | 230 |
* Object containing user details. |
231 |
* @param pathToSign |
|
232 |
* The part of the URI to sign. |
|
234 | 233 |
*/ |
235 |
private void fillRequestHeaders(Date timestamp, UserInfo userInfo) { |
|
234 |
private void fillRequestHeaders(Date timestamp, UserInfo userInfo, |
|
235 |
String pathToSign) { |
|
236 | 236 |
log.debug("Request URI: " + this.uri); |
237 |
int pathStart = GSSUtils.SCHEME.length() + 3 // the "://" part |
|
238 |
+ GSSUtils.GSS_HOME.length() + GSSUtils.REST_PREFIX.length(); |
|
239 |
String path = this.uri.substring(pathStart); |
|
240 |
log.debug("Path: " + path); |
|
237 |
log.debug("Path to sign: " + pathToSign); |
|
241 | 238 |
String strTimestamp = DATE_FORMATER.format(timestamp); |
242 | 239 |
String signature = sign(request.getMethod().toString(), strTimestamp, |
243 |
path, userInfo.getToken()); |
|
244 |
this.request.addHeader(GSSUtils.AUTHORIZATION_HEADER, userInfo |
|
245 |
.getUsername() |
|
246 |
+ " " + signature); |
|
240 |
pathToSign, userInfo.getToken()); |
|
241 |
this.request.addHeader(GSSUtils.AUTHORIZATION_HEADER, |
|
242 |
userInfo.getUsername() + " " + signature); |
|
247 | 243 |
this.request.addHeader(GSSUtils.DATE_HEADER, strTimestamp); |
248 | 244 |
} |
249 | 245 |
|
b/java/jgsscli/src/jgsscli/httpmethods/MethodContext.java | ||
---|---|---|
68 | 68 |
private String localPath; |
69 | 69 |
private String contentPath; |
70 | 70 |
private String uri; |
71 |
|
|
72 |
private static final String URI_START = |
|
73 |
GSSUtils.SCHEME.toLowerCase() |
|
74 |
+ "://" |
|
75 |
+ GSSUtils.GSS_HOME |
|
76 |
+ GSSUtils.REST_PREFIX; |
|
71 | 77 |
|
72 | 78 |
private static Pattern REMOTE_PATH_EXTRACTOR = |
73 | 79 |
Pattern.compile(".+" |
... | ... | |
133 | 139 |
} |
134 | 140 |
|
135 | 141 |
public void setRemotePath(String remotePath) { |
136 |
String scheme = GSSUtils.SCHEME; |
|
137 |
String host = GSSUtils.GSS_HOME; |
|
138 | 142 |
|
139 | 143 |
if (this.command == Command.TOKEN) { |
140 | 144 |
this.remotePath = remotePath; |
145 |
this.uri = URI_START + remotePath; |
|
141 | 146 |
return; |
142 | 147 |
} |
143 | 148 |
|
... | ... | |
156 | 161 |
uex.printStackTrace(); |
157 | 162 |
} |
158 | 163 |
this.contentPath = encodedPath; |
159 |
encodedPath = GSSUtils.REST_PREFIX + standardPart + encodedPath;
|
|
160 |
this.uri = scheme.toLowerCase() + "://" + host + encodedPath;
|
|
164 |
encodedPath = standardPart + encodedPath; |
|
165 |
this.uri = URI_START + encodedPath;
|
|
161 | 166 |
this.remotePath = encodedPath; |
162 | 167 |
} |
163 | 168 |
|
b/java/jgsscli/src/log4j-deploy.properties | ||
---|---|---|
1 |
# Set root logger level to DEBUG and its only appender to A1. |
|
2 |
log4j.rootLogger=ERROR, A1 |
|
3 |
|
|
4 |
# A1 is set to be a ConsoleAppender. |
|
5 |
log4j.appender.A1=org.apache.log4j.ConsoleAppender |
|
6 |
|
|
7 |
# A1 uses PatternLayout. |
|
8 |
log4j.appender.A1.layout=org.apache.log4j.PatternLayout |
|
9 |
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n |
|
10 |
|
|
11 |
log4j.logger.jgsscli.httpmethods.HttpMethod=ERROR |
|
12 |
|
|
13 |
log4j.logger.jgsscli=ERROR |
|
14 |
|
|
15 |
log4j.logger.org.apache.http=ERROR |
Also available in: Unified diff