Re: Jars in Tomcat lib directory

2021-01-18 Thread Martin Grigorov
Hi,

On Mon, Jan 18, 2021 at 10:38 PM Jonnalagadda, Swathi (External) <
swathi.jonnalaga...@xerox.com> wrote:

> The application was an age old application and was built using ant which
> means all required jars will be packaged.
>
> As part of testing the application after upgrading to Java 1.8 and
> deployed in tomcat 9, I realized that couple of additional jars are
> required during runtime.
>
> I then added these jars to Tomcat lib directory and observed that it is
> not picking up these unless I add it to classpath
>

Classes in jar files in $CATALINA_BASE/lib are available for all web
applications!
How do you "add to the classpath" ? I have the feeling you do something in
your bin/setenv.sh that breaks the default configuration.


>
> Regards
> Swathi
>
> -Original Message-
> From: Mounika Reddy [mailto:spidermai...@gmail.com]
> Sent: Monday, January 18, 2021 11:49 PM
> To: Tomcat Users List
> Subject: Re: Jars in Tomcat lib directory
>
> CAUTION:   This email originated from outside the organization. Do not
> click links or open attachments unless you recognize the sender and know
> the content is safe.
>
> It means your tomcat setup is screwed up. You can actually package in your
> application as a dependency and see if it picks up. If not, then post the
> logs here to understand what's going on
>
> On Mon, Jan 18, 2021, 1:09 PM Jonnalagadda, Swathi (External) <
> swathi.jonnalaga...@xerox.com> wrote:
>
> > I am not sure if I am missing some configuration setting but what I
> > see is unless I add externally added jars under tomcat/lib to
> > classpath I don’t see them considerd by Tomcat irrespective of wether
> they are needed or not.
> >
> > For example I added ojdbc14.jar to Tomcat lib directory assuming that
> > it will consider it in classpath but until I specified the path of the
> > jar in classpath, the server wasn’t considering the jar.
> >
> > Please advise.
> >
> > -Original Message-
> > From: Mounika Reddy [mailto:spidermai...@gmail.com]
> > Sent: Monday, January 18, 2021 6:32 PM
> > To: Tomcat Users List
> > Subject: Re: Jars in Tomcat lib directory
> >
> > CAUTION:   This email originated from outside the organization. Do not
> > click links or open attachments unless you recognize the sender and
> > know the content is safe.
> >
> > It will provided if your application requires.
> >
> > On Mon, Jan 18, 2021, 7:54 AM Jonnalagadda, Swathi (External) <
> > swathi.jonnalaga...@xerox.com> wrote:
> >
> > > Hi
> > >
> > > Doesn’t tomcat consider jar files under lib directory in classpath.
> > > Do we have to do any additional configuration for that?
> > >
> > >
> > > Thanks
> > > Swathi
> > >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>


SSL trouble in embeddedLand

2021-01-18 Thread Rob Sargent


Stuck in my basement with no real domain I'm having trouble setting up
SSL/TLS on an embedded tomcat instance. And I'm very lost, having tried
more dead ends than I can remember.

I used this to generate cert and key
openssl req -out localhost.crt -key localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name =
dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature,
nonRepudiation, keyEncipherment,
dataEncipherment\nextendedKeyUsage=serverAuth")

and try to apply those with

-Djavax.net.ssl.trustStore=/tmp/key/localhost.crt
-Djavax.net.ssl.trustStorePassword=changeit
-Djavax.net.ssl.trustStoreType=PKCS12
-Djavax.net.ssl.keyStore=/tmp/key/localhost.key
-Djavax.net.ssl.keyStorePassword=changeit
-Dhttps.protocols=TLSv1.2,TLSv1.3
-Djdk.tls.client.protocols=TLSv1.2,TLSv1.3

I get "toDerInputStream rejects tag type 45".

That error rears its ugly head in several places such when adding those
same two localhost files to a pkcs12 rendition of the OS's cacerts file
using below. The crt goes in quietly. (I'm couldn't convince my self of
the openssl equivalent of this command)
root@gitanmax:/tmp/key# keytool -importkeystore -srckeystore 
localhost.key -srckeypass changeit -srcstoretype pkcs12 -destkeystore 
cacerts.pkcs12 -deststoretype pkcs12 -srcalias localhost -destalias 
tomcatlocal

Importing keystore localhost.key to cacerts.pkcs12...
Enter destination keystore password: changeit
Enter source keystore password: changeit
keytool error: java.io.IOException: toDerInputStream rejects tag type 45

My actual first attempt was to just use keytool to generate a cert
interactively, filling in my own bogus values but that hit the domain
name mismatch gotcha.

Then, there's confusion on the java side as well.

My plan was to add a connector for my webapp

embeddedTomcat = new Tomcat();
logger.debug("handing in CATALINA_HOME as " + 
System.getenv("CATALINA_HOME"));

embeddedTomcat.setPort(tomcatPort-1);
embeddedTomcat.enableNaming();
Connector defaultConnector = embeddedTomcat.getConnector(); // an init, 
really

defaultConnector.setSecure(true); // force https?

Service service = embeddedTomcat.getService();
service.addConnector(addTLSConnector(tomcatPort));

logger.info("tomcatd listening on port " + tomcatPort);
String contextRootPath = System.getenv("CATALINA_HOME");
logger.debug("contextRootPath is {}", contextRootPath);
Context contextTomcat = embeddedTomcat.addContext("", new 
File(contextRootPath + "/sgs").getAbsolutePath());
logger.debug("host: {}, general context basename {}", 
embeddedTomcat.getHost(), contextTomcat.getBaseName());

//TODO: cut from here ...
java.time.LocalDateTime bootDT = java.time.LocalDateTime.now();
Tomcat.addServlet(contextTomcat, "monitor", new HttpServlet() {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
ServletOutputStream out = resp.getOutputStream();
out.write("SGS Agent monitor: SGS_OK\n".getBytes());
out.write(("Up since " + bootDT.toString()).getBytes());
out.write(("\nTime now " + 
java.time.LocalDateTime.now().toString()).getBytes());

out.flush();
out.close();
}
});
contextTomcat.addServletMappingDecoded("/monitor", "monitor");
// My webapp
Context sgsContext = embeddedTomcat.addWebapp("/sgs", contextRootPath + 
"/sgs"); // /sgs.war

embeddedTomcat.start();
embeddedTomcat.getServer().await();

private Connector addTLSConnector(Connector connector, int tcport) {
File keyFile = new File (System.getProperty("SGSSRVR_keystoreFile"));
if (! keyFile.exists()) throw new RuntimeException("where's the 
keystore?");

connector.setPort(tcport);
connector.setSecure(true);
connector.setScheme("https");
connector.setProperty("protocol", "HTTP/1.1");
connector.setProperty("sslProtocol", "TLS");
connector.setProperty("address","127.0.0.1");
connector.setProperty("clientAuth", "false");
connector.setProperty("maxThreads", "200");
connector.setProperty("protocol", 
"org.apache.coyote.http11.Http11NioProtocol");

connector.setProperty("SSLEnabled", "true");
return connector;
}

private Connector addTLSConnector(int tcport) {
Connector connector = new Connector();
addTLSConnector(connector, tcport);
return connector;
}

That "monitor" works, on a separate port, on either http or https as per
defaultConnector.setSecure(isHttps);
but possibly because I've diddle with chrome's security settings.

I have a similar "monitor" as a servlet which I use as my
is-anybody-home call to start my analyses. And of course can also use
it via the browser at /seg/webmonitor.

All these behave when SSL is not in play, but I'm forced, very much
against my will, to use SSL so here I am bother the good folks on this
list for more help.





Re: Jars in Tomcat lib directory

2021-01-18 Thread Mounika Reddy
If you need more jars, ideally you should fix the ant build to include
additional dependencies. Anyways, can you post the logs here ? It's
possible there may be a conflicts etc

On Mon, Jan 18, 2021, 3:38 PM Jonnalagadda, Swathi (External) <
swathi.jonnalaga...@xerox.com> wrote:

> The application was an age old application and was built using ant which
> means all required jars will be packaged.
>
> As part of testing the application after upgrading to Java 1.8 and
> deployed in tomcat 9, I realized that couple of additional jars are
> required during runtime.
>
> I then added these jars to Tomcat lib directory and observed that it is
> not picking up these unless I add it to classpath
>
> Regards
> Swathi
>
> -Original Message-
> From: Mounika Reddy [mailto:spidermai...@gmail.com]
> Sent: Monday, January 18, 2021 11:49 PM
> To: Tomcat Users List
> Subject: Re: Jars in Tomcat lib directory
>
> CAUTION:   This email originated from outside the organization. Do not
> click links or open attachments unless you recognize the sender and know
> the content is safe.
>
> It means your tomcat setup is screwed up. You can actually package in your
> application as a dependency and see if it picks up. If not, then post the
> logs here to understand what's going on
>
> On Mon, Jan 18, 2021, 1:09 PM Jonnalagadda, Swathi (External) <
> swathi.jonnalaga...@xerox.com> wrote:
>
> > I am not sure if I am missing some configuration setting but what I
> > see is unless I add externally added jars under tomcat/lib to
> > classpath I don’t see them considerd by Tomcat irrespective of wether
> they are needed or not.
> >
> > For example I added ojdbc14.jar to Tomcat lib directory assuming that
> > it will consider it in classpath but until I specified the path of the
> > jar in classpath, the server wasn’t considering the jar.
> >
> > Please advise.
> >
> > -Original Message-
> > From: Mounika Reddy [mailto:spidermai...@gmail.com]
> > Sent: Monday, January 18, 2021 6:32 PM
> > To: Tomcat Users List
> > Subject: Re: Jars in Tomcat lib directory
> >
> > CAUTION:   This email originated from outside the organization. Do not
> > click links or open attachments unless you recognize the sender and
> > know the content is safe.
> >
> > It will provided if your application requires.
> >
> > On Mon, Jan 18, 2021, 7:54 AM Jonnalagadda, Swathi (External) <
> > swathi.jonnalaga...@xerox.com> wrote:
> >
> > > Hi
> > >
> > > Doesn’t tomcat consider jar files under lib directory in classpath.
> > > Do we have to do any additional configuration for that?
> > >
> > >
> > > Thanks
> > > Swathi
> > >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>


RE: Jars in Tomcat lib directory

2021-01-18 Thread Jonnalagadda, Swathi (External)
The application was an age old application and was built using ant which means 
all required jars will be packaged. 

As part of testing the application after upgrading to Java 1.8 and deployed in 
tomcat 9, I realized that couple of additional jars are required during runtime.

I then added these jars to Tomcat lib directory and observed that it is not 
picking up these unless I add it to classpath

Regards
Swathi

-Original Message-
From: Mounika Reddy [mailto:spidermai...@gmail.com] 
Sent: Monday, January 18, 2021 11:49 PM
To: Tomcat Users List
Subject: Re: Jars in Tomcat lib directory

CAUTION:   This email originated from outside the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.

It means your tomcat setup is screwed up. You can actually package in your 
application as a dependency and see if it picks up. If not, then post the logs 
here to understand what's going on

On Mon, Jan 18, 2021, 1:09 PM Jonnalagadda, Swathi (External) < 
swathi.jonnalaga...@xerox.com> wrote:

> I am not sure if I am missing some configuration setting but what I 
> see is unless I add externally added jars under tomcat/lib to 
> classpath I don’t see them considerd by Tomcat irrespective of wether they 
> are needed or not.
>
> For example I added ojdbc14.jar to Tomcat lib directory assuming that 
> it will consider it in classpath but until I specified the path of the 
> jar in classpath, the server wasn’t considering the jar.
>
> Please advise.
>
> -Original Message-
> From: Mounika Reddy [mailto:spidermai...@gmail.com]
> Sent: Monday, January 18, 2021 6:32 PM
> To: Tomcat Users List
> Subject: Re: Jars in Tomcat lib directory
>
> CAUTION:   This email originated from outside the organization. Do not
> click links or open attachments unless you recognize the sender and 
> know the content is safe.
>
> It will provided if your application requires.
>
> On Mon, Jan 18, 2021, 7:54 AM Jonnalagadda, Swathi (External) < 
> swathi.jonnalaga...@xerox.com> wrote:
>
> > Hi
> >
> > Doesn’t tomcat consider jar files under lib directory in classpath. 
> > Do we have to do any additional configuration for that?
> >
> >
> > Thanks
> > Swathi
> >
>

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



Re: Reg: Jars under web-inf lib being accessed by tomcat even when the application is not running.

2021-01-18 Thread Mark Thomas
On 18/01/2021 16:13, Jalaj Asher wrote:
> We have a situation where in we are seeing with tomcat 8.5 and higher that 
> even when the application is not in use , tomcat is accessing different jars 
> in that  web-inf/ lib folder every few seconds or few minutes.
> 
> These jars are not getting loaded in memory , we profiled it to check if they 
> were getting loaded in the heap or the metaspace area but that was not the 
> case.

Try using the profiler to trace method calls. Looking at calls that
involve File and/or FileInputStream should point you in the right direction.

A clean Tomcat install won't behave in the way you describe.

Mark


> 
> When I ran the lsof command though I could see that multiple jars were being 
> accessed (read) from that folder very frequently, with no application usage.
> 
> Any reason or any setting that you are aware off that could be causing this. 
> I did enable the all setting for localhost under logging properties as well 
> as the below option
> 
> org.apache.tomcat.util.http = ALL
> 
> 
> but none shows the files being accessed unless I run the LSOF command on 
> linux. I am not sure why is tomcat reading those files multiple times in a 
> minute.
> 
> Also wanted to see if there is a setting to switch off this behavior.
> 
> Regards
> 
> Jalaj
> 
> CONFIDENTIALITY NOTICE TO RECIPIENT: This transmission contains confidential 
> information belonging to the sender that is legally privileged and 
> proprietary and may be subject to protection under the law, including the 
> Health Insurance Portability and Accountability Act (HIPAA). If you are not 
> the intended recipient of this e-mail, you are prohibited from sharing, 
> copying, or otherwise using or disclosing its contents. If you have received 
> this e-mail in error, please notify the sender immediately by reply e-mail 
> and permanently delete this e-mail and any attachments without reading, 
> forwarding or saving them. Thank you.
> 


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



Re: Jars in Tomcat lib directory

2021-01-18 Thread Mounika Reddy
It means your tomcat setup is screwed up. You can actually package in your
application as a dependency and see if it picks up. If not, then post the
logs here to understand what's going on

On Mon, Jan 18, 2021, 1:09 PM Jonnalagadda, Swathi (External) <
swathi.jonnalaga...@xerox.com> wrote:

> I am not sure if I am missing some configuration setting but what I see is
> unless I add externally added jars under tomcat/lib to classpath I don’t
> see them considerd by Tomcat irrespective of wether they are needed or not.
>
> For example I added ojdbc14.jar to Tomcat lib directory assuming that it
> will consider it in classpath but until I specified the path of the jar in
> classpath, the server wasn’t considering the jar.
>
> Please advise.
>
> -Original Message-
> From: Mounika Reddy [mailto:spidermai...@gmail.com]
> Sent: Monday, January 18, 2021 6:32 PM
> To: Tomcat Users List
> Subject: Re: Jars in Tomcat lib directory
>
> CAUTION:   This email originated from outside the organization. Do not
> click links or open attachments unless you recognize the sender and know
> the content is safe.
>
> It will provided if your application requires.
>
> On Mon, Jan 18, 2021, 7:54 AM Jonnalagadda, Swathi (External) <
> swathi.jonnalaga...@xerox.com> wrote:
>
> > Hi
> >
> > Doesn’t tomcat consider jar files under lib directory in classpath. Do
> > we have to do any additional configuration for that?
> >
> >
> > Thanks
> > Swathi
> >
>


RE: Jars in Tomcat lib directory

2021-01-18 Thread Jonnalagadda, Swathi (External)
I am not sure if I am missing some configuration setting but what I see is 
unless I add externally added jars under tomcat/lib to classpath I don’t see 
them considerd by Tomcat irrespective of wether they are needed or not. 

For example I added ojdbc14.jar to Tomcat lib directory assuming that it will 
consider it in classpath but until I specified the path of the jar in 
classpath, the server wasn’t considering the jar. 

Please advise.

-Original Message-
From: Mounika Reddy [mailto:spidermai...@gmail.com] 
Sent: Monday, January 18, 2021 6:32 PM
To: Tomcat Users List
Subject: Re: Jars in Tomcat lib directory

CAUTION:   This email originated from outside the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.

It will provided if your application requires.

On Mon, Jan 18, 2021, 7:54 AM Jonnalagadda, Swathi (External) < 
swathi.jonnalaga...@xerox.com> wrote:

> Hi
>
> Doesn’t tomcat consider jar files under lib directory in classpath. Do 
> we have to do any additional configuration for that?
>
>
> Thanks
> Swathi
>


Reg: Jars under web-inf lib being accessed by tomcat even when the application is not running.

2021-01-18 Thread Jalaj Asher
We have a situation where in we are seeing with tomcat 8.5 and higher that even 
when the application is not in use , tomcat is accessing different jars in that 
 web-inf/ lib folder every few seconds or few minutes.

These jars are not getting loaded in memory , we profiled it to check if they 
were getting loaded in the heap or the metaspace area but that was not the case.

When I ran the lsof command though I could see that multiple jars were being 
accessed (read) from that folder very frequently, with no application usage.

Any reason or any setting that you are aware off that could be causing this. I 
did enable the all setting for localhost under logging properties as well as 
the below option

org.apache.tomcat.util.http = ALL


but none shows the files being accessed unless I run the LSOF command on linux. 
I am not sure why is tomcat reading those files multiple times in a minute.

Also wanted to see if there is a setting to switch off this behavior.

Regards

Jalaj

CONFIDENTIALITY NOTICE TO RECIPIENT: This transmission contains confidential 
information belonging to the sender that is legally privileged and proprietary 
and may be subject to protection under the law, including the Health Insurance 
Portability and Accountability Act (HIPAA). If you are not the intended 
recipient of this e-mail, you are prohibited from sharing, copying, or 
otherwise using or disclosing its contents. If you have received this e-mail in 
error, please notify the sender immediately by reply e-mail and permanently 
delete this e-mail and any attachments without reading, forwarding or saving 
them. Thank you.


Re: what is the exact order of filters?

2021-01-18 Thread Johan Compagner
> You need to read section 8.2.3 of the servlet specificaiton
>
> 
> If the order in which the listeners, servlets, filters are invoked is
> important to an application then a deployment descriptor must be used.
> Also, if necessary, the ordering element defined above can be used. As
> described above, when using annotations to define the listeners,
> servlets and filters, the order in which they are invoked is unspecified.
> 
>
> Entries in the global web.xml files will be added after those from the
> application web.xml
>
>
yes thats what i was testing also
But where are then annotations coming in?
I can't find that.
And i mean together with a web.xml in conf and a web.xml in web-inf where
there are also definitions of filters and mappings..

It seems to me that it is:

WEB-INF/web.xml (these do have order between them)
annotations (unordered)
conf/web.xml (these do have order between them)

or is that just an tomcat implementation? that other containers don't
really have to follow?


Extensibility of LegacyCookieProcessor?

2021-01-18 Thread Polina Georgieva
Hello,



On our Tomcat 8 we are currently using
org.apache.tomcat.util.http.LegacyCookieProcessor and we need to override
its method generateHeader(Cookie cookie, HttpServletRequest request) to
handle sameSite cookie attribute in a custom way. However the
LegacyCookieProcessor class is final (not extensible).



So would you please consider making LegacyCookieProcessor class extensible
just like the other available cookie processor -
org.apache.tomcat.util.http.Rfc6265CookieProcessor?



Thanks and regards,

Polina


Re: Jars in Tomcat lib directory

2021-01-18 Thread Mounika Reddy
It will provided if your application requires.

On Mon, Jan 18, 2021, 7:54 AM Jonnalagadda, Swathi (External) <
swathi.jonnalaga...@xerox.com> wrote:

> Hi
>
> Doesn’t tomcat consider jar files under lib directory in classpath. Do we
> have to do any additional configuration for that?
>
>
> Thanks
> Swathi
>


Jars in Tomcat lib directory

2021-01-18 Thread Jonnalagadda, Swathi (External)
Hi 

Doesn’t tomcat consider jar files under lib directory in classpath. Do we have 
to do any additional configuration for that?


Thanks
Swathi


Re: TomCat 9 service failed to start on Windows after TomCat 9 update

2021-01-18 Thread Mark Thomas
On 18/01/2021 04:40, Igor Sluge wrote:
> 
> Hello,
> Thanks for your answer. Do you know is anyway to specify «Local System» user 
> for «tomcat9.exe" //IS//» command 
> via cmd? 

--ServiceUser "LocalSystem"

should do it.

Mark


>> Пятница, 15 января 2021, 16:34 +03:00 от Robert Turner 
>> :
>>  
>> I would check permissions on the folders/files. The account running the 
>> windows service may not have permissions to execute the programs or maybe 
>> access the directories. That's the first thing I would check. (Also check 
>> Event Viewer for any related messages).  
>> On Fri, Jan 15, 2021 at 8:24 AM Igor Sluge < sl...@mail.ru.invalid > wrote:
>>   
>>>  
>>> Hello,
>>> I updated TomCat for my app to the latest TomCat 9.0.41 and after update 
>>> TomCat service failed to start successfully as Windows service. I just see 
>>> 404 error when trying to open the TomCat app. Also there are no logs at all 
>>> in the log directory! If I start TomCat locally by the command   
>>> tomcat9.exe" //TS//MyApp   it started successfully.
>>> OS: Windows 7 and Server 2012
>>> Does anybody have any ideas of how to troubleshoot this issue?
>>>  
>>>   
>  
>  
> Bye, Igor
>  
> 


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



RE: Tomcat server not considering Mime Type - Request urgent help!!

2021-01-18 Thread Jonnalagadda, Swathi (External)

Hi Schultz

Please find sample code below
Suffix is there in request so ..

RequestDispatcher rd = context.getRequestDispatcher(sample.xls);
String contentType =((request.getParameter(SUFFIX) 
!=null) && ((request.getParameter(SUFFIX).equalsIgnoreCase("xls" 
?"application/vnd.ms-excel":null; <--- setting explicitly
if (contentType != null)
{
response.setContentType(contentType);
}
rd.forward(request, response);

Thanks
Swathi

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Friday, January 15, 2021 7:41 PM
To: users@tomcat.apache.org
Subject: Re: Tomcat server not considering Mime Type - Request urgent help!!

CAUTION:   This email originated from outside the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.

Swathi,

On 1/15/21 08:41, Jonnalagadda, Swathi (External) wrote:
> My web application is trying to open the xls file by passing the file 
> to request.getDispatcher method. It is supposed open up download 
> dialogue box but it is not doing.
After you get a request dispatcher, what are you doing with it?

> If I set the content-type explicitly to response it is showing up the box.

Please post actual code.

> With Tomcat 7 it was never an issue and it used to consider mimetype 
> that is defined in web.xml but in Tomcat 9 not sure why it is not 
> considering mime-type.

Something seems odd, here. Post your sample code.

-chris

> -Original Message-
> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> Sent: Friday, January 15, 2021 3:25 AM
> To: users@tomcat.apache.org
> Subject: Re: Tomcat server not considering Mime Type - Request urgent help!!
> 
> CAUTION:   This email originated from outside the organization. Do not click 
> links or open attachments unless you recognize the sender and know the 
> content is safe.
> 
> Swathi,
> 
> On 1/13/21 03:27, Jonnalagadda, Swathi (External) wrote:
>> We could see that when we try to open the xls file separately the 
>> browser shows dialogue box to save it so it is nothing to do with 
>> browser settings
> What is the difference between "open[ing] the XLS file separately" and ... 
> whatever your application is doing instead?
> 
> If you want to force a download, you need to add some response headers 
> otherwise a normal browser will usually try to render the file in the browser 
> window instead of initiating a download.
> 
> The response header you need is "Content-Disposition" and its value can be 
> complex. Here is what I usually do:
> 
> Content-Disposition: attachment; filename="[filename]"; 
> filename*=utf-8''[filename in UTF-8 encoding]
> 
> Note that the above is all on one line and the two single-quotes are not a 
> typo. You will also need to escape any double-quotes in the "filename"
> and escape any semicolons in the utf8-filename.
> 
> You can find more information here as well as other places online:
> https://www.geeksforgeeks.org/http-headers-content-disposition/
> 
> The above reference happens to be particularly thorough, even moreso than 
> Mozilla's (typically very good and complete) documentation for 
> Content-Disposition.
> 
> If your application is not being hosted within a web browser (e.g. it's a 
> mobile application, or an Electron (etc.) application, etc.) then it's 
> entirely up to you to trigger the display of a download dialog when this kind 
> of thing needs to happen.
> 
> -chris
> 
>> -Original Message-
>> From: Mounika Reddy [mailto:spidermai...@gmail.com]
>> Sent: Wednesday, January 13, 2021 3:48 AM
>> To: Tomcat Users List
>> Cc: Mark Thomas
>> Subject: Re: Tomcat server not considering Mime Type - Request urgent help!!
>>
>> CAUTION:   This email originated from outside the organization. Do not click 
>> links or open attachments unless you recognize the sender and know the 
>> content is safe.
>>
>> Pls check http response headers for the request to confirm if it's returning 
>> proper headers.
>>
>> Once they are in place then it may be to do with browser settings not 
>> processing headers.
>>
>>
>>
>> On Tue, Jan 12, 2021, 2:48 PM Jonnalagadda, Swathi (External) < 
>> swathi.jonnalaga...@xerox.com> wrote:
>>
>>> Hi Team
>>>
>>> We have an application deployed in tomcat9.0.38 server which 
>>> generates an xls file dynamically and saves at server end. When we 
>>> try to access the file using application frontend, it is neither 
>>> showing up in excel format nor showing up pop up to save the file 
>>> instead it is showing the content of xls file in xml format directly on the 
>>> browser.
>>>
>>> Below mime type is set both at web.xml of webapplicatio end and as 
>>> well as Tomcat9038/conf/web.xml
>>>
>>> 
>>>   xls
>>>   application/vnd.ms-excel
>>>   
>>>
>>> Could you please help in resolving