* @return processor
*/
public AGSProcessor newProcessor(RequestContext requestContext) {
AGSProcessor processor = new AGSProcessor(newProcessingContext(requestContext));
processor.setCredentials(info.newCredentials());
AGSTarget target = processor.getTarget();
target.setTargetUrl(info.getRestUrl());
target.setTargetSoapUrl(info.getSoapUrl());
int idx = -1;
String rootRestUrl = info.getRestUrl();
String rootSoapUrl = info.getSoapUrl();
String restServicesString = "/rest/services";
idx = rootRestUrl.toLowerCase().lastIndexOf(restServicesString);
if (idx>=0) {
rootRestUrl = rootRestUrl.substring(0, idx+restServicesString.length());
}
String soapServicesString = "/services";
idx = rootSoapUrl.toLowerCase().lastIndexOf(soapServicesString);
if (idx>=0) {
rootSoapUrl = rootSoapUrl.substring(0, idx+soapServicesString.length());
}
target.setRestUrl(rootRestUrl);
target.setSoapUrl(rootSoapUrl);
target.setTargetType(rootRestUrl.toLowerCase().replaceAll("/*$", "").equals(restServicesString.toLowerCase())? AGSTarget.TargetType.ROOT: AGSTarget.TargetType.SERVICE);
target.setWasRecognized(true);
return processor;
}