Get space information in XWork Module

Hello guys!

Is it possible to get space information (like spaceKey) inside an XWork Action class?

I do have the following

<xwork name="macrodialogaction" key="macrodialogaction">
		<package name="editor" extends="default" namespace="/plugins/macro">
			<default-interceptor-ref name="defaultStack" />
			<action name="editor"
				<result name="success" type="velocity">/templates/macro-editor/macro-editor.vm</result>
				<result name="error" type="velocity">/templates/macro-editor/error.vm</result>

and my MacroEditorAction signature follows
public class MacroEditorAction extends ConfluenceActionSupport implements PageAware.
Is it possible to access the spaceKey where the action is being loaded in the MacroEditorAction?

Thanks in advance!

Dear Luis,

as you implement PageAware I would assume that you could use getPage().getSpace().getSpaceKey().

Kind regards


Hello @andreas1,
Thanks for your response.

I’m sorry for the dumb question but given that I’m implementing PageAware, I have to override the getPage method. In this case, what should I write in getPage function?

The default is

public AbstractPage getPage() { return null; }

which obviously causes an error if I somewhere in the code write getPage().getSpaceKey().
How do I pass the page to the my MacroEditorAction class?


Dear Luis,

I never tried in myself but doesn’t this article help?

Kind regards