Questions tagged [contextpath]

Context path refers to the portion of the web request URI that indicates the context of the request. The context path always comes first in a request URI.

Context path refers to the portion of the web request URI that indicates the context of the request. The context path always comes first in a request URI.

For example - in the http://www.example.com/myContextPath/hello.jsp, the context path is myContextPath.

206 questions
3
votes
1 answer

How to define a root context outside of the war in jboss 5.1?

To customise the root context of a web app in jboss 5.1 there is a documented way that describe how to add a jboss-web.xml file under the WEB-INF directory of the web application
3
votes
1 answer

IllegalStateException after upgrading web app to Spring Boot 2.4

My web app is no longer starting after upgrading to Spring Boot 2.4. It is throwing the following error : Unable to locate the default servlet for serving static content. Please set the 'defaultServletName' property explicitly. I am using the…
Martin
  • 1,265
  • 2
  • 17
  • 48
3
votes
3 answers

Do we always need to use context.Server.MapPath? what if I cache the result?

I find it weird to use context.Server.MapPath every time just to determine physical location of some known directory/file under app_data folder. I have an understanding that once an application is running, it must not be possible to have its…
Varun K
  • 3,333
  • 2
  • 23
  • 25
3
votes
2 answers

Output Context Node (full path) in XSLT 1.0?

For debugging purposes it would be handy to output the full path of the context node from within a template, is there unabbreviated xpath or function to report this ? Example Template:
monojohnny
  • 5,531
  • 15
  • 56
  • 78
3
votes
3 answers

How to get a context path of a properties file from a webservice in java?

I am trying read the context path of a properties file from my application, properties.load(this.getClass().getResourceAsStream(path)); import java.util.Properties; public class test1 { public String getValues() { …
3
votes
2 answers

Context path in URIs of static resources, do I really need to specify it?

I have a simple web app webapp static images - a.gif pages - test.html WEB-INF pages - test.jsp in test.html, there is the problem is that the image…
jnj
  • 725
  • 2
  • 11
  • 22
3
votes
2 answers

Struts2 anchor tag doesn't include contextPath

%{#request.contextPath} doesn't work inside an s:a tag in Struts2. (Struts 2.2.1 to be specific.) Is there a way to make it work? It works in other Struts2 tags. Here are two lines in a JSP file in a Struts 2 project whose context path is…
Brian Morearty
  • 2,447
  • 25
  • 33
3
votes
1 answer

How to rename Spring MVC Web App context root?

I'm trying to rename my Spring MVC web application. When I run it, there is an old name in the URL: http://localhost:8080/oldName/ In project Properties>Resource I set Path: /newName and also in Web Project Settings, Context root: newName But it…
jarosik
  • 3,016
  • 8
  • 31
  • 45
3
votes
2 answers

Tomcat/TomEE adding "/localhost" into servletContext.getResource("myStaticFile")

My WAR is deploying fine in TomEE under the correct context root "/myApp" so that I can go to http://localhost:8080/myApp I have some static files under: /myApp/WEB-INF/files From looking at the exploded WAR the files are definitely there. My…
Justin
  • 739
  • 4
  • 13
  • 29
3
votes
1 answer

Jetty :: ServletContextHandler#setContextPath(..) and how to associate Servlets with specific file extensions

I have the following code in Jetty: ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); contextHandler.setContextPath("/a"); ServletHolder holder = new…
Marcus Junius Brutus
  • 23,022
  • 30
  • 155
  • 282
3
votes
2 answers

Tomcat secure folder in webapps

I have a web application and Tomcat, like server for it. I put my web app in the folder: $(TOMCAT_HOME)/webapps/myapp and my images to the $(TOMCAT_HOME)/webapps/images And I wrote next in the tomcat's server.xml
Andrew
  • 625
  • 2
  • 10
  • 20
3
votes
1 answer

How to define src attribute from web application context in JSP

I wanted to use absolute path in src attribute, while including Javascript and CSS files in JSP. Using relative URLs would not serve my purpose, similar to the one below : If…
Rohit Bansal
  • 1,129
  • 1
  • 10
  • 17
3
votes
2 answers

Serving files from within a Tomcat context

I have a web application deployed to Tomcat 6 as a WAR file. From within the application I would like to serve files in a directory from within that context. For example, I deploy myapp.war to /mydir/webapps and I access my application…
Brian
  • 155
  • 1
  • 2
  • 9
2
votes
1 answer

I am using $this in a class, but it keeps giving me Fatal error: Using $this when not in object context

I created a a cart class which contains songs to be bought. The cartSong class works fine, but when I use the cart class, an error about $this always comes up. I want the variable $songList (array) to add a song object to the cart every time…
Jack Sparser
  • 65
  • 2
  • 9
2
votes
5 answers

Tomcat does not recognize my context

I have a web application and use tomcat-5.5.27, eclipse 3.4 on open SUSE. I use it from eclipse (deploy, run, debug, etc...) I have to set some JNDI resources (datasources) that Tomcat will expose them. These resources are defined now in…
Andrei
  • 43
  • 1
  • 5
1 2
3
13 14