You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Juan Munoz <JM...@Scient.com> on 2000/11/29 20:17:34 UTC

improper content-length header

Hello,

I'm developing a VoiceXML application using tellme.com's tools.  Apparently,
their browser doesn't work properly unless the correct content-length header
is set.  Tomcat doesn't set this correctly from the JSPs I'm writing.  How
can I configure tomcat to set the correct content-length?  I haven't been
able to find any documentation anywhere on this.

Has anyone else here been able to get tomcat to work with tellme?

Thanks for any help,

-Juan

-------------------------------------------
Juan Munoz
Scient (R):  Innovate - For What's Next(TM)
500 Technology Square
Cambridge, MA 02139
jmunoz@scient.com
617-768-2055(W)
617-461-6631(M)

Re: Turning off /servlet/* mapping?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Thom Park wrote:

> Hello,
>
> this works for specific servlets in specific web-apps. I was curious how to turn off the
> 'magic' backwards compatability mapping
> of /servlet/ in general.
>
> To be honest, I was trying to find where this default mapping is being performed. I
> would have thought if I removed the prefix= attribute from the
> InvokerInterceptor in servlet.xml that would have solved the issue. but that doesn't
> seem to do anything.
>

If you do not want the invoker functionality at all, simply remove the
InvokerInterceptor
entry completely.  If you want to change the prefix that it matches against,
modify the
prefix attribute (removing it just uses the default value of "/servlet/").

>
> I understand I can craft specific servlet-mappings for each application - what about
> 'standalone' servlets (I.e. those not in web-apps). I can always modifiy
> the ROOT/WEB-INF/web.xml to cover that case, however, If I were to turn off the
> /servlet/ mapping then I wouldn't have to edit all of those web.xml
> files in the web-apps ( and non-webapps).
>

In a servlet 2.2 environment, there is really no such thing as a "standalone"
servlet by
your definition.  Any request URI that is not matched by one of the installed
webapps is
handled by the ROOT webapp.

>
> I think what I'm asking here is whether the default mapping for any given servlet is
> "http[s]://<address>:<port>/[webapp]/servlet/[servlet-name]"?
>

To be pedantic, it is actually

   
http[s]://<address>[:<port>][/webapp]/servlet/<servlet-name-or-servlet-class>

but that is only because the invoker interceptor is installed by default.  If
you remove it,
as described above, the only way a servlet can be invoked is if it matches a
<servlet-mapping> entry in some web application's web.xml file.

NOTE:  The invoker facility is *not* a part of the servlet API specification, so
it is *not*
guaranteed to work (or work identically) in every servlet container.

>
> It seems to me that, unless I setup a url-pattern then this is the case - I'd just like
> that to be verified so I can stick it in some documentation that I'm writing :-)
>

The documentation for <url-pattern>, and pretty much everything else about the
web.xml file,
is the Servlet API Specification, which you can download from
<http://java.sun.com/products/servlet/download.html>.

>
> thanks,
>
> Thom
>

Craig McClanahan

Re: Turning off /servlet/* mapping?

Posted by Thom Park <tp...@borland.com>.
Hello,

this works for specific servlets in specific web-apps. I was curious how to turn off the
'magic' backwards compatability mapping
of /servlet/ in general.

To be honest, I was trying to find where this default mapping is being performed. I
would have thought if I removed the prefix= attribute from the
InvokerInterceptor in servlet.xml that would have solved the issue. but that doesn't
seem to do anything.

I understand I can craft specific servlet-mappings for each application - what about
'standalone' servlets (I.e. those not in web-apps). I can always modifiy
the ROOT/WEB-INF/web.xml to cover that case, however, If I were to turn off the
/servlet/ mapping then I wouldn't have to edit all of those web.xml
files in the web-apps ( and non-webapps).

I think what I'm asking here is whether the default mapping for any given servlet is
"http[s]://<address>:<port>/[webapp]/servlet/[servlet-name]"?

It seems to me that, unless I setup a url-pattern then this is the case - I'd just like
that to be verified so I can stick it in some documentation that I'm writing :-)

thanks,

Thom


"Craig R. McClanahan" wrote:

> Thom Park wrote:
>
> > I'm having Yet Another Servlet Mapping Problem.
> >
> > I'm trying to disable the /servlet/ mapping with my web-application. Here's the
> > gist of what's happening.
> >
> >  My webapp is called "songs" it get's deployed according to J2EE specs. In the
> > webapps folder there's a
> > songs folder with an html file called songs_index.html.
> >
> > in songs\WEB-INF, I put my servlet into the classes folder (and some dependent
> > jars in the lib folder).
> >
> > In web.xml I add the following:
> >
> > <servlet>
> > <servlet-name>listSongs</servlet-name>
> > <servlet-class>com.music.songs.ListSongServlet</servlet-class>
> > </servlet>
> >
>
> Add the following mapping in web.xml:
>
>     <servlet-mapping>
>         <servlet-name>listSongs</servlet-name>
>         <url-pattern>/listSongs/*</url-pattern>
>     </servlet-name>
>
> and the following URL will work:
>
>     http://localhost:8080/songs/listSongs
>
> You don't really need to "turn off" the default mapping -- what we are doing here is
> defining a new one.  You should also know that the path used in a mapping need not
> have the same name as your servlet class.  For instance, if you change the mapping
> above to this:
>
>     <servlet-mapping>
>         <servlet-name>listSongs</servlet-name>
>         <url-pattern>/list/*</url-pattern>
>     </servlet-name>
>
> then the correct URL would be
>
>     http://localhost:8080/songs/list
>
> instead.
>
> The rules for servlet mappings are found in the servlet API specification, which can
> be downloaded from
>
>     http://java.sun.com/products/servlet/download.html
>
> Craig McClanahan


Re: Turning off /servlet/* mapping?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Thom Park wrote:

> I'm having Yet Another Servlet Mapping Problem.
>
> I'm trying to disable the /servlet/ mapping with my web-application. Here's the
> gist of what's happening.
>
>  My webapp is called "songs" it get's deployed according to J2EE specs. In the
> webapps folder there's a
> songs folder with an html file called songs_index.html.
>
> in songs\WEB-INF, I put my servlet into the classes folder (and some dependent
> jars in the lib folder).
>
> In web.xml I add the following:
>
> <servlet>
> <servlet-name>listSongs</servlet-name>
> <servlet-class>com.music.songs.ListSongServlet</servlet-class>
> </servlet>
>

Add the following mapping in web.xml:

    <servlet-mapping>
        <servlet-name>listSongs</servlet-name>
        <url-pattern>/listSongs/*</url-pattern>
    </servlet-name>

and the following URL will work:

    http://localhost:8080/songs/listSongs

You don't really need to "turn off" the default mapping -- what we are doing here is
defining a new one.  You should also know that the path used in a mapping need not
have the same name as your servlet class.  For instance, if you change the mapping
above to this:

    <servlet-mapping>
        <servlet-name>listSongs</servlet-name>
        <url-pattern>/list/*</url-pattern>
    </servlet-name>

then the correct URL would be

    http://localhost:8080/songs/list

instead.

The rules for servlet mappings are found in the servlet API specification, which can
be downloaded from

    http://java.sun.com/products/servlet/download.html

Craig McClanahan



RE: Turning off /servlet/* mapping?

Posted by Bala Gurram <bg...@emis-intl.com>.
override the default servlet-mapping in the web.xml

-bala

-----Original Message-----
From: Thom Park [mailto:tpark@borland.com]
Sent: Friday, December 01, 2000 6:44 AM
To: tomcat-user@jakarta.apache.org
Subject: Turning off /servlet/* mapping?


I'm having Yet Another Servlet Mapping Problem.

I'm trying to disable the /servlet/ mapping with my web-application. Here's
the
gist of what's happening.

 My webapp is called "songs" it get's deployed according to J2EE specs. In
the
webapps folder there's a
songs folder with an html file called songs_index.html.

in songs\WEB-INF, I put my servlet into the classes folder (and some
dependent
jars in the lib folder).

In web.xml I add the following:

<servlet>
<servlet-name>listSongs</servlet-name>
<servlet-class>com.music.songs.ListSongServlet</servlet-class>
</servlet>

I don't specify a mapping as I want to use the default.

In songs_index.html, I do a FORM POST to the following URL:
"serlvet/listSongs"

This works, however if I try the following
"listSongs"
 it doesn't (404 is returned).

If I type in my URL as follows:

http://localhost:8080/songs/servlet/listSongs

the servlet fires

if I type

http://localhost:8080/songs/listSongs

it doesn't.

so How do I turn off that /servlet/ prefix? I've tried removing
prefix=/servlet/
from the InvokerInterceptor entry in server.xml
Additionally, what does that odd web.xml file in <TOMCAT_HOME>/conf do? I
notice
that there's a servlet mapping for servlet-name=Invoker
that maps to /servlet/* - I tried removing that but it made no difference.

How *do* you set up a servlet to be called in the application space but
without
the /servet/ prefix?

-Thom

p.s. I'm using the final release of Tomcat.


Juan Munoz wrote:

> Hello,
>
> I'm developing a VoiceXML application using tellme.com's tools.
Apparently,
> their browser doesn't work properly unless the correct content-length
header
> is set.  Tomcat doesn't set this correctly from the JSPs I'm writing.  How
> can I configure tomcat to set the correct content-length?  I haven't been
> able to find any documentation anywhere on this.
>
> Has anyone else here been able to get tomcat to work with tellme?
>
> Thanks for any help,
>
> -Juan
>
> -------------------------------------------
> Juan Munoz
> Scient (R):  Innovate - For What's Next(TM)
> 500 Technology Square
> Cambridge, MA 02139
> jmunoz@scient.com
> 617-768-2055(W)
> 617-461-6631(M)



Turning off /servlet/* mapping?

Posted by Thom Park <tp...@borland.com>.
I'm having Yet Another Servlet Mapping Problem.

I'm trying to disable the /servlet/ mapping with my web-application. Here's the
gist of what's happening.

 My webapp is called "songs" it get's deployed according to J2EE specs. In the
webapps folder there's a
songs folder with an html file called songs_index.html.

in songs\WEB-INF, I put my servlet into the classes folder (and some dependent
jars in the lib folder).

In web.xml I add the following:

<servlet>
<servlet-name>listSongs</servlet-name>
<servlet-class>com.music.songs.ListSongServlet</servlet-class>
</servlet>

I don't specify a mapping as I want to use the default.

In songs_index.html, I do a FORM POST to the following URL:
"serlvet/listSongs"

This works, however if I try the following
"listSongs"
 it doesn't (404 is returned).

If I type in my URL as follows:

http://localhost:8080/songs/servlet/listSongs

the servlet fires

if I type

http://localhost:8080/songs/listSongs

it doesn't.

so How do I turn off that /servlet/ prefix? I've tried removing prefix=/servlet/
from the InvokerInterceptor entry in server.xml
Additionally, what does that odd web.xml file in <TOMCAT_HOME>/conf do? I notice
that there's a servlet mapping for servlet-name=Invoker
that maps to /servlet/* - I tried removing that but it made no difference.

How *do* you set up a servlet to be called in the application space but without
the /servet/ prefix?

-Thom

p.s. I'm using the final release of Tomcat.


Juan Munoz wrote:

> Hello,
>
> I'm developing a VoiceXML application using tellme.com's tools.  Apparently,
> their browser doesn't work properly unless the correct content-length header
> is set.  Tomcat doesn't set this correctly from the JSPs I'm writing.  How
> can I configure tomcat to set the correct content-length?  I haven't been
> able to find any documentation anywhere on this.
>
> Has anyone else here been able to get tomcat to work with tellme?
>
> Thanks for any help,
>
> -Juan
>
> -------------------------------------------
> Juan Munoz
> Scient (R):  Innovate - For What's Next(TM)
> 500 Technology Square
> Cambridge, MA 02139
> jmunoz@scient.com
> 617-768-2055(W)
> 617-461-6631(M)