Java Servlet映射(Java Servlet Mappings)
我有一个在web.xml中定义的servlet:
SessionRebindServlet
*.ppp
现在当有一个扩展名为.ppp的请求时,它使用上面的servlet。
但是我想在这里有一个例外,如果名为“popup.ppp”的文件根本不调用这个servlet。
可能吗?
UPDATE
我添加了一个过滤器
AppFilter
*.ppp
并在过滤器代码中:
String url = ((HttpServletRequest) request).getRequestURI();
if (url.contains("popup.ppp")) {
} else {
chain.doFilter(request, response);
}
I have a servlet defined as in web.xml:
SessionRebindServlet
*.ppp
Now when there is a request with extension .ppp it uses the above servlet.
But I want to have one exception here that if the file with name "popup.ppp" then don't call this servlet at all.
Is it possible?
UPDATE
I added a filter
AppFilter
*.ppp
and in filter code :
String url = ((HttpServletRequest) request).getRequestURI();
if (url.contains("popup.ppp")) {
} else {
chain.doFilter(request, response);
}
原文:https://stackoverflow.com/questions/14274912
更新时间:2020-01-26 15:22
相关问答
blazeDS lcds 这是java和flex通讯的中间件 建议你下载前者,开源的。 里面有详细的教程和实例,花时间看看就能明白许多东东了,如remoteObject、HTTPService等……
我知道怎么解决,doGet和doPost两种方式是有区别的;使用get方式传递数据时地址栏的url是这样的形式test.jsp?password=root&name=root这种格式,数据能够直接看到,不安全,并且发送的数据量很小,限制为1024个字节,可以把doget理解为发送的是有长度限制字符串。 使用post方式就恰好相反,post在地址栏的url内不能看到password以及name信息,是安全的。发送的长度是无限制的,可以理解为post是发送没有限制字节流(注意这个是字节流,它是由字符串
...
servlet只是一个响应特定类型的网络请求的类 - 最常见的是HTTP请求。 基本上,servlet通常用于实现Web应用程序 - 但是还有各种框架,它们在servlet(例如Struts)之上运行,以提供比“这里的HTTP请求,写入此HTTP响应”级别更高级的抽象级别,servlet提供。 Servlet在处理网络端的servlet容器中运行(例如解析HTTP请求,连接处理等)。 最着名的开源servlet容器之一是Tomcat 。 A servlet is simply a class wh
...
在IntelliJ中,您将Web应用程序的上下文路径配置为/url2 。 这意味着由/url2/开头的所有URL请求都由Tomcat路由到webapp的一个组件,而所有其他请求由Tomcat路由到另一个webapp(如果没有webapp映射到URL,则导致404) ) 在Spring webapp配置中,您正在配置Spring servlet映射到的webapp内部的路径。 而你正在配置它/url2 。 因此,当您从URL(用于选择webapp)中删除上下文路径时,将检查生成的路径,如果是/url
...
如上所述,不将Retrieve servlet映射到/但是/12345 ,然后将Insert servlet后的请求重定向到/12345 。 What about not mapping the Retrieve servlet to / but to /12345 as you said and then redirect the request after the Insert servlet to /12345.
我在这种情况下使用它: String lPath = ((HttpServletRequest) request).getRequestURI();
if (lPath.startsWith("/supported")) {
chain.doFilter(request, response);
} else {
// not supported
}
I use this for such cases: String lPath = ((HttpServletRequest) requ
...
没有这样的设施。 最好的办法是将JSP隐藏在/WEB-INF (以便它永远不会被URL直接请求),只需创建一个转发到该JSP并最终将其映射到所需URL模式的servlet。 这很容易: @WebServlet("/foo")
public class FooServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse resp
...
您是否使用正确的上下文作为URL中路径的第一部分? 无论何时部署应用程序,都需要指定标识所有URL的上下文。 在该上下文之后将应用任何url模式。 假设你有一个名为“MyShop”的上下文,然后使用你提供的web.xml,你应该调用http:// yourdomain / MyShop / MyServlet。 Are you using the correct context as the first part of your path in URL? Whenever you deploy a
...
本节
action
/beta/*
action
*.do
指定servlet应响应的模式。 使
...
请改变这一行
用“ /GuestBook ”替换“ Login ” Please change on this line
replace "Login" with "/GuestBook"