Form URL forming in Tapestry 4.0

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Form URL forming in Tapestry 4.0

richard.hensley
I use the following servlet mapping

    <servlet>
        <servlet-name>starteam</servlet-name>

 
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>

        <load-on-startup>0</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>starteam</servlet-name>

        <url-pattern>/starteam</url-pattern>
    </servlet-mapping>


In this case, my context is /

When I hit my home page, I the following url for the a form:

           <form method="GET" action="/app" name="search">

Which is not right. Where would I start chasing this down?

It should be:

           <form method="GET" action="/starteam" name="search">

Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Form URL forming in Tapestry 4.0

pferraro
You need to define a "org.apache.tapestry.servlet-path" <meta> value in
your .application file.  You can optionally define it elsewhere:
http://jakarta.apache.org/tapestry/current/UsersGuide/hivemind.html 
(see section on the app-property hivemind prefix)

Paul

Hensley, Richard wrote:

>I use the following servlet mapping
>
>    <servlet>
>        <servlet-name>starteam</servlet-name>
>
>
><servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
>
>        <load-on-startup>0</load-on-startup>
>    </servlet>
>
>    <servlet-mapping>
>        <servlet-name>starteam</servlet-name>
>
>        <url-pattern>/starteam</url-pattern>
>    </servlet-mapping>
>
>
>In this case, my context is /
>
>When I hit my home page, I the following url for the a form:
>
>           <form method="GET" action="/app" name="search">
>
>Which is not right. Where would I start chasing this down?
>
>It should be:
>
>           <form method="GET" action="/starteam" name="search">
>
>Richard
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Form URL forming in Tapestry 4.0

richard.hensley
In reply to this post by richard.hensley
The core to this problem is that the configuration of the LinkFactory
service get's a servlet path from a tapestry configuration property:

  <service-point id="LinkFactory" interface="LinkFactory">
   
    A source of ILinks for engine services.
   
    <invoke-factory>
      <construct class="impl.LinkFactoryImpl">
        <set-object property="dataSqueezer"
value="infrastructure:dataSqueezer"/>
        <set-configuration property="contributions"
configuration-id="ServiceEncoders"/>
        <set-object property="servletPath"
value="app-property:org.apache.tapestry.servlet-path"/>
        <set-object property="contextPath"
value="infrastructure:contextPath"/>
                    <set-object property="request"
value="infrastructure:request"/>
        <set-service property="persistenceStrategySource"
service-id="tapestry.persist.PropertyPersistenceStrategySource"/>
      </construct>
    </invoke-factory>
   
  </service-point>

This is documented in the configuration section of the user guide, but I
have to question the wisdom of configuring a servlet path in two places, one
in web.xml, and one in the .application file as a meta property. Or, is the
true servlet path not available from the HttpServletRequest.getServletPath()
method?

-----Original Message-----
From: Hensley, Richard
Sent: Thursday, May 12, 2005 2:20 PM
To: 'Tapestry development'
Subject: Form URL forming in Tapestry 4.0

I use the following servlet mapping

    <servlet>
        <servlet-name>starteam</servlet-name>

 
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>

        <load-on-startup>0</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>starteam</servlet-name>

        <url-pattern>/starteam</url-pattern>
    </servlet-mapping>


In this case, my context is /

When I hit my home page, I the following url for the a form:

           <form method="GET" action="/app" name="search">

Which is not right. Where would I start chasing this down?

It should be:

           <form method="GET" action="/starteam" name="search">

Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Form URL forming in Tapestry 4.0

Howard Lewis Ship
In reply to this post by pferraro
In 3.0, there was just the one mapping, so it could figure it out.
Servlet API lacks some *necessary* introspection along these lines, so
now if you don't use "/app", you have to tell Tapestry what you did
use.

On 5/12/05, Paul Ferraro <[hidden email]> wrote:

> You need to define a "org.apache.tapestry.servlet-path" <meta> value in
> your .application file.  You can optionally define it elsewhere:
> http://jakarta.apache.org/tapestry/current/UsersGuide/hivemind.html
> (see section on the app-property hivemind prefix)
>
> Paul
>  
> Hensley, Richard wrote:
>
> >I use the following servlet mapping
> >
> >    <servlet>
> >        <servlet-name>starteam</servlet-name>
> >
> >
> ><servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
> >
> >        <load-on-startup>0</load-on-startup>
> >    </servlet>
> >
> >    <servlet-mapping>
> >        <servlet-name>starteam</servlet-name>
> >
> >        <url-pattern>/starteam</url-pattern>
> >    </servlet-mapping>
> >
> >
> >In this case, my context is /
> >
> >When I hit my home page, I the following url for the a form:
> >
> >           <form method="GET" action="/app" name="search">
> >
> >Which is not right. Where would I start chasing this down?
> >
> >It should be:
> >
> >           <form method="GET" action="/starteam" name="search">
> >
> >Richard
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Form URL forming in Tapestry 4.0

richard.hensley
In reply to this post by richard.hensley
I found another spot were the Tapestry code depends on getServletPath() so,
I'm must be missing something.

This is from ServletWebRequest.java

    /**
     * Returns {@link HttpServletRequest#getServletPath()}.
     */
    public String getActivationPath()
    {
        String servletPath = _servletRequest.getServletPath();
        String pathInfo = _servletRequest.getPathInfo();

        return pathInfo == null ? servletPath : servletPath + pathInfo;
    }

Richard
-----Original Message-----
From: Hensley, Richard
Sent: Thursday, May 12, 2005 3:01 PM
To: Hensley, Richard; Tapestry development
Subject: RE: Form URL forming in Tapestry 4.0

The core to this problem is that the configuration of the LinkFactory
service get's a servlet path from a tapestry configuration property:

  <service-point id="LinkFactory" interface="LinkFactory">
   
    A source of ILinks for engine services.
   
    <invoke-factory>
      <construct class="impl.LinkFactoryImpl">
        <set-object property="dataSqueezer"
value="infrastructure:dataSqueezer"/>
        <set-configuration property="contributions"
configuration-id="ServiceEncoders"/>
        <set-object property="servletPath"
value="app-property:org.apache.tapestry.servlet-path"/>
        <set-object property="contextPath"
value="infrastructure:contextPath"/>
                    <set-object property="request"
value="infrastructure:request"/>
        <set-service property="persistenceStrategySource"
service-id="tapestry.persist.PropertyPersistenceStrategySource"/>
      </construct>
    </invoke-factory>
   
  </service-point>

This is documented in the configuration section of the user guide, but I
have to question the wisdom of configuring a servlet path in two places, one
in web.xml, and one in the .application file as a meta property. Or, is the
true servlet path not available from the HttpServletRequest.getServletPath()
method?

-----Original Message-----
From: Hensley, Richard
Sent: Thursday, May 12, 2005 2:20 PM
To: 'Tapestry development'
Subject: Form URL forming in Tapestry 4.0

I use the following servlet mapping

    <servlet>
        <servlet-name>starteam</servlet-name>

 
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>

        <load-on-startup>0</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>starteam</servlet-name>

        <url-pattern>/starteam</url-pattern>
    </servlet-mapping>


In this case, my context is /

When I hit my home page, I the following url for the a form:

           <form method="GET" action="/app" name="search">

Which is not right. Where would I start chasing this down?

It should be:

           <form method="GET" action="/starteam" name="search">

Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Form URL forming in Tapestry 4.0

Howard Lewis Ship
In reply to this post by richard.hensley
When you can have URLs such as:

/Home.html
/app
/home.svc
/admin/Master,form.direct

and so forth ... what is the servlet URL?  As I was saying, in 3.0, it
could be determined from the first HttpServletRequest ("/app") and no
questions after that. Not so in 4.0.

On 5/12/05, Hensley, Richard <[hidden email]> wrote:

> The core to this problem is that the configuration of the LinkFactory
> service get's a servlet path from a tapestry configuration property:
>
>   <service-point id="LinkFactory" interface="LinkFactory">
>
>     A source of ILinks for engine services.
>
>     <invoke-factory>
>       <construct class="impl.LinkFactoryImpl">
>         <set-object property="dataSqueezer"
> value="infrastructure:dataSqueezer"/>
>         <set-configuration property="contributions"
> configuration-id="ServiceEncoders"/>
>         <set-object property="servletPath"
> value="app-property:org.apache.tapestry.servlet-path"/>
>         <set-object property="contextPath"
> value="infrastructure:contextPath"/>
>                     <set-object property="request"
> value="infrastructure:request"/>
>         <set-service property="persistenceStrategySource"
> service-id="tapestry.persist.PropertyPersistenceStrategySource"/>
>       </construct>
>     </invoke-factory>
>
>   </service-point>
>
> This is documented in the configuration section of the user guide, but I
> have to question the wisdom of configuring a servlet path in two places, one
> in web.xml, and one in the .application file as a meta property. Or, is the
> true servlet path not available from the HttpServletRequest.getServletPath()
> method?
>
> -----Original Message-----
> From: Hensley, Richard
> Sent: Thursday, May 12, 2005 2:20 PM
> To: 'Tapestry development'
> Subject: Form URL forming in Tapestry 4.0
>
> I use the following servlet mapping
>
>     <servlet>
>         <servlet-name>starteam</servlet-name>
>
> <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
>
>         <load-on-startup>0</load-on-startup>
>     </servlet>
>
>     <servlet-mapping>
>         <servlet-name>starteam</servlet-name>
>
>         <url-pattern>/starteam</url-pattern>
>     </servlet-mapping>
>
> In this case, my context is /
>
> When I hit my home page, I the following url for the a form:
>
>            <form method="GET" action="/app" name="search">
>
> Which is not right. Where would I start chasing this down?
>
> It should be:
>
>            <form method="GET" action="/starteam" name="search">
>
> Richard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Form URL forming in Tapestry 4.0

richard.hensley
In reply to this post by richard.hensley
Thanks for the info Howard. I was just about to write a note that I figured
out why it worked the way it did. It took educating myself quite a bit.

Richard

-----Original Message-----
From: Howard Lewis Ship [mailto:[hidden email]]
Sent: Thursday, May 12, 2005 3:09 PM
To: Tapestry development
Subject: Re: Form URL forming in Tapestry 4.0

When you can have URLs such as:

/Home.html
/app
/home.svc
/admin/Master,form.direct

and so forth ... what is the servlet URL?  As I was saying, in 3.0, it
could be determined from the first HttpServletRequest ("/app") and no
questions after that. Not so in 4.0.

On 5/12/05, Hensley, Richard <[hidden email]> wrote:

> The core to this problem is that the configuration of the LinkFactory
> service get's a servlet path from a tapestry configuration property:
>
>   <service-point id="LinkFactory" interface="LinkFactory">
>
>     A source of ILinks for engine services.
>
>     <invoke-factory>
>       <construct class="impl.LinkFactoryImpl">
>         <set-object property="dataSqueezer"
> value="infrastructure:dataSqueezer"/>
>         <set-configuration property="contributions"
> configuration-id="ServiceEncoders"/>
>         <set-object property="servletPath"
> value="app-property:org.apache.tapestry.servlet-path"/>
>         <set-object property="contextPath"
> value="infrastructure:contextPath"/>
>                     <set-object property="request"
> value="infrastructure:request"/>
>         <set-service property="persistenceStrategySource"
> service-id="tapestry.persist.PropertyPersistenceStrategySource"/>
>       </construct>
>     </invoke-factory>
>
>   </service-point>
>
> This is documented in the configuration section of the user guide, but I
> have to question the wisdom of configuring a servlet path in two places,
one
> in web.xml, and one in the .application file as a meta property. Or, is
the
> true servlet path not available from the
HttpServletRequest.getServletPath()

> method?
>
> -----Original Message-----
> From: Hensley, Richard
> Sent: Thursday, May 12, 2005 2:20 PM
> To: 'Tapestry development'
> Subject: Form URL forming in Tapestry 4.0
>
> I use the following servlet mapping
>
>     <servlet>
>         <servlet-name>starteam</servlet-name>
>
> <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
>
>         <load-on-startup>0</load-on-startup>
>     </servlet>
>
>     <servlet-mapping>
>         <servlet-name>starteam</servlet-name>
>
>         <url-pattern>/starteam</url-pattern>
>     </servlet-mapping>
>
> In this case, my context is /
>
> When I hit my home page, I the following url for the a form:
>
>            <form method="GET" action="/app" name="search">
>
> Which is not right. Where would I start chasing this down?
>
> It should be:
>
>            <form method="GET" action="/starteam" name="search">
>
> Richard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Form URL forming in Tapestry 4.0

Howard Lewis Ship
In reply to this post by richard.hensley
I believe this bit of code reconstitutes the URL so that it can be fed to
the ServiceEncoders, which will decode query parameters (typically service
and page) from the portions of the path (such as the file extension).

On 5/12/05, Hensley, Richard <[hidden email]> wrote:

>
> I found another spot were the Tapestry code depends on getServletPath()
> so,
> I'm must be missing something.
>
> This is from ServletWebRequest.java
>
> /**
> * Returns {@link HttpServletRequest#getServletPath()}.
> */
> public String getActivationPath()
> {
> String servletPath = _servletRequest.getServletPath();
> String pathInfo = _servletRequest.getPathInfo();
>
> return pathInfo == null ? servletPath : servletPath + pathInfo;
> }
>
> Richard
> -----Original Message-----
> From: Hensley, Richard
> Sent: Thursday, May 12, 2005 3:01 PM
> To: Hensley, Richard; Tapestry development
> Subject: RE: Form URL forming in Tapestry 4.0
>
> The core to this problem is that the configuration of the LinkFactory
> service get's a servlet path from a tapestry configuration property:
>
> <service-point id="LinkFactory" interface="LinkFactory">
>
> A source of ILinks for engine services.
>
> <invoke-factory>
> <construct class="impl.LinkFactoryImpl">
> <set-object property="dataSqueezer"
> value="infrastructure:dataSqueezer"/>
> <set-configuration property="contributions"
> configuration-id="ServiceEncoders"/>
> <set-object property="servletPath"
> value="app-property:org.apache.tapestry.servlet-path"/>
> <set-object property="contextPath"
> value="infrastructure:contextPath"/>
> <set-object property="request"
> value="infrastructure:request"/>
> <set-service property="persistenceStrategySource"
> service-id="tapestry.persist.PropertyPersistenceStrategySource"/>
> </construct>
> </invoke-factory>
>
> </service-point>
>
> This is documented in the configuration section of the user guide, but I
> have to question the wisdom of configuring a servlet path in two places,
> one
> in web.xml, and one in the .application file as a meta property. Or, is
> the
> true servlet path not available from the HttpServletRequest.getServletPath
> ()
> method?
>
> -----Original Message-----
> From: Hensley, Richard
> Sent: Thursday, May 12, 2005 2:20 PM
> To: 'Tapestry development'
> Subject: Form URL forming in Tapestry 4.0
>
> I use the following servlet mapping
>
> <servlet>
> <servlet-name>starteam</servlet-name>
>
> <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
>
> <load-on-startup>0</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>starteam</servlet-name>
>
> <url-pattern>/starteam</url-pattern>
> </servlet-mapping>
>
> In this case, my context is /
>
> When I hit my home page, I the following url for the a form:
>
> <form method="GET" action="/app" name="search">
>
> Which is not right. Where would I start chasing this down?
>
> It should be:
>
> <form method="GET" action="/starteam" name="search">
>
> Richard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

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