Jetty Servlet无法运行-而是获取目录列表 [英] Jetty Servlet does not run -- getting directory listing instead

查看:100
本文介绍了Jetty Servlet无法运行-而是获取目录列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Netbeans中构建并运行一个servlet,以使其在码头服务器上运行. 本地部署总是可以的,但是在Jetty上部署会导致目录列表而不是实际运行的servlet.

I'm trying to get a servlet built and running in Netbeans to run on a jetty server. Deploying locally always works, however deploying on Jetty results in a directory listing rather than the servlet actually running.

问题似乎出在上下文配置上,但是我不知道我在做什么错.

The problem seems to be with the context configuration, but I have no idea what I'm doing wrong.

以下是war文件中web.xml的XML:

Here is the XML for web.xml in the war file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
    <description>Raw Query</description>
    <servlet-name>query</servlet-name>
    <servlet-class>core.SQL</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>query</servlet-name>
    <url-pattern>/query</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

在码头方面,我通过以下方式部署了contex映射设置:

On the Jetty side, I'm deploying with a contex mapping setup this way:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" 
"http://jetty.mortbay.org/configure.dtd">

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
    <Set name="contextPath">/query</Set>
    <Set name="war">
        <SystemProperty name="jetty.home" default="."/>/webapps/Link/I5Link.war
    </Set>
</Configure>

任何帮助都非常有用.

推荐答案

我尚未使用码头,但我将测试以下网址:

I have not worked with jetty but I would test the following url:

http://localhost:8080/query/query?whateverYouNeed

如果有效,我将更改您的< url-pattern>对于以下之一:

If it works, I would change your <url-pattern> for one of the following:

< url-pattern>/</url-pattern>

<url-pattern>/</url-pattern>

< url-pattern> *</url-pattern>

<url-pattern>*</url-pattern>

这篇关于Jetty Servlet无法运行-而是获取目录列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆