Skip to content

Commit

Permalink
Use servlet context when generating URLs.
Browse files Browse the repository at this point in the history
Fixes create project when running from WAR.
Some code cleanup.
Fixes #3696
  • Loading branch information
jhpedemonte committed Jan 30, 2013
1 parent ef00725 commit 47bcb54
Showing 1 changed file with 8 additions and 11 deletions.
Expand Up @@ -5,12 +5,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import maqetta.server.orion.MaqettaOrionServerConstants;
import maqetta.server.orion.user.OrionUser;

import org.davinci.server.user.IUser;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.orion.server.core.users.OrionScope;
import org.maqetta.server.Command;

public class ConfigProject extends Command {
Expand All @@ -20,21 +17,21 @@ public void handleCommand(HttpServletRequest req, HttpServletResponse resp, IUse

String projectName = req.getParameter("project");
String orionProject = req.getParameter("orionProject");
if(orionProject!=null){
OrionUser u = (OrionUser)user;
if (orionProject!=null) {
OrionUser u = (OrionUser) user;
projectName = u.computeMaqettaPath(orionProject);
}
boolean configOnly = "true".equals(req.getParameter("configOnly"));

boolean configOnly = "true".equals(req.getParameter("configOnly"));
String context = req.getContextPath();

user.createProject(projectName);

this.responseString = "OK";
if(configOnly){
resp.sendRedirect("/maqetta/");

}else{
resp.sendRedirect("/maqetta/?project=" + projectName);
if (configOnly) {
resp.sendRedirect(context + "/maqetta/");
} else {
resp.sendRedirect(context + "/maqetta/?project=" + projectName);
}
}

Expand Down

1 comment on commit 47bcb54

@jhpedemonte
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to #19.

Please sign in to comment.