I want to read a static json file (for testing) through portlet.
I've placed it in /json folder. So when the portlet is deployed, the folder is available in \webapps folder.
The complete path: webapps\myPortlet\json\op.json
In the processAction method -
@Override
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
JSONParser parser = new JSONParser();
try {
JSONObject jsonObject = (JSONObject) parser.parse(new FileReader
(request.getContextPath() + "/json/op.json"));
.
.
.
}
I'm getting FileNotFoundException.
Can someone please point me a correct way to access this file.