Merge patch from Carlos - path to server restlet command have change from /admin/server to /server.

This commit is contained in:
Heng Sin Low 2010-12-16 17:04:50 +08:00
parent 969b0cb3ad
commit aecf51a87c
2 changed files with 29 additions and 29 deletions

View File

@ -43,18 +43,18 @@ public class ServerInterface implements Server {
resource.setChallengeResponse(createChallengeResponse());
return resource;
}
private ChallengeResponse createChallengeResponse()
{
SecurityPrincipal principal = CConnection.get().getAppServerCredential();
ChallengeResponse cr = new ChallengeResponse(ChallengeScheme.HTTP_BASIC, principal.identity, principal.secret);
return cr;
}
}
private Context getContext() {
return Application.context;
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#postImmediate(java.util.Properties, int, int, int, boolean)
*/
@ -66,9 +66,9 @@ public class ServerInterface implements Server {
map.put("AD_Table_ID", AD_Table_ID);
map.put("Record_ID", Record_ID);
map.put("force", force);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/command/postDocument", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/postDocument", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
@ -86,14 +86,14 @@ public class ServerInterface implements Server {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("processInfo", pi);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/command/executeProcess", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeProcess", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<Serializable> entity = new ObjectRepresentation<Serializable>(map);
Representation response = resource.post(entity);
ProcessInfo responseInfo = RestletUtil.toObject(response);
return responseInfo;
return responseInfo;
} catch (Exception e) {
throw new AdempiereException(e);
}
@ -108,9 +108,9 @@ public class ServerInterface implements Server {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("AD_Workflow_ID", AD_Workflow_ID);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/command/executeWorkflow", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeWorkflow", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
@ -129,9 +129,9 @@ public class ServerInterface implements Server {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("email", email);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/command/sendEmail", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/sendEmail", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
@ -149,9 +149,9 @@ public class ServerInterface implements Server {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("AD_Task_ID", AD_Task_ID);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/command/executeTask", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeTask", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
@ -170,9 +170,9 @@ public class ServerInterface implements Server {
map.put("context", ctx);
map.put("tableName", tableName);
map.put("Record_ID", Record_ID);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/command/resetCache", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/resetCache", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
@ -192,9 +192,9 @@ public class ServerInterface implements Server {
map.put("context", ctx);
map.put("processInfo", processInfo);
map.put("procedureName", procedureName);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/command/executeProcess", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeProcess", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);

View File

@ -59,7 +59,7 @@ public class StatusInterface implements Status {
@Override
public String getDateVersion() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/version/date", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/version/date", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -72,7 +72,7 @@ public class StatusInterface implements Status {
@Override
public String getMainVersion() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/version/main", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/version/main", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -84,7 +84,7 @@ public class StatusInterface implements Status {
@Override
public String getDbType() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/type", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/type", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -96,7 +96,7 @@ public class StatusInterface implements Status {
@Override
public String getDbHost() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/host", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/host", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -108,7 +108,7 @@ public class StatusInterface implements Status {
@Override
public int getDbPort() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/port", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/port", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return Integer.parseInt(response.getText());
@ -120,7 +120,7 @@ public class StatusInterface implements Status {
@Override
public String getDbName() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/name", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/name", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -132,7 +132,7 @@ public class StatusInterface implements Status {
@Override
public String getConnectionURL() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/url", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/url", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -144,7 +144,7 @@ public class StatusInterface implements Status {
@Override
public String getDbUid() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/uid", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/uid", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -156,7 +156,7 @@ public class StatusInterface implements Status {
@Override
public String getDbPwd() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/password", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/password", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -168,7 +168,7 @@ public class StatusInterface implements Status {
@Override
public String getFwHost() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/fwhost", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/fwhost", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
@ -180,7 +180,7 @@ public class StatusInterface implements Status {
@Override
public int getFwPort() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/admin/server/status/database/fwport", null, null);
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/fwport", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return Integer.parseInt(response.getText());