Reputation: 73
I am using Spring portlets on IBM Websphere Portal 8.0, to built a file upload kind of utilty. Here I am trying to upload an XML file. The code I've written to read it works perfectly fine when I build it normally with RAD and installed as WAR but it doesn't work when it is Build with MAVEN and installed as WAR. It gives BufferedInputStream.availabel returned as -1 all the times and hence the content of the file is not readable Below is the code giving issue -
final BufferedInputStream inputStream = new BufferedInputStream(
new DataInputStream(request.getPortletInputStream()));
if (inputStream.available() != -1) {
System.out.println(" inside inputStream.available() != -1");
}
And JSP is
<form name="FileUploadBasicForm" id="FileUploadBasicForm" method="POST"
action="${submitfileURL}" enctype="multipart/form-data"><label align="center"> <strong>title </strong></label><br><br>
<input type="file" name="uploadfile" size="45"> <br><br>
<input type="submit" name="Upload" value="Upload">
</form>
I want this code to be run and return me the input stream so that I can run other piece of code. But the it only fails when I have Build this code with MAVEN. I've tried to run this with only data input stream and getPortletInputStream but it fails for all cases. But the same works with RAD build .war.
Upvotes: 0
Views: 248
Reputation: 11
Please go thru the below HCL Digital Experience Infocentre URL. You will get full idea of how WCM API works.
https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_rest_crud_content.html?hl=wcm%2Capis https://help.hcltechsw.com/digital-experience/8.5/wcm/wcm_dev_api.html
To use the Web Content Manager API, you have 2 options:
Write your code as JSPs that you deploy on your server in your Java enterprise application. These JSPs can then be used in your Web Content Manager content by using JSP components or custom JSPs in elements. Write you code as a compiled java enterprise application. In this case, you need to create a project in your development environment that has the two JAR files ilwwcm-api.jar and wp.base.jar in the build path. These JAR file files can be copied from your portal server from here: /opt/WebSphere/PortalServer/wcm/prereq.wcm/wcm/shared/app/ilwwcm-api.jar /opt/WebSphere/PortalServer/base/wp.base/shared/app/wp.base.jar This code can then be used in your Web Content Manager content by using custom plug-ins. See How to create custom plug-ins for further information.
Upvotes: 1