草庐IT

servletContext

全部标签

java - 无法打开 ServletContext 资源

这与一个老问题非常相似,但解决方案对我不起作用。我有一个WAR包。在web.xmlcontextConfigLocationclasspath:application-context.xmlorg.springframework.web.context.ContextLoaderListener在application-context.xmlclasspath:social.properties但是得到这个:org.springframework.beans.factory.BeanInitializationException:Couldnotloadproperties;neste

java - 无法打开 ServletContext 资源

这与一个老问题非常相似,但解决方案对我不起作用。我有一个WAR包。在web.xmlcontextConfigLocationclasspath:application-context.xmlorg.springframework.web.context.ContextLoaderListener在application-context.xmlclasspath:social.properties但是得到这个:org.springframework.beans.factory.BeanInitializationException:Couldnotloadproperties;neste

java - Request、Session 和 ServletContext 中属性的区别

这个问题在这里已经有了答案:Howdoservletswork?Instantiation,sessions,sharedvariablesandmultithreading(8个答案)关闭6年前。我无法理解这3种设置属性的方式之间的区别://Stringasattributeofrequestreq.setAttribute("name","Sluggo");//Integerasattributeofsessionreq.getSession().setAttribute("age",10);//DateasattributeofcontextgetServletContext()

java - 如何在 Rest Web 服务中获取 ServletContext

我正在使用Jersey实现休息网络服务。我需要有ServletContext对象来将文件保存在应用程序目录中。请帮助我了解上下文。我正在从Android设备调用此网络服务。提前致谢。@Path("notice")publicclassNoticeResources{@ResourceprivateServletContextcontext;@POST@Path("uploadphoto")@Consumes(MediaType.MULTIPART_FORM_DATA)@Produces("text/plain")publicStringuploadNotices(@FormDataPa

java - "Context"中的 "ServletContext"是什么意思?

方法getServletContextName()返回“网络应用程序”的名称。这意味着,“ServletContext”不过是“网络应用程序”。好的。API定义:aServletContextListenerreceivesnotificationsaboutchangestotheservletcontextofthewebapplicationtheyarepartof.“网络应用程序”的“servlet上下文”是什么意思?“ServletContext”中的“Context”到底是什么? 最佳答案 IMO,这个名字确实选得很糟

java - 在应用程序中获取 ServletContext

您能否解释一下如何在我的Application的子类中获取ServletContext实例?可能吗?我试过像下面的代码片段那样做,但它似乎不起作用-ctx未设置:importjavax.ws.rs.core.Application;importjavax.ws.rs.core.Context;//...@ApplicationPath("/")publicclassMainApplicationextendsApplication{@ContextServletContextctx;@OverridepublicSet>getClasses(){Set>classes=newHashS

java - 获取 NoSuchMethodError :javax. servlet.ServletContext.getVirtualServerName()

我在Tomcat8中部署服务时遇到问题。出现以下错误:Causedby:java.lang.NoSuchMethodError:javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;atorg.apache.tomcat.websocket.server.WsServerContainer.(WsServerContainer.java:149)atorg.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)atorg.apache.tomc

java - ServletContext.getRequestDispatcher() 与 ServletRequest.getRequestDispatcher()

为什么getRequestDispatcher(Stringpath)oftheServletRequestinterfacecannotextendoutsidethecurrentservletcontext在哪里getRequestDispatcher(Stringpath)oftheServletContextcanusethegetContext(Stringuripath)methodtoobtainRequestDispatcherforresourcesinforeigncontexts.如何?请帮忙 最佳答案 如果

java - javax.servlet.ServletContext 和 javax.servlet.ServletException 类型无法解析

我正在尝试将SpringSecurity包含到我的Web项目中,我正在关注本教程http://docs.spring.io/spring-security/site/docs/current/guides/html5//helloworld.html我已经使用给定的maven项目完成了教程中的所有内容,并且工作正常。但是当我试图将它包含到我的项目中时,会出现编译错误。特别是当我从AbstractSecurityWebApplicationInitializer扩展时出现给定错误MultiplemarkersatthislineThetypejavax.servlet.ServletCo

java.lang.NoSuchMethodError : javax. servlet.ServletContext.getContextPath()Ljava/lang/String;

我在重启Tomcat后将文件war部署到Tomcat时遇到了韩国egovframework的问题,它显示如下错误:2011-12-2309:16:01,101ERROR[org.springframework.web.servlet.DispatcherServlet]Contextinitializationfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'imageRenderer'definedinServletContextresource[/WEB-I