Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webstorm How do I set the context root for my application?

Tags:

webstorm

I'm having a heck of a time figuring this out (and I assume it is a basic problem and I'm just searching for the wrong terms). I have a plain html site that I'm trying to debug locally and when I open it in a browser or debug it I get this url:

http://localhost:63342/DeleteMe/root/index.html

If I set my resource root to the root folder I end up with:

http://localhost:63342/DeleteMe/index.html

The problem is I use "absolutely" pathed resources such as /js/utility.js because the context shifts based on what AJAX content is pulled in (Hijax-ish application).

What I'd like to see is->

http://localhost:63342/index.html

http://localhost:63342/js/utility.js

for a project like:

[DeleteMe] <--project root
  - root
    - js
      utility.js
    - index.html

I'm interested in a solution that deals directly with this problem inside the IDE. I already have a host of tools for web development and I'm evaluating JetBrains at the moment and these little details are what make the difference for me. I can easily set up IIS or Apache to preview the site, I'm looking for a complete solution in a single IDE.

(For reference the project was developed using Eclipse)

like image 398
Daniel B. Chapman Avatar asked Dec 31 '13 17:12

Daniel B. Chapman


People also ask

How do you change the Web context root in an application?

1.1 Right click on the project, select Properties , Web Project Settings , update the context root here. 1.2 Remove your web app from the server and add it back. The context root should be updated. 1.3 If step 2 is failing, delete the server, create a new server and add back the web app.

What is application context root?

The context root for an application defines the location at which the module can be accessed. The context root is part of the URL you use to connect to the application.


1 Answers

Why don't you use your deployed test version to run the application? When I started using Webstorm I had those problems. Then I figured out that Webstorm can debug your source anywhere your are running it.

So, I have my appache set, with any root I want, and I point the sources (using symlinks) to the real source in the project.

Then, I create a configuration for each of the servers I want to use, like this:

enter image description here

I also use that approach, together with hosts, to have multiple different debug environments (for different users, for instance). This is a stretch of my windows hosts file (in C:\Windows\System32\drivers\etc):

...
127.0.0.1 crewhu-admin
127.0.0.1 crewhu-company
127.0.0.1 crewhu-manager
127.0.0.1 crewhu-employee
...

And the debug process for javascript works like a charm for all environments.

Hope this helps...

like image 117
Oscar Eduardo Avatar answered Sep 16 '22 19:09

Oscar Eduardo