0

I have read this in many places "You will eventually want to create your own runtime directory and keep it in your own source repository...". Can anyone tell me how to do that? What if I don't want to lose some of the OOTB components?

Currently I am just planning to have a separate webapp for custom developed components. Let's say, I want to have "ootb" mount point for the OOTB components and blank "" mount point for custom developed components. How should I do that? This is what I have tried without success:

<webapp-list>
    <webapp name="webroot" http-port="8080" https-enabled="false">
        <root-screen host=".*/ootb" location="component://webroot/screen/webroot.xml"/>
    </webapp>
    <webapp name="customroot" http-port="8080" https-enabled="false">
        <root-screen host=".*" location="component://customroot/screen/customroot.xml"/>
    </webapp>
</webapp-list>

If this does not work then one other solution that I can think of is to just have the "customroot" entry, and add the "webroot" as SubScreenItem in it. The "customroot" screen will just be blank, and my custom decorator will be present in the "customapps" screen which will be a counter part of the "apps" screen. And all my screens will use the "customapps" screen.

Although I haven't tried what I wrote above, but that somehow feels like a hack. I believe there should be some better way to do this.

And yes, I have read the article, I want to use localhost and there should be some way to do it with localhost too.

Community
  • 1
  • 1
Atul Vani
  • 61
  • 6

2 Answers2

0

As explained in the other StackOverflow question you linked to (on the word "article") the webapp element used at runtime is selected based on the "moqui-name" context-param from the web.xml file for the webapp (in or out of a WAR file). Unless you are deploying multiple WAR files or other forms of webapps this is not useful.

What you are describing would be handled by adding subscreens in the screen hierarchy at the desired points. The general idea with the screen hierarchy in Moqui is that you can have root screens of "applications" mounted through various means (see the annotations on the subscreens element or the Making Apps with Moqui book for details on the 3 ways of doing this). Part of the point of this is to AVOID multiple webapps mounted in the servlet container because that makes things more complicated, including: handling authc and sessions, configuration and deployment, and so on.

Generally for an application in a component you'll want to use a database record to add a subscreen to an existing screen in the hierarchy, mainly from the "webroot" component. Here is an example of that from the example app in Moqui (this adds an "example" path elements under the "apps" path element, where the apps.xml screen is mounted under the root screen, putting it at /apps/example):

<moqui.screen.SubscreensItem screenLocation="component://webroot/screen/webroot/apps.xml"
        subscreenName="example" userGroupId="ALL_USERS" menuTitle="Example" menuIndex="8" menuInclude="Y"
        subscreenLocation="component://example/screen/ExampleApp.xml"/>

Here is an example from PopCommerce to mount the root screen of the application under the root screen instead of the "apps" screen (i.e. making it located at /popc instead of /apps/popc; note that this means the decoration in the apps.xml screen will not be used because it's not in the render path):

<moqui.screen.SubscreensItem screenLocation="component://webroot/screen/webroot.xml"
        subscreenName="popc" userGroupId="ALL_USERS" menuTitle="POP Commerce" menuIndex="9" menuInclude="N"
        subscreenLocation="component://PopCommerce/screen/PopCommerceRoot.xml"/>
David E. Jones
  • 1,721
  • 1
  • 9
  • 8
  • David, can you please check my answer and provide any suggestions about how to do things better. Thanks. – Atul Vani Apr 23 '15 at 19:45
0

I think I might have asked a confusing question, but thanks for your time David. If I try to rephrase my question, it would be: "How to have a decorator screen which will not use any HTML from the webroot or apps screens?"

I think I found the answer. I just added my customroot screen as SubScreenItem under webroot screen, and mentioned the attribute standalone="true" in it. Now my URL: localhost:8080/customroot/foo does not use anything mentioned in webroot or apps screens.

Just that, now if I want to have all my components to be at root level in URL like: localhost:8080/foo I think the only way to do that would be to shift the OOTB components to some other URL like: localhost:8080/ootb/apps/AppList To do that I will have to add webroot as SubScreenItem of the customroot screen, and replace the webapp entry of webroot with that of customroot.

Damn, I tried so hard and it still is confusing.

Atul Vani
  • 61
  • 6
  • This question is much more clear, and might be best as a separate question on StackOverflow. If you don't want to use the webroot and its subscreens at all and instead point to a root screen in your component, just change the root-screen.@location value in your runtime Moqui Conf XML file. All of the example conf files have this element because it is part of the runtime configuration and not Moqui Framework itself (i.e. stuff in the moqui-*.jar file). If desired you can put webroot and other screens somewhere under your root screen. – David E. Jones May 01 '15 at 08:04