Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
I am using Windchill PDMLink Release 12.0 and Datecode with CPS 12.0.0.2
We are creating Generic URL through code to download some content. But, we can't utilise that URL more than once. So, We need to know how I can re-utilise the same URL without executing functionality. Or any other way to download by asking credentials ?
I am not understanding the requirement for "can't utilize that URL more than once". Are you looking to create a static URL? Content download links contain the object IDs which change with each iteration so its hard to say get the latest of the content item. Can you rephrase the question or possible provide screenshots/examples?
Basically, I used below piece of code to create the URL for EPM Document Object JT file download.
ApplicationData app_data = (ApplicationData) app_object;
URL contentURL = ContentHelper.getViewContentURL(app_data, representation, false);
String path = contentURL.getPath();
But, once URL is created, I can use only once to download the JT file. Post that If I use the same URL, its throwing error in UI stating that cant use anymore please execute the functionality once again. So, my question is wanted to re-use the same URL multiple times.
Can you post that error message you are getting? That is strange. I searched and cannot find anything in knowledge base or have seen that. Perhaps something to do with session or login.
Type Status Report
Message The signature from SERVERHOSTNAME/Windchill/servlet/WindchillGW", signed at "Tue May 02 13:40:41 GMT 2023", received at "Tue May 02 13:41:31 GMT 2023", is already used. Please retry the operation. If the error persists please contact the system administrator.
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
https://www.ptc.com/en/support/article/CS186866
Now I get it. Yes, we've seen this with PDF documents in some browsers.
https://www.ptc.com/en/support/article/CS200112
Hi @avillanueva
It is common for that method that it generates specific url that can be used just once time. Security reason.
There is a specific way how to achieve what he needs but it will need to login.
For example attachment download link works as @DA_10350817 expects.
I found a specific code in a datautility that build the download URL that can be used more then once, but it requires the login.
For attachements I used this method:
String serverURL = AttachmentsDataUtilityHelper.getBaseURL();
String urlString=""; // opakovatelny download link...
try
{
holder = ContentHelper.service.getContents(document);
ApplicationData syAppData = (ApplicationData) ContentHelper.service.getPrimaryContent(ObjectReference.newObjectReference(document));
urlString = serverURL + "/servlet/AttachmentsDownloadDirectionServlet?oid=OR:";
urlString = urlString + holder.getPersistInfo().getObjectIdentifier().getStringValue();
urlString = urlString + "&cioids=";
urlString = urlString + syAppData.getPersistInfo().getObjectIdentifier().getStringValue();
urlString = urlString + "&role=";
urlString = urlString + syAppData.getRole();
} catch (PropertyVetoException e)
{
e.printStackTrace();
}
PetrH