archive-es.com » ES » E » EPPA.ES

Total: 100

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Apache Tomcat 7 (7.0.22) - JNDI Resources HOW-TO
    totally insulated from changes in the email server configuration environment it simply asks for and receives a preconfigured session whenever needed The steps required for this are outlined below 1 Declare Your Resource Requirements The first thing you should do is modify the web application deployment descriptor WEB INF web xml to declare the JNDI name under which you will look up preconfigured sessions By convention all such names should resolve to the mail subcontext relative to the standard java comp env naming context that is the root of all provided resource factories A typical web xml entry might look like this resource ref description Resource reference to a factory for javax mail Session instances that may be used for sending electronic mail messages preconfigured to connect to the appropriate SMTP server description res ref name mail Session res ref name res type javax mail Session res type res auth Container res auth resource ref WARNING Be sure you respect the element ordering that is required by the DTD for web application deployment descriptors See the Servlet Specification for details 2 Code Your Application s Use Of This Resource A typical use of this resource reference might look like this Context initCtx new InitialContext Context envCtx Context initCtx lookup java comp env Session session Session envCtx lookup mail Session Message message new MimeMessage session message setFrom new InternetAddress request getParameter from InternetAddress to new InternetAddress 1 to 0 new InternetAddress request getParameter to message setRecipients Message RecipientType TO to message setSubject request getParameter subject message setContent request getParameter content text plain Transport send message Note that the application uses the same resource reference name that was declared in the web application deployment descriptor This is matched up against the resource factory that is configured in the Context element for the web application as described below 3 Configure Tomcat s Resource Factory To configure Tomcat s resource factory add an elements like this to the Context element for this web application Context Resource name mail Session auth Container type javax mail Session mail smtp host localhost Context Note that the resource name here mail Session must match the value specified in the web application deployment descriptor Customize the value of the mail smtp host parameter to point at the server that provides SMTP service for your network Additional resource attributes and values will be converted to properties and values and passed to javax mail Session getInstance java util Properties as part of the java util Properties collection In addition to the properties defined in Annex A of the JavaMail specification individual providers may also support additional properties like password 4 Install the JavaMail libraries Download the JavaMail API Unpackage the distribution and place mail jar into CATALINA HOME lib so that it is available to Tomcat during the initialization of the mail Session Resource Note placing this jar in both CATALINA HOME lib and a web application s lib folder will cause an error so ensure you have it in the CATALINA HOME lib location only 5 Restart Tomcat For the additional JAR to be visible to Tomcat it is necessary for the Tomcat instance to be restarted Example Application The examples application included with Tomcat contains an example of utilizing this resource factory It is accessed via the JSP Examples link The source code for the servlet that actually sends the mail message is in WEB INF classes SendMailServlet java WARNING The default configuration assumes that there is an SMTP server listing on port 25 on localhost If this is not the case edit the Context element for this web application and modify the parameter value for the mail smtp host parameter to be the host name of an SMTP server on your network JDBC Data Sources 0 Introduction Many web applications need to access a database via a JDBC driver to support the functionality required by that application The Java EE Platform Specification requires Java EE Application Servers to make available a DataSource implementation that is a connection pool for JDBC connections for this purpose Tomcat offers exactly the same support so that database based applications you develop on Tomcat using this service will run unchanged on any Java EE server For information about JDBC you should consult the following http java sun com products jdbc Home page for information about Java Database Connectivity http java sun com j2se 1 3 docs guide jdbc spec2 jdbc2 1 frame html The JDBC 2 1 API Specification http java sun com products jdbc jdbc20 stdext pdf The JDBC 2 0 Standard Extension API including the javax sql DataSource API This package is now known as the JDBC Optional Package http java sun com j2ee download html The Java EE Platform Specification covers the JDBC facilities that all Java EE platforms must provide to applications NOTE The default data source support in Tomcat is based on the DBCP connection pool from the Commons project However it is possible to use any other connection pool that implements javax sql DataSource by writing your own custom resource factory as described below 1 Install Your JDBC Driver Use of the JDBC Data Sources JNDI Resource Factory requires that you make an appropriate JDBC driver available to both Tomcat internal classes and to your web application This is most easily accomplished by installing the driver s JAR file s into the CATALINA HOME lib directory which makes the driver available both to the resource factory and to your application 2 Declare Your Resource Requirements Next modify the web application deployment descriptor WEB INF web xml to declare the JNDI name under which you will look up preconfigured data source By convention all such names should resolve to the jdbc subcontext relative to the standard java comp env naming context that is the root of all provided resource factories A typical web xml entry might look like this resource ref description Resource reference to a factory for java sql Connection instances that may be used for talking

    Original URL path: http://ticket.eppa.es/docs/jndi-resources-howto.html (2015-09-25)
    Open archived version from archive


  • Apache Tomcat 7 (7.0.22) - Class Loader HOW-TO
    are visible to both Tomcat internal classes and to web applications However the standard Tomcat startup scripts CATALINA HOME bin catalina sh or CATALINA HOME bin catalina bat totally ignore the contents of the CLASSPATH environment variable itself and instead build the System class loader from the following repositories CATALINA HOME bin bootstrap jar Contains the main method that is used to initialize the Tomcat server and the class loader implementation classes it depends on CATALINA BASE bin tomcat juli jar or CATALINA HOME bin tomcat juli jar Logging implementation classes These include enhancement classes to java util logging API known as Tomcat JULI and a package renamed copy of Apache Commons Logging library used internally by Tomcat See logging documentation for more details If tomcat juli jar is present in CATALINA BASE bin it is used instead of the one in CATALINA HOME bin It is useful in certain logging configurations CATALINA HOME bin commons daemon jar The classes from Apache Commons Daemon project This JAR file is not present in the CLASSPATH built by catalina bat sh scripts but is referenced from the manifest file of bootstrap jar Common This class loader contains additional classes that are made visible to both Tomcat internal classes and to all web applications Normally application classes should NOT be placed here The locations searched by this class loader are defined by the common loader property in CATALINA BASE conf catalina properties The default setting will search the following locations in the order they are listed unpacked classes and resources in CATALINA BASE lib JAR files in CATALINA BASE lib unpacked classes and resources in CATALINA HOME lib JAR files in CATALINA HOME lib By default this includes the following annotations api jar JavaEE annotations classes catalina jar Implementation of the Catalina servlet container portion of Tomcat catalina ant jar Tomcat Catalina Ant tasks catalina ha jar High availability package catalina tribes jar Group communication package ecj jar Eclipse JDT Java compiler el api jar EL 2 2 API jasper jar Tomcat Jasper JSP Compiler and Runtime jasper el jar Tomcat Jasper EL implementation jsp api jar JSP 2 2 API servlet api jar Servlet 3 0 API tomcat api jar Several interfaces defined by Tomcat tomcat coyote jar Tomcat connectors and utility classes tomcat dbcp jar Database connection pool implementation based on package renamed copy of Apache Commons Pool and Apache Commons DBCP tomcat i18n jar Optional JARs containing resource bundles for other languages As default bundles are also included in each individual JAR they can be safely removed if no internationalization of messages is needed tomcat jdbc jar An alternative database connection pool implementation known as Tomcat JDBC pool See documentation for more details tomcat util jar Common classes used by various components of Apache Tomcat WebappX A class loader is created for each web application that is deployed in a single Tomcat instance All unpacked classes and resources in the WEB INF classes directory of your web application plus classes

    Original URL path: http://ticket.eppa.es/docs/class-loader-howto.html (2015-09-25)
    Open archived version from archive

  • Apache Tomcat 7 (7.0.22) - Jasper 2 JSP Engine How To
    page compiles so they are performed in a separate JVM from Tomcat true or false default true genStringAsCharArray Should text strings be generated as char arrays to improve performance in some cases Default false ieClassId The class id value to be sent to Internet Explorer when using jsp plugin tags Default clsid 8AD9C840 044E 11D1 B3E9 00805F499D93 javaEncoding Java file encoding to use for generating java source files Default UTF8 keepgenerated Should we keep the generated Java source code for each page instead of deleting it true or false default true mappedfile Should we generate static content with one print statement per input line to ease debugging true or false default true maxLoadedJsps The maximum number of JSPs that will be loaded for a web application If more than this number of JSPs are loaded the least recently used JSPs will be unloaded so that the number of JSPs loaded at any one time does not exceed this limit A value of zero or less indicates no limit Default 1 jspIdleTimeout The amount of time in seconds a JSP can be idle before it is unloaded A value of zero or less indicates never unload Default 1 modificationTestInterval Causes a JSP and its dependent files to not be checked for modification during the specified time interval in seconds from the last time the JSP was checked for modification A value of 0 will cause the JSP to be checked on every access Used in development mode only Default is 4 seconds recompileOnFail If a JSP compilation fails should the modificationTestInterval be ignored and the next access trigger a re compilation attempt Used in development mode only and is disabled by default as compilation may be expensive and could lead to excessive resource usage scratchdir What scratch directory should we use when compiling JSP pages Default is the work directory for the current web application suppressSmap Should the generation of SMAP info for JSR45 debugging be suppressed true or false default false trimSpaces Should white spaces in template text between actions or directives be trimmed default false xpoweredBy Determines whether X Powered By response header is added by generated servlet true or false default false The Java compiler from Eclipse JDT in included as the default compiler It is an advanced Java compiler which will load all dependencies from the Tomcat class loader which will help tremendously when compiling on large installations with tens of JARs On fast servers this will allow sub second recompilation cycles for even large JSP pages Apache Ant which was used in previous Tomcat releases can be used instead of the new compiler by simply removing the lib ecj jar file and placing the ant jar and ant launcher jar files from the latest Ant distribution in the lib folder Known issues As described in bug 39089 a known JVM issue bug 6294277 may cause a java lang InternalError name is too long to represent exception when compiling very large JSPs If this is observed then

    Original URL path: http://ticket.eppa.es/docs/jasper-howto.html (2015-09-25)
    Open archived version from archive

  • Apache Tomcat 7 (7.0.22) - SSL Configuration HOW-TO
    s standard Java KeyStore format and is the format created by the keytool command line utility This tool is included in the JDK The PKCS12 format is an internet standard and can be manipulated via among other things OpenSSL and Microsoft s Key Manager Each entry in a keystore is identified by an alias string Whilst many keystore implementations treat aliases in a case insensitive manner case sensitive implementations are available The PKCS11 specification for example requires that aliases are case sensitive To avoid issues related to the case sensitivity of aliases it is not recommended to use aliases that differ only in case To import an existing certificate into a JKS keystore please read the documentation in your JDK documentation package about keytool Note that OpenSSL often adds readable comments before the key keytool does not support that so remove the OpenSSL comments if they exist before importing the key using keytool To import an existing certificate signed by your own CA into a PKCS12 keystore using OpenSSL you would execute a command like openssl pkcs12 export in mycert crt inkey mykey key out mycert p12 name tomcat CAfile myCA crt caname root chain For more advanced cases consult the OpenSSL documentation To create a new keystore from scratch containing a single self signed Certificate execute the following from a terminal command line Windows JAVA HOME bin keytool genkey alias tomcat keyalg RSA Unix JAVA HOME bin keytool genkey alias tomcat keyalg RSA The RSA algorithm should be preferred as a secure algorithm and this also ensures general compatibility with other servers and components This command will create a new file in the home directory of the user under which you run it named keystore To specify a different location or filename add the keystore parameter followed by the complete pathname to your keystore file to the keytool command shown above You will also need to reflect this new location in the server xml configuration file as described later For example Windows JAVA HOME bin keytool genkey alias tomcat keyalg RSA keystore path to my keystore Unix JAVA HOME bin keytool genkey alias tomcat keyalg RSA keystore path to my keystore After executing this command you will first be prompted for the keystore password The default password used by Tomcat is changeit all lower case although you can specify a custom password if you like You will also need to specify the custom password in the server xml configuration file as described later Next you will be prompted for general information about this Certificate such as company contact name and so on This information will be displayed to users who attempt to access a secure page in your application so make sure that the information provided here matches what they will expect Finally you will be prompted for the key password which is the password specifically for this Certificate as opposed to any other Certificates stored in the same keystore file The keytool prompt will tell you that pressing the ENTER key automatically uses the same password for the key as the keystore You are free to use the same password or to select a custom one If you select a different password to the keystore password you will also need to specify the custom password in the server xml configuration file If everything was successful you now have a keystore file with a Certificate that can be used by your server Edit the Tomcat Configuration File Tomcat can use two different implementations of SSL the JSSE implementation provided as part of the Java runtime since 1 4 the APR implementation which uses the OpenSSL engine by default The exact configuration details depend on which implementation is being used The implementation used by Tomcat is chosen automatically unless it is overriden as described below If the installation uses APR i e you have installed the Tomcat native library then it will use the APR SSL implementation otherwise it will use the Java JSSE implementation To avoid auto configuration you can define which implementation to use by specifying a classname in the protocol attribute of the Connector To define a Java JSSE connector regardless of whether the APR library is loaded or not do Define a blocking Java SSL Coyote HTTP 1 1 Connector on port 8443 Connector protocol org apache coyote http11 Http11Protocol port 8443 Define a non blocking Java SSL Coyote HTTP 1 1 Connector on port 8443 Connector protocol org apache coyote http11 Http11NioProtocol port 8443 Alternatively to specify an APR connector the APR library must be available use Define a APR SSL Coyote HTTP 1 1 Connector on port 8443 Connector protocol org apache coyote http11 Http11AprProtocol port 8443 If you are using APR you have the option of configuring an alternative engine to OpenSSL Listener className org apache catalina core AprLifecycleListener SSLEngine someengine SSLRandomSeed somedevice The default value is Listener className org apache catalina core AprLifecycleListener SSLEngine on SSLRandomSeed builtin So to use SSL under APR make sure the SSLEngine attribute is set to something other than off The default value is on and if you specify another value it has to be a valid engine name If you haven t compiled in SSL support into your Tomcat Native library then you can turn this initialization off Listener className org apache catalina core AprLifecycleListener SSLEngine off SSLRandomSeed allows to specify a source of entropy Productive system needs a reliable source of entropy but entropy may need a lot of time to be collected therefore test systems could use no blocking entropy sources like dev urandom that will allow quicker starts of Tomcat The final step is to configure the Connector in the CATALINA BASE conf server xml file where CATALINA BASE represents the base directory for the Tomcat instance An example Connector element for an SSL connector is included in the default server xml file installed with Tomcat For JSSE it should look something like this Define a SSL Coyote HTTP 1 1 Connector on

    Original URL path: http://ticket.eppa.es/docs/ssl-howto.html (2015-09-25)
    Open archived version from archive

  • Apache Tomcat 7 (7.0.22) - SSI How To
    which are marked as privileged may use SSI features see the privileged property of the Context element Servlet Configuration There are several servlet init parameters which can be used to configure the behaviour of the SSI servlet buffered Should output from this servlet be buffered 0 false 1 true Default 0 false debug Debugging detail level for messages logged by this servlet Default 0 expires The number of seconds before a page with SSI directives will expire Default behaviour is for all SSI directives to be evaluated for every request isVirtualWebappRelative Should virtual SSI directive paths be interpreted as relative to the context root instead of the server root 0 false 1 true Default 0 false inputEncoding The encoding to be assumed for SSI resources if one cannot be determined from the resource itself Default is the default platform encoding outputEncoding The encoding to be used for the result of the SSI processing Default is UTF 8 allowExec Is the exec command enabled Default is false Filter Configuration There are several filter init parameters which can be used to configure the behaviour of the SSI filter contentType A regex pattern that must be matched before SSI processing is applied When crafting your own pattern don t forget that a mime content type may be followed by an optional character set in the form mime type charset set that you must take into account Default is text x server parsed html debug Debugging detail level for messages logged by this servlet Default 0 expires The number of seconds before a page with SSI directives will expire Default behaviour is for all SSI directives to be evaluated for every request isVirtualWebappRelative Should virtual SSI directive paths be interpreted as relative to the context root instead of the server root 0 false 1 true Default 0 false allowExec Is the exec command enabled Default is false Directives Server Side Includes are invoked by embedding SSI directives in an HTML document whose type will be processed by the SSI servlet The directives take the form of an HTML comment The directive is replaced by the results of interpreting it before sending the page to the client The general form of a directive is directive parm value The directives are config config timefmt B Y Used to set the format of dates and other items processed by SSI echo echo var VARIABLE NAME will be replaced by the value of the variable exec Used to run commands on the host system include include virtual file name inserts the contents flastmod flastmod file filename shtml Returns the time that a file was lost modified fsize fsize file filename shtml Returns the size of a file printenv printenv Returns the list of all the defined variables set set var foo value Bar is used to assign a value to a user defind variable if elif endif else Used to create conditional sections For example config timefmt A if expr DATE LOCAL Monday p Meeting at 10 00

    Original URL path: http://ticket.eppa.es/docs/ssi-howto.html (2015-09-25)
    Open archived version from archive

  • Apache Tomcat 7 (7.0.22) - CGI How To
    2 2 Javadocs EL 2 2 Javadocs JK 1 2 Documentation Apache Tomcat Development Building Changelog Status Developers Architecture Functional Specs CGI How To Table of Contents Introduction Installation Configuration Introduction The CGI Common Gateway Interface defines a way for a web server to interact with external content generating programs which are often referred to as CGI programs or CGI scripts Within Tomcat CGI support can be added when you are using Tomcat as your HTTP server and require CGI support Typically this is done during development when you don t want to run a web server like Apache httpd Tomcat s CGI support is largely compatible with Apache httpd s but there are some limitations e g only one cgi bin directory CGI support is implemented using the servlet class org apache catalina servlets CGIServlet Traditionally this servlet is mapped to the URL pattern cgi bin By default CGI support is disabled in Tomcat Installation CAUTION CGI scripts are used to execute programs external to the Tomcat JVM If you are using the Java SecurityManager this will bypass your security policy configuration in catalina policy Remove the XML comments from around the CGI servlet and servlet mapping configuration in CATALINA BASE conf web xml Only Contexts which are marked as privileged may use the CGI servlet see the privileged property of the Context element Configuration There are several servlet init parameters which can be used to configure the behaviour of the CGI servlet cgiPathPrefix The CGI search path will start at the web application root directory File separator this prefix The default cgiPathPrefix is WEB INF cgi debug Debugging detail level for messages logged by this servlet Default 0 executable The of the executable to be used to run the script You may explicitly set this parameter to be

    Original URL path: http://ticket.eppa.es/docs/cgi-howto.html (2015-09-25)
    Open archived version from archive

  • Apache Tomcat 7 (7.0.22) - Proxy Support HOW-TO
    these calls In particular you will generally want the port number to reflect that specified in the original request not the one on which the Connector itself is listening You can use the proxyName and proxyPort attributes on the Connector element to configure these values Proxy support can take many forms The following sections describe proxy configurations for several common cases Apache 1 3 Proxy Support Apache 1 3 supports an optional module mod proxy that configures the web server to act as a proxy server This can be used to forward requests for a particular web application to a Tomcat instance without having to configure a web connector such as mod jk To accomplish this you need to perform the following tasks Configure your copy of Apache so that it includes the mod proxy module If you are building from source the easiest way to do this is to include the enable module proxy directive on the configure command line If not already added for you make sure that you are loading the mod proxy module at Apache startup time by using the following directives in your httpd conf file LoadModule proxy module path to modules mod proxy so AddModule mod proxy c Include two directives in your httpd conf file for each web application that you wish to forward to Tomcat For example to forward an application at context path myapp ProxyPass myapp http localhost 8081 myapp ProxyPassReverse myapp http localhost 8081 myapp which tells Apache to forward URLs of the form http localhost myapp to the Tomcat connector listening on port 8081 Configure your copy of Tomcat to include a special Connector element with appropriate proxy settings for example Connector port 8081 proxyName www mycompany com proxyPort 80 which will cause servlets inside this web application to

    Original URL path: http://ticket.eppa.es/docs/proxy-howto.html (2015-09-25)
    Open archived version from archive

  • Apache Tomcat 7 (7.0.22) - MBean Descriptor How To
    Javadocs Servlet Javadocs JSP 2 2 Javadocs EL 2 2 Javadocs JK 1 2 Documentation Apache Tomcat Development Building Changelog Status Developers Architecture Functional Specs MBean Descriptor How To Table of Contents Introduction Adding MBean descriptions Introduction Tomcat uses JMX MBeans as the technology for implementing manageability of Tomcat The descriptions of JMX MBeans for Catalina are in the mbeans descriptor xml file in each package You will need to

    Original URL path: http://ticket.eppa.es/docs/mbeans-descriptor-howto.html (2015-09-25)
    Open archived version from archive