/**
* MKCOLメソッドの処理. boxインストールを行う.
java属性可以是对象吗、* @param uriInfo UriInfo
* @param pCredHeader dcCredHeader
* @param contentType Content-Typeヘッダの値
java代码例子?* @param contentLength Content-Lengthヘッダの値
* @param requestKey イベントログに出力するRequestKeyフィールドの値
* @param inStream HttpリクエストのInputStream
java中属性和方法的区别、* @return JAX-RS Response
*/
@WriteAPI
java中属性是什么、@WebDAVMethod.MKCOL
public Response mkcol(
@Context final UriInfo uriInfo,
js获取header信息、@HeaderParam(PersoniumCoreUtils.HttpHeaders.X_PERSONIUM_CREDENTIAL) final String pCredHeader,
@HeaderParam(HttpHeaders.CONTENT_TYPE) final String contentType,
@HeaderParam(HttpHeaders.CONTENT_LENGTH) final String contentLength,
@HeaderParam(PersoniumCoreUtils.HttpHeaders.X_PERSONIUM_REQUESTKEY) String requestKey,
final InputStream inStream) {
PersoniumEventBus eventBus = new PersoniumEventBus(this.cell);
Event event = null;
Response res = null;
try {
// ログファイル出力
JSONEvent reqBody = new JSONEvent();
reqBody.setAction(WebDAVMethod.MKCOL.toString());
reqBody.setLevel(LEVEL.INFO);
reqBody.setObject(this.cell.getUrl() + boxName);
reqBody.setResult("");
// X-Personium-RequestKeyの解析(指定なしの場合にデフォルト値を補充)
requestKey = EventResource.validateXPersoniumRequestKey(requestKey);
// TODO findBugs対策↓
log.debug(requestKey);
event = EventResource.createEvent(reqBody, requestKey, this.accessContext);
// eventBus.outputEventLog(event);
if (Box.DEFAULT_BOX_NAME.equals(this.boxName)) {
throw PersoniumCoreException.Misc.METHOD_NOT_ALLOWED;
}
// Boxを作成するためにCellCtlResource、ODataEntityResource(ODataProducer)が必要
// この時点では "X-Personium-Credential" ヘッダーは不要なのでnullを指定する
CellCtlResource cellctl = new CellCtlResource(this.accessContext, null, this.cellRsCmp);
String keyName = "'" + this.boxName + "'";
ODataEntityResource odataEntity = new ODataEntityResource(cellctl, Box.EDM_TYPE_NAME, keyName);
Map headers = new HashMap();
headers.put(HttpHeaders.CONTENT_TYPE, contentType);
headers.put(HttpHeaders.CONTENT_LENGTH, contentLength);
// X-Personium-RequestKeyの解析(指定なしの場合にデフォルト値を補充)
BarFileInstaller installer =
new BarFileInstaller(this.cell, this.boxName, odataEntity, uriInfo);
res = installer.barFileInstall(headers, inStream, event.getRequestKey());
event.setResult(Integer.toString(res.getStatus()));
} catch (RuntimeException e) {
// TODO 内部イベントの正式対応が必要
if (e instanceof PersoniumCoreException) {
event.setResult(Integer.toString(((PersoniumCoreException) e).getStatus()));
if (((PersoniumCoreException) e).getStatus() < HttpStatus.SC_INTERNAL_SERVER_ERROR) {
event.setLevel(LEVEL.INFO);
} else {
event.setLevel(LEVEL.ERROR);
}
} else {
event.setResult(Integer.toString(HttpStatus.SC_INTERNAL_SERVER_ERROR));
event.setLevel(LEVEL.ERROR);
}
throw e;
} finally {
// 終了ログファイル出力
eventBus.outputEventLog(event);
}
return res;
}
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态