Is there a way to configure Jetty to scan WEB-INF/classes for web-fragment.xml files?
That configuration is required to run/debug Eclipse Web Module project.
Building JAR file is an expensive operation.
Related
I am using Oracle's ORDS 20.2 which has jetty/9.4.28.v20200408 embedded, APEX 20.1, Database 18c XE, Google Chrome Version 84.0.4147.135 (Official Build) (64-bit), opera Version:70.0.3728.106
and Windows 7 Ultimate.
In APEX there is a directory that has APEX's static files - CSS and Javascript files and image files. I need to enable gzip for that directory and tell the browser to cache it for at least 12 hours in order to improve performance for APEX development environment and my APEX applications according to Oracle's documentation here, https://docs.oracle.com/en/database/oracle/application-express/19.2/htmig/performance-optimization-tasks.html#GUID-668ED330-AFDC-4A43-AA11-D67FCCA58DA1
I've created a folder named "etc" under the "standalone" folder of my ORDS configuration directory. That's the folder where I should put any Jetty's Xml configuration files. Then created a file called "jetty.xml" with the following contents to implement what is in the Jetty's documentation about sending Cache-Control header,
https://www.eclipse.org/jetty/documentation/current/header-filter.html And
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure.dtd">
<filter>
<filter-name>HeaderFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.HeaderFilter</filter-class>
<init-param>
<param-name>headerConfig</param-name>
<param-value>
"add Cache-Control: max-age=43200"
</param-value>
<init-param>
<param-name>includedPaths</param-name>
<param-value>
"D:\ords\images"
</param-value>
</init-param>
</filter>
But when I run ORDS through a batch file which has
cd D:\Original\Oracle_ORDS_Editions\ords-20.2.0.178.1804
d:
java -jar ords.war standalone
the cmd window opens then vanishes automatically.
I need to know why the code fails and still need to enable gzip for that directory. Thank you.
The HeaderFilter is for use with webapps that are traditionally deployed via a webapp archive (WAR file).
The documented configuration for HeaderFilter is for the war internal WEB-INF/web.xml servlet descriptor that is specific to the webapp being deployed (typically found within a WAR file).
Arbitrarily creating etc directories and jetty.xml files are never a relevant form of configuration for Jetty.
The etc directory and the jetty.xml concepts are only relevant if you are using the standalone Jetty techniques (such as what's seen in jetty-home or the older jetty-distribution archives). More specifically, the start.jar within the jetty-home archive is the only one that looks for and uses either the etc directory or the jetty.xml file.
The jetty.xml, that the start.jar is aware, of is never managed by manually creating it or editing it. In fact it's a typically a read-only file that comes with the jetty-home archive, and is used in-place. The etc directory is found within the jetty-home archive, and can also be seen in the application specific configuration of Jetty standalone known as the ${jetty.base} directory.
You mentioned "jetty/9.4.28.v20200408 embedded" which typically means it's not using the standalone Jetty concepts. In an embedded Jetty scenario, the configuration of the Jetty server is typically done within the configuration techniques of the parent project (Oracle ORDS in your case). You'll need to know how that Jetty server is configured, and work within the limits of whatever configuration that parent project provides to you.
I want to manage kinesis shards automatically so I want to deploy KinesisAutoscaling.war on Tomcat. I found steps(https://github.com/awslabs/amazon-kinesis-scaling-utils) to deploy at Elastic Beanstalk.
Similar way I want step by step solution to deploy on Tomcat.
I was able to slow this problem using below steps.
Downlaod the code from here.
Open the project as Maven project in eclipse
Change the stream configuration in the configuration.json and provide the path of configuration in AutoscalingController.java like below
String configPath = "C:\
amazon-kinesis-scaling-utils-master\conf\configuration.json";
Build the project and place .jar file to the webapps folder of tomcat and start tomcat.
I have created a test framework for testing .jsp files and .tag files using embedded jetty. I'm starting Jetty server programmatically using Java API, adding servlet holder and wrapper test JSP and initializing the server passing the project's web root.
There were some issues with Jasper discovering TLD locations during runtime when run from maven surefire plugin. I fixed it by providing
<useManifestOnlyJar>false</useManifestOnlyJar>
plugin classpath settings. Everything works good when I run tests using mvn clean install now.
Running tests from eclipse context menu has one issue. If there is any other project in workspace in the multi module maven build, TLD's in that project are not resolved. One workaround I tried was to 'close' the project in eclipse workspace and it worked out.
However I would want it to work with all the projects open in workspace and running from the eclipse JUnit context menu. The problem is in the jasper TldScanner that looks for tld files in jar and WEB-INF of current project only.
TldScanner.scanTlds()
processWebDotXml();
scanJars();
processTldsInFileSystem("/WEB-INF/");
I'm using org.glassfish.web.jsp-impl 2.2.2-b06 version with Jetty-8.1.0-RC5.
Is there a way to specify file based TLD scanning for jasper for extra classpath items?
i am very new to web services and i have one problem please suggest me .. i.e i have a WSDL(SOAP) file and with that i created the Web Service-server and web service-Client using Top-Down approach with JAX-WS in eclipse Juno Java EE. i integrated the Tomcat 7 with that Eclipse and from eclipse its working fine.
But my problem is i need to run the Tomcat from out side of the eclipse and i need to deploy the web service in to the tomcat. i don't want to run the Tomcat using eclipse? i just need to run the client from eclipse but i dont want to run the tomcat from eclipse. Please Help me.
File -> Export -> Web -> War (configure where to create it)
Deploying a tomcat application consist of building a war file then deploying it. We call this servlet.
Building the WAR
As you already have your server code, you should now complet the WEB-INF/web.xml file. This file describe the path of your servlet(your server code), on the tomcat server. Depending of your framework you can have some configuration to add in your META-INF/context.xml file.
In an eclipse project, thoses file are generaly under a directory name 'webapp' in your project. (src/main/webapp for a maven project).
First you must use the javaee & javaweb tools of eclipse to build a war file that contains all yours libs, files, class and web.xml
Alternativly you can use a maven build process to get a war, if you use maven.
Deploying the war
After installing tomcat, the deployement is as simple as drop the .war file is deploy directory of the home-directory of tomcat. Then your application is usable on default port 8080.
If you have install also the manager webapp of tomcat, you can see all yours currently deployed application in the manager http://myurl:8080/manager/html.
When you install tomcat, let be sure that your eclipse pseudo server is shutdown, or your tomcat server will have problem to get it's port and startup.
How does one deploy scala or scalatra onto Jetty servlet container? Does anyone have experience or can point me to some resources online?
If you're using sbt, run the package command from within the sbt shell. This will create you a war file in the target dir. You can drop that into jetty's webapps directory and configure a context xml file in its contexts directory.
If you're using maven, I believe the command you want is mvn package.
Are you using Simple Build Tool (SBT) for your project? If you do, it's as easy as running "sbt jetty"
Check it out: http://code.google.com/p/simple-build-tool/