PayloadRequestImpl.java [src/csip] Revision: Date:
/*
* $Id$
*
* This file is part of the Cloud Services Integration Platform (CSIP),
* a Model-as-a-Service framework, API and application suite.
*
* 2012-2022, Olaf David and others, OMSLab, Colorado State University.
*
* OMSLab licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*/
package csip;
import csip.api.server.PayloadRequest;
import org.codehaus.jettison.json.JSONObject;
/**
* Payload Request Access.
*
* @author od
*/
class PayloadRequestImpl extends ModelDataServiceAPI
implements PayloadRequest {
PayloadRequestImpl(ModelDataService mds) {
super(mds);
}
@Override
public boolean isAsync() {
return mds.isAsync();
}
@Override
public String getRemoteAddr() {
return mds.reqRemoteIp;
}
@Override
public String getCodebase() {
String m = mds.service().getPath();
String u = getURL();
return u.substring(0, u.indexOf(m));
}
@Override
public String getURL() {
return mds.reqUrl;
}
@Override
public String getHost() {
return mds.reqHost;
}
@Override
public String getContext() {
return mds.reqContext;
}
@Override
public String getScheme() {
return mds.reqScheme;
}
@Override
public JSONObject getRequest() {
return mds.request;
}
@Override
public String getAuthToken() {
if (mds.reqAuth == null
|| !Config.getTokenAuthentication().isTokenBasedAuthentication(mds.reqAuth))
return null;
return Config.getTokenAuthentication().getToken(mds.reqAuth);
}
}