You need to sign in to do that
Don't have an account?
NisseKnudsen
PageReference.getContent() -> httpclient.RedirectException: Maximum redirects (100) exceeded
Hey Guys!
I got a problem where I can't really figure out what I might have done wrong :(
First my Code:
PageReference pr = new PageReference( '/servlet/servlet.FileDownload?file=' + filepath ); Blob internalXmlBlob = pr.getContent(); String internalXml = internalXmlBlob.toString(); System.Debug( internalXml );
Now the Debug Log:
11:21:20.181 (181269000)|SYSTEM_METHOD_ENTRY|[753]|System.PageReference.getContent() 11:21:22.133 (2133850000)|EXCEPTION_THROWN|[753]|System.VisualforceException: org.apache.commons.httpclient.RedirectException: Maximum redirects (100) exceeded 11:21:22.133 (2133946000)|SYSTEM_METHOD_EXIT|[753]|System.PageReference.getContent()
What am I trying to do? I get the Document-File with the Id 'filepath' (parameter) as a blob, convert it to a string and later on try to parse it.
When doing this by using Execute Anonymous in Eclipse IDE I got -no- error.
But in VisualForce, I get this Error shown.
Does anyone have a idea?
Thanks a lot,
Nisse
Not entirely sure what the problem might be, but I would suggest you just use:
There's no reason to use the FileDownload servlet in Apex Code or Visualforce.