You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/07/14 20:00:48 UTC
svn commit: r421971 - in
/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util:
WeblogPageRequest.java WeblogPreviewRequest.java
Author: agilliland
Date: Fri Jul 14 11:00:47 2006
New Revision: 421971
URL: http://svn.apache.org/viewvc?rev=421971&view=rev
Log:
preview is actually an extension of a page, so it should be a subclass.
Modified:
incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPreviewRequest.java
Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java?rev=421971&r1=421970&r2=421971&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java Fri Jul 14 11:00:47 2006
@@ -81,9 +81,9 @@
// parse the request object and figure out what we've got
log.debug("parsing path "+pathInfo);
- // was this request bound for the page servlet?
- if(servlet == null || !PAGE_SERVLET.equals(servlet)) {
- throw new InvalidRequestException("not a weblog page request, "+
+ // was this request bound for the right servlet?
+ if(!isValidDestination(servlet)) {
+ throw new InvalidRequestException("invalid destination for request, "+
request.getRequestURL());
}
@@ -161,10 +161,11 @@
* date - specifies a weblog date string
* cat - specifies a weblog category
*
- * we only allow request params if the path info is null. this way
+ * we only allow request params if the path info is null or on user
+ * defined pages (for backwards compatability). this way
* we prevent mixing of path based and query param style urls.
*/
- if(pathInfo == null) {
+ if(pathInfo == null || this.weblogPageName != null) {
if(request.getParameter("date") != null) {
String date = request.getParameter("date");
if(this.isValidDateString(date)) {
@@ -210,6 +211,11 @@
log.debug("weblogPage = "+this.weblogPageName);
log.debug("pageNum = "+this.pageNum);
}
+ }
+
+
+ boolean isValidDestination(String servlet) {
+ return (servlet != null && PAGE_SERVLET.equals(servlet));
}
Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPreviewRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPreviewRequest.java?rev=421971&r1=421970&r2=421971&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPreviewRequest.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPreviewRequest.java Fri Jul 14 11:00:47 2006
@@ -24,7 +24,9 @@
/**
* Represents a request for a weblog preview.
*/
-public class WeblogPreviewRequest extends WeblogRequest {
+public class WeblogPreviewRequest extends WeblogPageRequest {
+
+ private static final String PREVIEW_SERVLET = "/roller-ui/authoring/preview";
private String theme = null;
@@ -32,7 +34,7 @@
public WeblogPreviewRequest(HttpServletRequest request)
throws InvalidRequestException {
- // our parent will determine the weblog handle for us
+ // let parent go first
super(request);
// all we need to worry about is the query params
@@ -41,10 +43,29 @@
this.theme = request.getParameter("theme");
}
}
-
+
+
+ boolean isValidDestination(String servlet) {
+ return (servlet != null && PREVIEW_SERVLET.equals(servlet));
+ }
+
public String getTheme() {
return theme;
+ }
+
+ public void setTheme(String theme) {
+ this.theme = theme;
+ }
+
+ // override so that previews never show login status
+ public String getAuthenticUser() {
+ return null;
+ }
+
+ // override so that previews never show login status
+ public boolean isLoggedIn() {
+ return false;
}
}