Revision: 2192 http://archive-access.svn.sourceforge.net/archive-access/?rev=2192&view=rev Author: alexoz Date: 2008-02-07 14:56:30 -0800 (Thu, 07 Feb 2008) Log Message: ----------- * CreatedView.java Added class comment. Modified Paths: -------------- trunk/archive-access/projects/access-control/oracle/src/main/java/org/archive/accesscontrol/oracle/CreatedView.java Modified: trunk/archive-access/projects/access-control/oracle/src/main/java/org/archive/accesscontrol/oracle/CreatedView.java =================================================================== --- trunk/archive-access/projects/access-control/oracle/src/main/java/org/archive/accesscontrol/oracle/CreatedView.java 2008-02-07 22:51:38 UTC (rev 2191) +++ trunk/archive-access/projects/access-control/oracle/src/main/java/org/archive/accesscontrol/oracle/CreatedView.java 2008-02-07 22:56:30 UTC (rev 2192) @@ -7,11 +7,14 @@ import org.springframework.web.servlet.View; +/** + * View returning the HTTP 201 Created response, to indicate a resouce was + * created successfully. + */ public class CreatedView implements View { private String path; - - + public CreatedView(String path) { super(); this.path = path; @@ -25,7 +28,8 @@ } /** - * @param path the path to set + * @param path + * the path to set */ public void setPath(String path) { this.path = path; @@ -37,21 +41,23 @@ public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception { - response.addHeader("Location", getContextUrl(request) + path); + response.addHeader("Location", getContextUrl(request) + path); response.setStatus(201); } - + /** * Return the full URL of the context. * * eg. http://localhost:8080/exclusions-oracle-0.0.1-SNAPSHOT + * * @param request * @return */ public String getContextUrl(HttpServletRequest request) { StringBuffer url = request.getRequestURL(); String context = request.getContextPath(); - String contextUrl = url.substring(0, url.indexOf(context) + context.length()); + String contextUrl = url.substring(0, url.indexOf(context) + + context.length()); return contextUrl; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |