Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

nothing happen when clicking on .../spaces/mynewaction.action?key=MYSPACE

Laurent Di Pasquale April 8, 2013

Trying to create a new space action, returning a zip file with all attachments from space. I want to put the .../spaces/downloadallattachmentsfromspace.action?key=MYSPACE on a page, clicking on it should return a zip file.

I have extended DownloadAllAttachmentsOnPageAction class.

Updated xworks.xml, spaces package:

<action name="downloadallattachmentsfromspace" class="com.atlassian.confluence.spaces.actions.DownloadAllAttachmentsFromSpaceAction">

<result name="success" type="redirect">${downloadPath}</result>

</action>

I've put a log.info in execute() method, but cant' see nothing in the log (while same trick in execute() method of DownloadAllAttachmentsOnPageAction shows a trace).
My action is not associated with any .vm
But, compared to a really fake action .../spaces/pleasedothecoffee.action?key=MYSPACE, I can clearly see a difference: I have a trace in the log saying [atlassian.confluence.servlet.ConfluenceServletDispatcher] serviceAction There is no Action mapped for ...
Seems my action is somehow triggered but...
How can I ensure I enter in my execute() method to carry on dev and debug?

4 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2014

I would use the conveyor plugin to overwrite the default xwork action. Makes updates much more easier.

Do it in your own plugin, use the conveyor. If it's not working, create your own namespace and try it there. And take always a look into the logs

0 votes
Laurent Di Pasquale April 18, 2013

I don't think my code is actually the problem, I don't even enter the method (don't get the "we are here!" log). There must be a mechanism that is needed to make such that link "/spaces/downloadallattachmentsfromspace.action?key=MYSPACE" does call my execute() method.

Any help very welcome.

0 votes
Laurent Di Pasquale April 11, 2013

Sure.

I started from confluence-4.3.2-source/confluence-project/confluence-core/confluence/src/java/com/atlassian/confluence/pages/actions/DownloadAllAttachmentsOnPageAction.java

Created from it confluence-4.3.2-source/confluence-project/confluence-core/confluence/src/java/com/atlassian/confluence/spaces/actions/DownloadAllAttachmentsFromSpaceAction.java

basically I just populate the "attachments" list with attachment from the space rather than from the page. The rest of the method is identical.

part of DownloadAllAttachmentsFromSpaceAction.java source code:

-- START --

public class DownloadAllAttachmentsFromSpaceAction extends DownloadAllAttachmentsOnPageAction
{

...

private GateKeeper gateKeeper;
private AbstractSpaceAction abstractSpaceAction;
protected SpaceManager spaceManager;
protected PageManager pageManager;
private static final Logger log = Logger.getLogger(DownloadAllAttachmentsFromSpaceAction.class);

public String execute() throws Exception

{

log.setLevel(Level.INFO);
log.info("we are here!");

// get space
Space space = spaceManager.getSpace(abstractSpaceAction.getSpaceKey());
log.info("space: "+space.getDisplayTitle());

// get pages
List<Page> pages = pageManager.getPages(space, true);

// create attachments list
List<Attachment> attachments = new ArrayList<Attachment>();

// Grab only the latest versions of the attachments
for (Page page : pages)
{
log.info("une page: "+page.getTitle());
attachments.addAll(attachmentManager.getLatestVersionsOfAttachments(page));
}

// Iterate through and write them to the temporary zip directory
for (Attachment attachment : attachments)
{

...

-- END --

Thanks in advance for your help.

0 votes
R K April 11, 2013

Could you please provide sources and state where you put them? Would make it easier to reproduce what you did and test locally.

Good luck!

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events