Free Support Forum - groupdocs.com

Integration issue


#1

Hi,


I’m trying to update my integration from 1.7.1 to 1.8.1, but I found some issue that I don’t understand. As in 1.7 I changed HomeController.index method as below:

@RequestMapping(value = “/”, method = RequestMethod.GET)
public String index(Model model, HttpServletRequest request, HttpServletResponse response, @RequestParam(value = “objectId”,
required = false) String objectId, @RequestParam(
value = “userName”, required = false) String userName) throws Exception {
// Configure localization
final ILocalization localization = null;
// Setting header in jsp page
model.addAttribute(“groupdocsHeader”, annotationHandler().getHeader(applicationConfig.getApplicationPath(), request));

userName = userName == null ? “Anonymous” : userName;
objectId = com.groupdocs.viewer.utils.Utils.encodeData(objectId);

final String userGuid = annotationHandler().getUserGuid(userName);
model.addAttribute(“groupdocsScripts”, annotationHandler().getAnnotationScript(objectId, userName, userGuid, localization));
return “index”;
}


Then I changed annotationHandler() initialization to use my custom handler:

annotationHandler = new AnnotationHandler(serviceConfiguration, connector, new MyInputDataHandler(serviceConfiguration));

Unfortunately when I run my webapp I get the following exception:

SEVERE: Annotation throws exception: files is not supported!
com.groupdocs.annotation.exception.AnnotationException: files is not supported!
at com.groupdocs.annotation.api.shared.CommonApi.viewDocument(CommonApi.java:282)
at com.groupdocs.annotation.api.shared.WebApi.viewDocumentHandler(WebApi.java:239)
at com.groupdocs.annotation.handler.AnnotationHandler.viewDocumentHandler(AnnotationHandler.java:136)


Thanks in advance for any help.
Mariusz

#2

Note that we use ID, not a file name, e.g.: /?objectId=0900000180028b3a

Our custom handler is not even called before that exception is thrown.

#3

Additionally the warning displayed in UI; “files is not supported” is meaningless and it’s not even correct sentence. It should be rather “File 090000 format not supported” or something like that. Anyway, how based on an ID there is such an exception thrown? The getFileType method from the inputHandler is not even called.


#4

InputHandler custom implementaiton - but it is not even called:


public class MyInputDataHandler extends InputDataHandler {
private IDfClientX clientX;
private IDfSessionManager sessionManager;

public MyInputDataHandler(ServiceConfiguration serviceConfiguration) {
System.out.println(“Init”);
}

@Override
public InputStream getFile(String guid) {
System.out.println("Object ID: " + guid);

try {
return getObject(guid).getContent();
} catch (final DfException e) {
e.printStackTrace();
}
return null;
}

@Override
public File[] getFileList(String directory) {
System.out.println(“Get file list”);
return new File[] {};
}

@Override
public FileType getFileType(String guid) {
System.out.println("Object ID: " + guid);
try {
final FileType ft = FileType.valueOf(getObject(guid).getFormat().getDOSExtension().toUpperCase());
System.out.println("File type: " + ft);
return ft;
} catch (final DfException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}

private IDfSysObject getObject(String guid) {
//implementaiton
}

@Override
public String saveFile(InputStream arg0, String arg1, Integer arg2, String arg3) {
return null;
}
}

#5

I’m attaching a sample that reproduces the issue without any third-party dependency.

It fails with the mentioned exception when the ID doesn’t contain exception.

So the URL below works fine

http://localhost:8080/viewer/viewer/?objectId=0900000180028b3a.doc

(well partially, it fails with a different error:

SEVERE: Annotation throws exception: Startxref not found
com.groupdocs.annotation.exception.AnnotationException: Startxref not found
at com.groupdocs.annotation.api.shared.CommonApi.viewDocument(CommonApi.java:282)
)

whether this one doesn’t

http://localhost:8080/viewer/viewer/?objectId=0900000180028b3a

So the tool accepts ONLY file names whether it should be up to the InputDataHandler. It used to work with 1.7.1 although with a different bug.
Please fix it ASAP.

Thanks,
Mariusz

#6
Hello Mariusz,

We are very sorry to see you have this problem. Thank you for all supplied info. We checked your sample and your code in different combinations. It seems to be working only in the GroupDocs.Annotation v1.7.1, it even does not work in the GroupDocs.Viewer v.2.5.0. By the way, our developers prepared the new version of the GroupDocs.Viewer (which is responsible for the InputDataHandler) where the process of custom data input should be handled better. The beta version should be available tomorrow. We will inform you about after it will be checked, and probably we will be able to prepare the GroupDocs.Annotation with the new Viewer soon.
Sorry for the inconvenience.


#7

OK, in that case I will wait for new version.

What about the other issue (SEVERE: Annotation throws exception: Startxref not found) ?