Skip to content

Commit

Permalink
[playframework#632] Configuration parameter for application not serve…
Browse files Browse the repository at this point in the history
…d from the root of the domain.
  • Loading branch information
erwan committed Apr 11, 2011
1 parent 6b398fd commit 390bb6b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
3 changes: 3 additions & 0 deletions framework/src/play/Play.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ public static void init(File root, String id) {
mode = Mode.PROD;
}

// Context path
ctxPath = configuration.getProperty("http.path", "");

// Build basic java source path
VirtualFile appRoot = VirtualFile.open(applicationPath);
roots.add(appRoot);
Expand Down
33 changes: 15 additions & 18 deletions framework/src/play/server/ServletWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,22 @@
*/
public class ServletWrapper extends HttpServlet implements ServletContextListener {

/**
* Constant for accessing the underlying HttpServletRequest from Play's Request
* in a Servlet based deployment.
* <p>Sample usage:</p>
* <p> {@code HttpServletRequest req = Request.current().args.get(ServletWrapper.SERVLET_REQ);}</p>
*/
public static final String SERVLET_REQ = "__SERVLET_REQ";
/**
* Constant for accessing the underlying HttpServletResponse from Play's Request
* in a Servlet based deployment.
* <p>Sample usage:</p>
* <p> {@code HttpServletResponse res = Request.current().args.get(ServletWrapper.SERVLET_RES);}</p>
*/
public static final String SERVLET_RES = "__SERVLET_RES";

private volatile boolean routerInitializedWithContext = false;
/**
* Constant for accessing the underlying HttpServletRequest from Play's Request
* in a Servlet based deployment.
* <p>Sample usage:</p>
* <p> {@code HttpServletRequest req = Request.current().args.get(ServletWrapper.SERVLET_REQ);}</p>
*/
public static final String SERVLET_REQ = "__SERVLET_REQ";
/**
* Constant for accessing the underlying HttpServletResponse from Play's Request
* in a Servlet based deployment.
* <p>Sample usage:</p>
* <p> {@code HttpServletResponse res = Request.current().args.get(ServletWrapper.SERVLET_RES);}</p>
*/
public static final String SERVLET_RES = "__SERVLET_RES";

private volatile boolean routerInitializedWithContext = false;

public void contextInitialized(ServletContextEvent e) {
String appDir = e.getServletContext().getRealPath("/WEB-INF/application");
Expand Down Expand Up @@ -205,8 +204,6 @@ public static Request parseRequest(HttpServletRequest httpServletRequest) throws
Logger.trace("httpServletRequest.getContextPath(): " + httpServletRequest.getContextPath());
Logger.trace("request.path: " + path + ", request.querystring: " + querystring);



String contentType = null;
if (httpServletRequest.getHeader("Content-Type") != null) {
contentType = httpServletRequest.getHeader("Content-Type").split(";")[0].trim().toLowerCase().intern();
Expand Down
5 changes: 5 additions & 0 deletions resources/application-skel/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ date.format=yyyy-MM-dd
# By default the server listen for HTTP on the wilcard address.
# You can restrict this.
# http.address=127.0.0.1
#
# Use this if you don't host your Play application at the root of the domain
# you're serving it from. This parameter has no effect when deployed as a
# war, because the path will be handled by the application server.
# http.path=/

# Session configuration
# ~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 390bb6b

Please sign in to comment.