You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Titi Wangsa <bl...@gmail.com> on 2006/11/27 12:30:14 UTC

Multiple application in a single war

in the page
http://tapestry.apache.org/tapestry4/UsersGuide/configuration.html

there under the section
Web deployment descriptor

there is this line

As /WEB-INF/name/name.application. The name is the servlet name. This
location is only used in the rare case of a single WAR containing
multiple Tapestry applications.

i've googled "multiple tapestry war" but most results lead me to portlest.

this is a portion of my web.xml
	<servlet>
		<servlet-name>browse</servlet-name>
		<servlet-class>
			org.apache.tapestry.ApplicationServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet>
		<servlet-name>admin</servlet-name>
		<servlet-class>
			org.apache.tapestry.ApplicationServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>browse</servlet-name>
		<url-pattern>/browse/app</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>admin</servlet-name>
		<url-pattern>/admin/app</url-pattern>
	</servlet-mapping>

as you can see, i've setup 2 servlets
i also have a
WebContext/browse/Home.html
WebContext/WEB-INF/browse/Home.properties

WebContext/admin/Home.html
WebContext/WEB-INF/admin/Home.properties

the pages display properly if i use this url
/<context-root>/browse/app?service=page&page=browse/Home
but a page not found error occurs when i use this
/hiburankini/browse/app?service=page&page=Home
moreover
this link display a page in the admin module
http://localhost:8080/hiburankini/browse/app?service=page&page=admin/Home

checklist on two tapestry application in a single application context
1. Two Servlet with two different names and two servlet mappings
(/admin/app and /browse/app)

2. Two directories to put the html files (/admin/Home.html and
/browse/Home.html)
3. Two directories to put the hivemodule.xml file
(/WEB-INF/admin/hivemodule.xml and /WEB-INF/browse/hivemodule.xml)
The contents of the hivemodule files are rather empty
<?xml version="1.0"?>
<module id="admin" version="0.0.1" package="mypackage">
</module>
and
<?xml version="1.0"?>
<module id="browse" version="0.0.1" package="mypackage">
</module>
i have no idea what the package setting is used for


what i want is
http://localhost:8080/myapp/admin/app?service=page&page=Home
to display the admin home
and
http://localhost:8080/myapp/browse/app?service=page&page=Home
to display the browse home

did i miss anything?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple application in a single war

Posted by Phillip Rhodes <sp...@rhoderunner.com>.
Please drop the "/app" from your url pattern.  There is no need for it. 

    <servlet-mapping>
        <servlet-name>browse</servlet-name>
        <url-pattern>/browse/app</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>admin</servlet-name>
        <url-pattern>/admin/app</url-pattern>
    </servlet-mapping>

Needs to be:

    <servlet-mapping>
        <servlet-name>browse</servlet-name>
        <url-pattern>/browse</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>admin</servlet-name>
        <url-pattern>/admin</url-pattern>
    </servlet-mapping>

Here is my entire web.xml from a working war file with several tapestry 
apps.

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application
    2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>authsum app</display-name>
   
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/classes/authsumContext.xml</param-value>
    </context-param>
   
    <filter>
        <filter-name>redirect</filter-name>
        <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
    </filter>
   
    <filter>
        <filter-name>RememberMeFilter</filter-name>
        
<filter-class>org.authsum.login.filters.RememberMeFilter</filter-class>
    </filter>
    <filter>
        <filter-name>SessionCheckFilter</filter-name>
        
<filter-class>org.authsum.login.filters.SessionCheckFilter</filter-class>
    </filter>
   
    <filter-mapping>
        <filter-name>SessionCheckFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>   
       
   
   
       
    <filter-mapping>
        <filter-name>RememberMeFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
   
    <filter-mapping>
        <filter-name>redirect</filter-name>
        <url-pattern>/</url-pattern>
    </filter-mapping>
   
    <listener>
        <listener-class>
            
org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
   
    <servlet>
        <servlet-name>server</servlet-name>
        
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>
   
    <servlet>
        <servlet-name>dmi</servlet-name>
        
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>
   
    <servlet>
        <servlet-name>ldi</servlet-name>
        
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>
   
    <servlet>
        <servlet-name>visitpa</servlet-name>
        
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>
   
    <servlet>
        <servlet-name>xmlforge</servlet-name>
        
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>
   
    <!-- this will init the auth index, if not present -->
    <servlet>
        <servlet-name>InitServlet</servlet-name>
        <servlet-class> 
org.authsum.service.servlet.InitServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
       
    </servlet>
   
    <!--
    - Dispatcher servlet definition for HTTP remoting via Hessian, 
Burlap, and
    - Spring's HTTP invoker (see remoting-servlet.xml for the controllers).
    -->
    <servlet>
        <servlet-name>remoting</servlet-name>
        <servlet-class>
            
org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>4</load-on-startup>
    </servlet>
   

   
    <!--
    - Dispatcher servlet mapping for HTTP remoting via Hessian, Burlap, and
    - Spring's HTTP invoker (see remoting-servlet.xml for the controllers).
    -->
    <servlet-mapping>
        <servlet-name>remoting</servlet-name>
        <url-pattern>/remoting/*</url-pattern>
    </servlet-mapping>
   

   
    <servlet-mapping>
        <servlet-name>server</servlet-name>
        <url-pattern>/app</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>dmi</servlet-name>
        <url-pattern>/dmi</url-pattern>
    </servlet-mapping>
   
    <servlet-mapping>
        <servlet-name>ldi</servlet-name>
        <url-pattern>/ldi</url-pattern>
    </servlet-mapping>
   
    <servlet-mapping>
        <servlet-name>visitpa</servlet-name>
        <url-pattern>/visitpa</url-pattern>
    </servlet-mapping>
   
    <servlet-mapping>
        <servlet-name>xmlforge</servlet-name>
        <url-pattern>/xmlforge</url-pattern>
    </servlet-mapping>
   
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
   
</web-app>

Titi Wangsa wrote:

> still no go..
> my directory structure is this
> /admin/Home.html ("Admin" in h1 and title)
> /browse/Home.html ("Browse" in h1 and title)
> /WEB-INF/admin/Home.page
> /WEB-INF/browse/Home.page
> both contains the same thing
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE page-specification PUBLIC
>    "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
>    "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
> <page-specification class="org.apache.tapestry.html.BasePage">
> </page-specification>
>
> /WEB-INF/web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_ID" version="2.4"
>     xmlns="http://java.sun.com/xml/ns/j2ee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
>     <display-name>multiapp</display-name>
>     <welcome-file-list>
>         <welcome-file>index.html</welcome-file>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
>     <servlet>
>         <servlet-name>browse</servlet-name>
>         <servlet-class>
>             org.apache.tapestry.ApplicationServlet
>         </servlet-class>
>         <load-on-startup>0</load-on-startup>
>     </servlet>
>     <servlet>
>         <servlet-name>admin</servlet-name>
>         <servlet-class>
>             org.apache.tapestry.ApplicationServlet
>         </servlet-class>
>         <load-on-startup>0</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>browse</servlet-name>
>         <url-pattern>/browse/app</url-pattern>
>     </servlet-mapping>
>     <servlet-mapping>
>         <servlet-name>admin</servlet-name>
>         <url-pattern>/admin/app</url-pattern>
>     </servlet-mapping>
> </web-app>
> and
> finally
> /Home.html (contains "BAD BAD BAD" in h1 and title)
>
> and the url
> http://localhost:8080/multiapp/admin/app
> shows me "BAD BAD BAD"
> i'm stumped.
> can anyone send me a sample of a working war for mutiple application
> in a single war
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple application in a single war

Posted by Titi Wangsa <bl...@gmail.com>.
still no go..
my directory structure is this
/admin/Home.html ("Admin" in h1 and title)
/browse/Home.html ("Browse" in h1 and title)
/WEB-INF/admin/Home.page
/WEB-INF/browse/Home.page
both contains the same thing

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
    "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="org.apache.tapestry.html.BasePage">
</page-specification>

/WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>multiapp</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<servlet>
		<servlet-name>browse</servlet-name>
		<servlet-class>
			org.apache.tapestry.ApplicationServlet
		</servlet-class>
		<load-on-startup>0</load-on-startup>
	</servlet>
	<servlet>
		<servlet-name>admin</servlet-name>
		<servlet-class>
			org.apache.tapestry.ApplicationServlet
		</servlet-class>
		<load-on-startup>0</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>browse</servlet-name>
		<url-pattern>/browse/app</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>admin</servlet-name>
		<url-pattern>/admin/app</url-pattern>
	</servlet-mapping>
</web-app>
and
finally
/Home.html (contains "BAD BAD BAD" in h1 and title)

and the url
http://localhost:8080/multiapp/admin/app
shows me "BAD BAD BAD"
i'm stumped.
can anyone send me a sample of a working war for mutiple application
in a single war

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple application in a single war

Posted by spamsucks <sp...@rhoderunner.com>.
I have 4 different tapestry apps in one war, working successfully.

>From what I see below, you need to, change
>>                 <url-pattern>/browse/app</url-pattern>
to
              <url-pattern>/browse</url-pattern>

and
>>                 <url-pattern>/admin/app</url-pattern>
to
>>                 <url-pattern>/admin</url-pattern>

Don't forget to set the org.apache.tapestry.servlet-path in your application 
files.
<meta key="org.apache.tapestry.servlet-path" value="/admin"/>



<meta key="org.apache.tapestry.servlet-path" value="/browse"/>



you will access your application (assuming a default configuration in tomcat 
running on localhost) as http://localhost:8080/yourwarname/admin and 
http://localhost:8080/yourwarname/browse



----- Original Message ----- 
From: "Howard Lewis Ship" <hl...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Monday, November 27, 2006 11:09 AM
Subject: Re: Multiple application in a single war


> That looks like a bug to me. When I envisioned multi-application support, 
> I
> expected it to work the way you are stating.
>
> Try creating a .page file for each page, even if it is empty (in
> WEB-INF/browse and WEB-INF/admin).  That may "shock" Tapestry into finding
> the template properly.
>
> On 11/27/06, Titi Wangsa <bl...@gmail.com> wrote:
>>
>> in the page
>> http://tapestry.apache.org/tapestry4/UsersGuide/configuration.html
>>
>> there under the section
>> Web deployment descriptor
>>
>> there is this line
>>
>> As /WEB-INF/name/name.application. The name is the servlet name. This
>> location is only used in the rare case of a single WAR containing
>> multiple Tapestry applications.
>>
>> i've googled "multiple tapestry war" but most results lead me to 
>> portlest.
>>
>> this is a portion of my web.xml
>>         <servlet>
>>                 <servlet-name>browse</servlet-name>
>>                 <servlet-class>
>>                         org.apache.tapestry.ApplicationServlet
>>                 </servlet-class>
>>                 <load-on-startup>1</load-on-startup>
>>         </servlet>
>>         <servlet>
>>                 <servlet-name>admin</servlet-name>
>>                 <servlet-class>
>>                         org.apache.tapestry.ApplicationServlet
>>                 </servlet-class>
>>                 <load-on-startup>1</load-on-startup>
>>         </servlet>
>>         <servlet-mapping>
>>                 <servlet-name>browse</servlet-name>
>>                 <url-pattern>/browse/app</url-pattern>
>>         </servlet-mapping>
>>         <servlet-mapping>
>>                 <servlet-name>admin</servlet-name>
>>                 <url-pattern>/admin/app</url-pattern>
>>         </servlet-mapping>
>>
>> as you can see, i've setup 2 servlets
>> i also have a
>> WebContext/browse/Home.html
>> WebContext/WEB-INF/browse/Home.properties
>>
>> WebContext/admin/Home.html
>> WebContext/WEB-INF/admin/Home.properties
>>
>> the pages display properly if i use this url
>> /<context-root>/browse/app?service=page&page=browse/Home
>> but a page not found error occurs when i use this
>> /hiburankini/browse/app?service=page&page=Home
>> moreover
>> this link display a page in the admin module
>> http://localhost:8080/hiburankini/browse/app?service=page&page=admin/Home
>>
>> checklist on two tapestry application in a single application context
>> 1. Two Servlet with two different names and two servlet mappings
>> (/admin/app and /browse/app)
>>
>> 2. Two directories to put the html files (/admin/Home.html and
>> /browse/Home.html)
>> 3. Two directories to put the hivemodule.xml file
>> (/WEB-INF/admin/hivemodule.xml and /WEB-INF/browse/hivemodule.xml)
>> The contents of the hivemodule files are rather empty
>> <?xml version="1.0"?>
>> <module id="admin" version="0.0.1" package="mypackage">
>> </module>
>> and
>> <?xml version="1.0"?>
>> <module id="browse" version="0.0.1" package="mypackage">
>> </module>
>> i have no idea what the package setting is used for
>>
>>
>> what i want is
>> http://localhost:8080/myapp/admin/app?service=page&page=Home
>> to display the admin home
>> and
>> http://localhost:8080/myapp/browse/app?service=page&page=Home
>> to display the browse home
>>
>> did i miss anything?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> -- 
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Multiple application in a single war

Posted by Howard Lewis Ship <hl...@gmail.com>.
That looks like a bug to me. When I envisioned multi-application support, I
expected it to work the way you are stating.

Try creating a .page file for each page, even if it is empty (in
WEB-INF/browse and WEB-INF/admin).  That may "shock" Tapestry into finding
the template properly.

On 11/27/06, Titi Wangsa <bl...@gmail.com> wrote:
>
> in the page
> http://tapestry.apache.org/tapestry4/UsersGuide/configuration.html
>
> there under the section
> Web deployment descriptor
>
> there is this line
>
> As /WEB-INF/name/name.application. The name is the servlet name. This
> location is only used in the rare case of a single WAR containing
> multiple Tapestry applications.
>
> i've googled "multiple tapestry war" but most results lead me to portlest.
>
> this is a portion of my web.xml
>         <servlet>
>                 <servlet-name>browse</servlet-name>
>                 <servlet-class>
>                         org.apache.tapestry.ApplicationServlet
>                 </servlet-class>
>                 <load-on-startup>1</load-on-startup>
>         </servlet>
>         <servlet>
>                 <servlet-name>admin</servlet-name>
>                 <servlet-class>
>                         org.apache.tapestry.ApplicationServlet
>                 </servlet-class>
>                 <load-on-startup>1</load-on-startup>
>         </servlet>
>         <servlet-mapping>
>                 <servlet-name>browse</servlet-name>
>                 <url-pattern>/browse/app</url-pattern>
>         </servlet-mapping>
>         <servlet-mapping>
>                 <servlet-name>admin</servlet-name>
>                 <url-pattern>/admin/app</url-pattern>
>         </servlet-mapping>
>
> as you can see, i've setup 2 servlets
> i also have a
> WebContext/browse/Home.html
> WebContext/WEB-INF/browse/Home.properties
>
> WebContext/admin/Home.html
> WebContext/WEB-INF/admin/Home.properties
>
> the pages display properly if i use this url
> /<context-root>/browse/app?service=page&page=browse/Home
> but a page not found error occurs when i use this
> /hiburankini/browse/app?service=page&page=Home
> moreover
> this link display a page in the admin module
> http://localhost:8080/hiburankini/browse/app?service=page&page=admin/Home
>
> checklist on two tapestry application in a single application context
> 1. Two Servlet with two different names and two servlet mappings
> (/admin/app and /browse/app)
>
> 2. Two directories to put the html files (/admin/Home.html and
> /browse/Home.html)
> 3. Two directories to put the hivemodule.xml file
> (/WEB-INF/admin/hivemodule.xml and /WEB-INF/browse/hivemodule.xml)
> The contents of the hivemodule files are rather empty
> <?xml version="1.0"?>
> <module id="admin" version="0.0.1" package="mypackage">
> </module>
> and
> <?xml version="1.0"?>
> <module id="browse" version="0.0.1" package="mypackage">
> </module>
> i have no idea what the package setting is used for
>
>
> what i want is
> http://localhost:8080/myapp/admin/app?service=page&page=Home
> to display the admin home
> and
> http://localhost:8080/myapp/browse/app?service=page&page=Home
> to display the browse home
>
> did i miss anything?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com