[xwiki-devs] Need help on creating virtual xwiki using API
Hi Team, I am not able to create virtual xwiki through the XwikiManagerPluginAPI. I have developed just sample restful web service. Below is the code which I am using to create virtual xwiki :- @Component("org.sisgma.xwiki.rest.HelloWorldResource") @Path("/hello/") public class HelloWorldResource extends XWikiResource { public HelloWorldResource(){ } @GET public String get(@DefaultValue("world") String myresourcename) throws XWikiException, QueryException { XWikiContext ctx = Utils.getXWikiContext(componentManager); try { WikiManagerPluginApi aoi = (WikiManagerPluginApi)ctx.getWiki().getPluginApi(WikiManagerPlugin.PLUGIN_NAME, ctx); ctx.setDoc(new XWikiDocument(new DocumentReference("jaspreet", "space", "page"))); System.out.println("_____________********* deleting xwiki"); aoi.deleteWiki("neenu", true); aoi.deleteWiki("neenu1", true); aoi.deleteWiki("karam", true); System.out.println("_____________********* deleted xwikies"); System.out.println("_____________********* Creating new xwiki"); aoi.createNewWiki("jaspreet", "templatexe", null,aoi.createWikiDocument(), true); } catch (XWikiException e) { e.printStackTrace(); } System.out.println("_____________********* " +ctx); System.out.println("_____________"+ctx); return "Hello " + myresourcename; } } Above code is not working. Virtual xwiki is not being created using the API. It is very urgent. Please help. Thanks Karamjit.
Hi Karamjit, On Sun, Jul 31, 2011 at 2:13 PM, Karamjit Singh <[email protected]>wrote:
Hi Team,
I am not able to create virtual xwiki through the XwikiManagerPluginAPI. I have developed just sample restful web service. Below is the code which I am using to create virtual xwiki :-
@Component("org.sisgma.xwiki.rest.HelloWorldResource") @Path("/hello/") public class HelloWorldResource extends XWikiResource { public HelloWorldResource(){ } @GET public String get(@DefaultValue("world") String myresourcename) throws XWikiException, QueryException { XWikiContext ctx = Utils.getXWikiContext(componentManager); try { WikiManagerPluginApi aoi =
(WikiManagerPluginApi)ctx.getWiki().getPluginApi(WikiManagerPlugin.PLUGIN_NAME, ctx); ctx.setDoc(new XWikiDocument(new DocumentReference("jaspreet", "space", "page"))); System.out.println("_____________********* deleting xwiki"); aoi.deleteWiki("neenu", true); aoi.deleteWiki("neenu1", true); aoi.deleteWiki("karam", true); System.out.println("_____________********* deleted xwikies"); System.out.println("_____________********* Creating new xwiki"); aoi.createNewWiki("jaspreet", "templatexe", null,aoi.createWikiDocument(), true);
Did you install the default template "templatexe"?
} catch (XWikiException e) { e.printStackTrace(); } System.out.println("_____________********* " +ctx); System.out.println("_____________"+ctx); return "Hello " + myresourcename; } }
Above code is not working. Virtual xwiki is not being created using the API.
You should share the stack trace of the exception that is thrown. Thanks, Eduard
It is very urgent. Please help.
Thanks Karamjit. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Yes. I have installed it already. I am getting bellow error message " you donot have create wiki rights" Looks like a permission issue. Any idea how to set user in wikicontext? On Jul 31, 2011 7:23 PM, "Eduard Moraru" <[email protected]> wrote:
Hi Karamjit,
On Sun, Jul 31, 2011 at 2:13 PM, Karamjit Singh <[email protected] wrote:
Hi Team,
I am not able to create virtual xwiki through the XwikiManagerPluginAPI. I have developed just sample restful web service. Below is the code which I am using to create virtual xwiki :-
@Component("org.sisgma.xwiki.rest.HelloWorldResource") @Path("/hello/") public class HelloWorldResource extends XWikiResource { public HelloWorldResource(){ } @GET public String get(@DefaultValue("world") String myresourcename) throws XWikiException, QueryException { XWikiContext ctx = Utils.getXWikiContext(componentManager); try { WikiManagerPluginApi aoi =
(WikiManagerPluginApi)ctx.getWiki().getPluginApi(WikiManagerPlugin.PLUGIN_NAME,
ctx); ctx.setDoc(new XWikiDocument(new DocumentReference("jaspreet", "space", "page"))); System.out.println("_____________********* deleting xwiki"); aoi.deleteWiki("neenu", true); aoi.deleteWiki("neenu1", true); aoi.deleteWiki("karam", true); System.out.println("_____________********* deleted xwikies"); System.out.println("_____________********* Creating new xwiki"); aoi.createNewWiki("jaspreet", "templatexe", null,aoi.createWikiDocument(), true);
Did you install the default template "templatexe"?
} catch (XWikiException e) { e.printStackTrace(); } System.out.println("_____________********* " +ctx); System.out.println("_____________"+ctx); return "Hello " + myresourcename; } }
Above code is not working. Virtual xwiki is not being created using the API.
You should share the stack trace of the exception that is thrown.
Thanks, Eduard
It is very urgent. Please help.
Thanks Karamjit. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Eduard Moraru -
Karamjit Singh