B2 and content-handlers remove http-action

I had problems with the remove.jsp that I created for remove within content-handlers, i.e. from bb-manifest.xml:

<content-handlers>
<content-handler>
<http-actions>
<create value=”ch_tagged/create.jsp”/>
<modify value=”ch_tagged/modify.jsp”/>
<remove value=”ch_tagged/remove.jsp”/>
</http-actions>
</content-handler>

I could get both create and modify to work quite easily, but what ever I did remove simply wouldn’t run! What I didn’t realise is that you seemingly cannot override the page you go to after the delete, but are merely able to produce any side-effects of the removal. I needed to delete an extra file, which I can now do. So lesson learnt – never include html or tag library stuff inside a remove, only do what you need to do in pure java. E.g.:

<%@ page language=”java”

import=”…”

pageEncoding=”UTF-8″%>

<%

String content_id = request.getParameter(“content_id”);

String path = TaggingUtil.getPersistPath() + content_id;

File f = new File(path);

f.delete();

%>

This entry was posted in Plugin development and tagged . Bookmark the permalink.

1 Response to B2 and content-handlers remove http-action

  1. karlund says:

    Perhaps a redirect can change where the user-interface goes after a delete, but at the moment I’m content with where it goes…

Leave a Reply to karlund Cancel reply

Your email address will not be published. Required fields are marked *