Re: Configuring embedded Tomcat with @WebServlet annotations

2019-03-09 Thread Mark Thomas
On 09/03/2019 20:00, Raffaele Sgarro wrote: > I apologize for the tone. > > Already tried various StandardJarScanner options, but the root problem is > that nothing works while developing because classes from source Java files > are not packaged at all and are simply put on the classpath by the

Re: Configuring embedded Tomcat with @WebServlet annotations

2019-03-09 Thread Raffaele Sgarro
I apologize for the tone. Already tried various StandardJarScanner options, but the root problem is that nothing works while developing because classes from source Java files are not packaged at all and are simply put on the classpath by the IDE (and I do not want to add the directory used by the

Re: Configuring embedded Tomcat with @WebServlet annotations

2019-03-09 Thread Mark Thomas
On 08/03/2019 17:47, Raffaele Sgarro wrote: > Hello all! How is one supposed to configure Tomcat (I'm on 9.x) to scan a > given package looking for @WebServlet servlets? > > I cannot find any API and relevant examples in the Tomcat source. > > More insight: my app is currently packaged as a WAR

Re: Configuring embedded Tomcat with @WebServlet annotations

2019-03-09 Thread Mark Thomas
On 09/03/2019 15:01, Raffaele Sgarro wrote: > I wonder why you think I didn't read the fucking manual before posting my > question here. While the reply to your question wasn't helpful, that does not justify the tone of your response. I'd like to remind everyone of the code of conduct:

Re: Configuring embedded Tomcat with @WebServlet annotations

2019-03-09 Thread Raffaele Sgarro
I wonder why you think I didn't read the fucking manual before posting my question here. You'd be surprised to know that I'm studying this thing since a couple of days and my conclusion is that it's something Tomcat can't do and I'll have to use something like Spring to achieve it. So no, it's

Re: Configuring embedded Tomcat with @WebServlet annotations

2019-03-09 Thread Phumelela Mdluli
Hey, Try reading this, I think you will be fine: http://tomcat.apache.org/tomcat-9.0-doc/index.html No one can do it for you. Regards, Phumelela On Fri, Mar 8, 2019 at 7:47 PM Raffaele Sgarro wrote: > > Hello all! How is one supposed to configure Tomcat (I'm on 9.x) to scan a > given

Configuring embedded Tomcat with @WebServlet annotations

2019-03-08 Thread Raffaele Sgarro
Hello all! How is one supposed to configure Tomcat (I'm on 9.x) to scan a given package looking for @WebServlet servlets? I cannot find any API and relevant examples in the Tomcat source. More insight: my app is currently packaged as a WAR and deployed to a running Tomcat instance. I want to

Re: Configuring Embedded Tomcat for SSL

2013-11-01 Thread Violeta Georgieva
2013/11/1 Matthew Westwood-Hill matthew.westwood-h...@nuix.com Tomcat version: 7.0.47 OS: Windows 7 (x64) JDK: 1.7 I am attempting to start an embedded instance of Tomcat, which is configured for SSL only, on port 443. The code I am using is as follows: *public* *static*

Configuring Embedded Tomcat for SSL

2013-10-31 Thread Matthew Westwood-Hill
Tomcat version: 7.0.47 OS: Windows 7 (x64) JDK: 1.7 I am attempting to start an embedded instance of Tomcat, which is configured for SSL only, on port 443. The code I am using is as follows: *public* *static* *void* *main*(String[] args) *throws*UnknownHostException,

Configuring embedded tomcat using server.xml

2012-01-27 Thread Pradeep Fernando
Hi, I have embedded the tomcat server within my application. Right now i'm using the org.apache.catalina.startup.Tomcat.java class to start my server. However I would like to get more control over Engine creation, connector initialization, etc. My idea is to configure the tomcat instance by

Re: Configuring embedded tomcat using server.xml

2012-01-27 Thread Mikolaj Rydzewski
On Fri, 27 Jan 2012 13:35:45 +0530, Pradeep Fernando wrote: I have embedded the tomcat server within my application. Right now i'm using the org.apache.catalina.startup.Tomcat.java class to start my server. However I would like to get more control over Engine creation, connector

Re: Configuring embedded tomcat using server.xml

2012-01-27 Thread Pid *
On 27 Jan 2012, at 08:06, Pradeep Fernando pradee...@gmail.com wrote: Hi, I have embedded the tomcat server within my application. Right now i'm using the org.apache.catalina.startup.Tomcat.java class to start my server. However I would like to get more control over Engine creation,

Re: Configuring embedded tomcat using server.xml

2012-01-27 Thread Pradeep Fernando
On Fri, Jan 27, 2012 at 2:29 PM, Pid * p...@pidster.com wrote: On 27 Jan 2012, at 08:06, Pradeep Fernando pradee...@gmail.com wrote: Hi, I have embedded the tomcat server within my application. Right now i'm using the org.apache.catalina.startup.Tomcat.java class to start my server.

Re: Configuring Embedded Tomcat

2011-01-10 Thread Christopher Gross
It is specified there -- but I don't have a server.xml file set up. Since I'm using the embedded version, I set up the tomcat on the fly and just have the java code start it. I looked at the server.xml file that comes with the standard tomcat installation, and I see the the UserDatabaseRealm

Re: Configuring Embedded Tomcat

2011-01-10 Thread Pid
On 1/10/11 2:28 PM, Christopher Gross wrote: It is specified there -- but I don't have a server.xml file set up. Since I'm using the embedded version, I set up the tomcat on the fly and just have the java code start it. What's stopping you from programmatically creating the Realm and adding

Re: Configuring Embedded Tomcat

2011-01-10 Thread Christopher Gross
The Realm class is read only (according to the API). There isn't a way for me to set the path to the tomcat-users.xml file (or anything else for that matter). I'm not seeing a function in the Engine/Embedded/Context object to have it load the tomcat-users.xml file either (though the context does

Re: Configuring Embedded Tomcat

2011-01-10 Thread Pid
On 1/10/11 5:33 PM, Christopher Gross wrote: The Realm class is read only (according to the API). There isn't a way for me to set the path to the tomcat-users.xml file (or anything else for that matter). I'm not seeing a function in the Engine/Embedded/Context object to have it load the

Re: Configuring Embedded Tomcat

2011-01-10 Thread Christopher Gross
I created a MemoryRealm object, pointed it to my tomcat-users.xml file, added that realm to the embedded (no luck) and to the specific context (no luck either). For both, it just plain loads the page -- doesn't ask me to do any type of logging in. Are you just using your own experience to help

Re: Configuring Embedded Tomcat

2011-01-10 Thread Mark Thomas
On 10/01/2011 18:16, Christopher Gross wrote: I created a MemoryRealm object, pointed it to my tomcat-users.xml file, added that realm to the embedded (no luck) and to the specific context (no luck either). For both, it just plain loads the page -- doesn't ask me to do any type of logging in.

Re: Configuring Embedded Tomcat

2011-01-10 Thread Christopher Gross
I added the security role: MemoryRealm mr = new MemoryRealm(); mr.setPathname(path + /conf/tomcat-users.xml); Context sp = embedded.createContext(/Monitor, path + /webapps/monitor); sp.setRealm(mr); sp.addSecurityRole(admin); host.addChild(sp); Is

Re: Configuring Embedded Tomcat

2011-01-10 Thread Mark Thomas
On 10/01/2011 18:43, Christopher Gross wrote: I added the security role: MemoryRealm mr = new MemoryRealm(); mr.setPathname(path + /conf/tomcat-users.xml); Context sp = embedded.createContext(/Monitor, path + /webapps/monitor); sp.setRealm(mr);

Re: Configuring Embedded Tomcat

2011-01-10 Thread Christopher Gross
Borrowing from another web.xml (solr's), I added this to my web.xml: resource-env-ref description Link to the UserDatabase instance from which we request lists of defined role names. Typically, this will be connected to the global user database with a ResourceLink element

Re: Configuring Embedded Tomcat

2011-01-10 Thread Pid
On 1/10/11 6:58 PM, Christopher Gross wrote: Borrowing from another web.xml (solr's), I added this to my web.xml: resource-env-ref description Link to the UserDatabase instance from which we request lists of defined role names. Typically, this will be connected to the

Re: Configuring Embedded Tomcat

2011-01-10 Thread Christopher Gross
That did it! Thanks Mark Pid. Now to make it more complicated -- in order to have another page without that restriction, would I need to make a whole new webapp, or can I turn down the security for a specific page? Thanks! -- Chris On Mon, Jan 10, 2011 at 2:18 PM, Pid p...@pidster.com

Re: Configuring Embedded Tomcat

2011-01-10 Thread Christopher Gross
I figured it out -- I just needed to put the one application that I wanted to be secure in the security-constraint section, then let the other ones not require authentication. -- Chris On Mon, Jan 10, 2011 at 2:41 PM, Christopher Gross cogr...@gmail.comwrote: That did it! Thanks Mark Pid.

Configuring Embedded Tomcat

2011-01-07 Thread Christopher Gross
I've been looking around, but I can't seem to find somewhere that shows how you can configure Tomcat when you embed it into an application. My code is like this: public void start() throws Exception { String hostname = System.getProperty(hostname); int port =

Re: Configuring Embedded Tomcat

2011-01-07 Thread Pid
On 1/7/11 6:59 PM, Christopher Gross wrote: I've been looking around, but I can't seem to find somewhere that shows how you can configure Tomcat when you embed it into an application. My code is like this: public void start() throws Exception { String hostname =

Re: Configuring Embedded Tomcat

2011-01-07 Thread Christopher Gross
OK, so I'd need to add a Realm for the UserDatabaseRealm in either of the spots you listed. I'll probably use the file, so that I can adjust it if need be. Where do I put the tomcat-users.xml file, so that the Realm has users/passwords? Is there a way for me to tell the Embedded object where it

Re: Configuring Embedded Tomcat

2011-01-07 Thread Pid
On 1/7/11 9:07 PM, Christopher Gross wrote: OK, so I'd need to add a Realm for the UserDatabaseRealm in either of the spots you listed. I'll probably use the file, so that I can adjust it if need be. Where do I put the tomcat-users.xml file, so that the Realm has users/passwords? Is there