Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hey guys,
I've got a servlet running on Windchill's Tomcat instance which doesn't seem to think it's actually part of windchill -- I'm getting the "No active method context" message when I try to call getViewContentURL() on an ApplicationData object. Can anyone clue me in on how to set up the proper method context from here?
public static JSONObject getPartPDF(String[] params) {
JSONObject toReturn = new JSONObject();
if(params.length < 1) {
toReturn.accumulate("error", "Must provide Object ID!");
return toReturn;
}
String obid = params[0];
try {
Persistable p = DocumentUtility.getObjectFromObid(obid);
String partNumber = AttributeUtility.getAttributeValue((IBAHolder) p, "Part Number");
if(partNumber != null && !"null".equals(partNumber)) {
ApplicationData ad = ContentUtility.getAttachment((ContentHolder) p, partNumber + ".pdf");
if(ad != null) {
toReturn.put("url", ad.getViewContentURL((ContentHolder) p)); // ***** Error here! *****
toReturn.put("partNumber", partNumber);
toReturn.put("obid", obid);
}
}
} catch (WTException e) {
e.printStackTrace();
toReturn.put("error", e.getMessage());
}
return toReturn;
}