Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] How to include another web page in a page served by Jetty?

Hello,

I am using Jetty 9.4.27.v20200227 -

1) in production server to server Wordpress/PHP and a Java servlet
2) in test server started locally at my Macbook to serve the Java servlet

I wonder if there is some kind of configuration statement for Jetty which would allow me to include other web pages inside the HTML web page files served by Jetty.

Then I would be able to emulate more functionality from the production server (which uses PHP to include other web pages/URLs) in my test server.

Thank you for any hints
Alex

PS: Below are the config files of my test server, they are pretty simple -

jetty.base/webapps/words.xml (to serve some static HTML pages):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
    "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
    <Set name="contextPath">/words</Set>
    <Set name="handler">
        <New class="org.eclipse.jetty.server.handler.ResourceHandler">
            <Set name="resourceBase"><SystemProperty name="jetty.base"/>/../words</Set>
            <Set name="directoriesListed">true</Set>
        </New>
    </Set>
</Configure>

jetty.base/webapps/ws.xml (for the servlet and WebSockets):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
    "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/ws</Set>
    <Set name="war"><SystemProperty name="jetty.base"/>/../WebSockets/target/ws-servlet-0.1-SNAPSHOT.war</Set>
</Configure>

etc.

Back to the top