Re: Expected behaviour for javax.servlet.http.HttpServletRequest#getParts when request is not multipart

2019-11-23 Thread Behrang Saeedzadeh
My bad. It is documented in the API Java Docs:

* @throws ServletException if this request is not of type
* multipart/form-data


On Sun, Nov 24, 2019 at 3:15 PM Behrang Saeedzadeh 
wrote:

> When sending such a request, Tomcat throws an exception:
>
> $ curl -d documentDate=foo -d documentOwner=A123
> localhost:8080/file-server/a/upload
> SEVERE
> [http-nio-8080-exec-16]
> org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service()
> for servlet [A.UploadServlet]
> in context with path [/file-server] threw exception
> [org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException:
> the request doesn't contain a multipart/form-data or multipart/mixed
> stream, content type header is application/x-www-form-urlencoded] with root
> cause
> org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException:
> the request doesn't contain a multipart/form-data or multipart/mixed
> stream, content type header is application/x-www-form-urlencoded
>
> Shouldn't Tomcat instead return an empty collection?
>


Expected behaviour for javax.servlet.http.HttpServletRequest#getParts when request is not multipart

2019-11-23 Thread Behrang Saeedzadeh
When sending such a request, Tomcat throws an exception:

$ curl -d documentDate=foo -d documentOwner=A123
localhost:8080/file-server/a/upload
SEVERE
[http-nio-8080-exec-16]
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service()
for servlet [A.UploadServlet]
in context with path [/file-server] threw exception
[org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException:
the request doesn't contain a multipart/form-data or multipart/mixed
stream, content type header is application/x-www-form-urlencoded] with root
cause
org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException:
the request doesn't contain a multipart/form-data or multipart/mixed
stream, content type header is application/x-www-form-urlencoded

Shouldn't Tomcat instead return an empty collection?


Re: Official documentation for running an embedded Tomcat server

2019-11-23 Thread Behrang Saeedzadeh
I will create a PR if I find the time to write one.

On Sat, Nov 23, 2019 at 9:40 PM Mark Thomas  wrote:

> On 23/11/2019 08:17, Behrang Saeedzadeh wrote:
> > Hi all,
> >
> > Are there any official docs for how to run Tomcat as an embedded server?
> > Searching returns some results such as
> >
> https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat
> > but I haven't seen any official docs.
> >
> > Are there any?
>
> http://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/startup/Tomcat.html
>
> is the closest thing we have but I suspect parts of it are out of date.
> The unit tests are a good source of samples of how to use it.
>
> Care to contribute a how-to page for the docs?
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat 8.5.48: java.lang.StringIndexOutOfBoundsException

2019-11-23 Thread Mark Thomas
On 23/11/2019 15:38, i...@flyingfischer.ch wrote:
> openjdk version "13.0.1" 2019-10-15
> OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS)
> OpenJDK 64-Bit Server VM Zulu13.28+11-CA (build 13.0.1+10-MTS, mixed
> mode, sharing)

And how are you calling jsvc?

>From the stack trace it looks like an empty string is being passed as
the class name.

I wonder if this is related:
https://markmail.org/message/ouaatfznmjbrva23

Mark


> 
> Linux
> 
> built with
> 
> commons-daemon-native
> tomcat-native (./configure --with-apr=/usr/bin/apr-1-config
> --with-java-home=$JAVA_HOME --with-ssl=yes
> --prefix=/usr/share/tomcat8/$newVersion)
> 
> Markus
> 
> 
> Am 23.11.19 um 11:37 schrieb Mark Thomas:
>> On 23/11/2019 09:43, i...@flyingfischer.ch wrote:
>>> After updating to Tomcat 8.5.49 starting TC on daemon fails with:
>>>
>>> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>>> at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
>>> at java.base/java.lang.String.charAt(String.java:709)
>>> at
>>> org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:136)
>>> Cannot load daemon
>>> Service exit with a return value of 3
>>>
>>> Did needto roll back to 8.5.47 which runs fine.
>> Care to provide a few more details?
>>
>> Java version?
>>
>> Operating system?
>>
>> Steps to reproduce from a clean 8.5.49 install?
>>
>> Mark
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat 8.5.48: java.lang.StringIndexOutOfBoundsException

2019-11-23 Thread i...@flyingfischer.ch
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS)
OpenJDK 64-Bit Server VM Zulu13.28+11-CA (build 13.0.1+10-MTS, mixed
mode, sharing)

Linux

built with

commons-daemon-native
tomcat-native (./configure --with-apr=/usr/bin/apr-1-config
--with-java-home=$JAVA_HOME --with-ssl=yes
--prefix=/usr/share/tomcat8/$newVersion)

Markus


Am 23.11.19 um 11:37 schrieb Mark Thomas:
> On 23/11/2019 09:43, i...@flyingfischer.ch wrote:
>> After updating to Tomcat 8.5.49 starting TC on daemon fails with:
>>
>> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>> at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
>> at java.base/java.lang.String.charAt(String.java:709)
>> at
>> org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:136)
>> Cannot load daemon
>> Service exit with a return value of 3
>>
>> Did needto roll back to 8.5.47 which runs fine.
> Care to provide a few more details?
>
> Java version?
>
> Operating system?
>
> Steps to reproduce from a clean 8.5.49 install?
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Official documentation for running an embedded Tomcat server

2019-11-23 Thread Mark Thomas
On 23/11/2019 08:17, Behrang Saeedzadeh wrote:
> Hi all,
> 
> Are there any official docs for how to run Tomcat as an embedded server?
> Searching returns some results such as
> https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat
> but I haven't seen any official docs.
> 
> Are there any?
http://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/startup/Tomcat.html

is the closest thing we have but I suspect parts of it are out of date.
The unit tests are a good source of samples of how to use it.

Care to contribute a how-to page for the docs?

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat 8.5.48: java.lang.StringIndexOutOfBoundsException

2019-11-23 Thread Mark Thomas
On 23/11/2019 09:43, i...@flyingfischer.ch wrote:
> After updating to Tomcat 8.5.49 starting TC on daemon fails with:
> 
> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
> at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
> at java.base/java.lang.String.charAt(String.java:709)
> at
> org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:136)
> Cannot load daemon
> Service exit with a return value of 3
> 
> Did needto roll back to 8.5.47 which runs fine.

Care to provide a few more details?

Java version?

Operating system?

Steps to reproduce from a clean 8.5.49 install?

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Tomcat 8.5.48: java.lang.StringIndexOutOfBoundsException

2019-11-23 Thread i...@flyingfischer.ch
After updating to Tomcat 8.5.49 starting TC on daemon fails with:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
at java.base/java.lang.String.charAt(String.java:709)
at
org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:136)
Cannot load daemon
Service exit with a return value of 3

Did needto roll back to 8.5.47 which runs fine.

Best
Markus

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Official documentation for running an embedded Tomcat server

2019-11-23 Thread Behrang Saeedzadeh
Hi all,

Are there any official docs for how to run Tomcat as an embedded server?
Searching returns some results such as
https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat
but I haven't seen any official docs.

Are there any?

Thanks in advance,
Behrang