diff options
author | James Moger <james.moger@gitblit.com> | 2014-05-05 09:53:24 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-05-05 09:53:24 -0400 |
commit | ff17f7bac432b4ba8310ba3ea335748a34859d50 (patch) | |
tree | 58278b648975c83e5af80cb79f3cf6f0bf78759c /src/main/java/com/gitblit/servlet | |
parent | 1946fe76331b37c5a3be97268f0e3b0e58f3bb00 (diff) | |
download | gitblit-ff17f7bac432b4ba8310ba3ea335748a34859d50.tar.gz gitblit-ff17f7bac432b4ba8310ba3ea335748a34859d50.zip |
Replace RawPage with RawServlet
Diffstat (limited to 'src/main/java/com/gitblit/servlet')
-rw-r--r-- | src/main/java/com/gitblit/servlet/PagesFilter.java | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/PagesServlet.java | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/RawFilter.java (renamed from src/main/java/com/gitblit/servlet/BranchFilter.java) | 4 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/RawServlet.java (renamed from src/main/java/com/gitblit/servlet/BranchServlet.java) | 24 |
4 files changed, 12 insertions, 20 deletions
diff --git a/src/main/java/com/gitblit/servlet/PagesFilter.java b/src/main/java/com/gitblit/servlet/PagesFilter.java index 0535ea06..e07d9b3b 100644 --- a/src/main/java/com/gitblit/servlet/PagesFilter.java +++ b/src/main/java/com/gitblit/servlet/PagesFilter.java @@ -23,7 +23,7 @@ package com.gitblit.servlet; * @author James Moger
*
*/
-public class PagesFilter extends BranchFilter {
+public class PagesFilter extends RawFilter {
}
diff --git a/src/main/java/com/gitblit/servlet/PagesServlet.java b/src/main/java/com/gitblit/servlet/PagesServlet.java index 7919e442..f578f86f 100644 --- a/src/main/java/com/gitblit/servlet/PagesServlet.java +++ b/src/main/java/com/gitblit/servlet/PagesServlet.java @@ -26,7 +26,7 @@ import com.gitblit.Constants; * @author James Moger
*
*/
-public class PagesServlet extends BranchServlet {
+public class PagesServlet extends RawServlet {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/com/gitblit/servlet/BranchFilter.java b/src/main/java/com/gitblit/servlet/RawFilter.java index 58b8f433..34989c98 100644 --- a/src/main/java/com/gitblit/servlet/BranchFilter.java +++ b/src/main/java/com/gitblit/servlet/RawFilter.java @@ -22,13 +22,13 @@ import com.gitblit.models.RepositoryModel; import com.gitblit.models.UserModel;
/**
- * The BranchFilter is an AccessRestrictionFilter which ensures http branch
+ * The RawFilter is an AccessRestrictionFilter which ensures http branch
* requests for a view-restricted repository are authenticated and authorized.
*
* @author James Moger
*
*/
-public class BranchFilter extends AccessRestrictionFilter {
+public class RawFilter extends AccessRestrictionFilter {
/**
* Extract the repository name from the url.
diff --git a/src/main/java/com/gitblit/servlet/BranchServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java index 33808961..cde7b2e1 100644 --- a/src/main/java/com/gitblit/servlet/BranchServlet.java +++ b/src/main/java/com/gitblit/servlet/RawServlet.java @@ -65,11 +65,11 @@ import dagger.ObjectGraph; * @author James Moger * */ -public class BranchServlet extends DaggerServlet { +public class RawServlet extends DaggerServlet { private static final long serialVersionUID = 1L; - private transient Logger logger = LoggerFactory.getLogger(BranchServlet.class); + private transient Logger logger = LoggerFactory.getLogger(RawServlet.class); private IRuntimeManager runtimeManager; @@ -99,7 +99,7 @@ public class BranchServlet extends DaggerServlet { encodedPath = URLEncoder.encode(encodedPath, "UTF-8"); } catch (UnsupportedEncodingException e) { } - return baseURL + Constants.BRANCH + repository + "/" + (branch == null ? "" : (branch + "/" + (path == null ? "" : (encodedPath + "/")))); + return baseURL + Constants.RAW_PATH + repository + "/" + (branch == null ? "" : (branch + "/" + (path == null ? "" : encodedPath))); } protected String getBranch(String repository, HttpServletRequest request) { @@ -333,18 +333,9 @@ public class BranchServlet extends DaggerServlet { String str = MessageFormat.format( "# Error\nSorry, the requested resource **{0}** was not found.", requestedPath); - String content = MarkdownUtils.transformMarkdown(str); - - try { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - - byte [] bytes = content.getBytes(Constants.ENCODING); - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - sendContent(response, new Date(), is); - return; - } catch (Throwable t) { - logger.error("Failed to write page to client", t); - } + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + error(response, str); + return; } else { // // directory list @@ -373,7 +364,8 @@ public class BranchServlet extends DaggerServlet { for (PathModel entry : pathEntries) { String pp = URLEncoder.encode(entry.name, Constants.ENCODING); response.getWriter().append(MessageFormat.format(pattern, basePath, pp, - JGitUtils.getPermissionsFromMode(entry.mode), byteFormat.format(entry.size))); + JGitUtils.getPermissionsFromMode(entry.mode), + entry.isFile() ? byteFormat.format(entry.size) : "")); } response.getWriter().append("</tbody>"); response.getWriter().append("</table>"); |