org.opensubsystems.blog.www
Class BlogNavigator

java.lang.Object
  extended by org.opensubsystems.blog.www.BlogNavigator

public class BlogNavigator
extends java.lang.Object

Class responsible for parsing and creating URLs for blogs and their entries. If root URL is http://www.opensubsystems.org then the structure of URLs is - Bog with folder "firstblog" root URL = http://www.opensubsystems.org/firstblog/ page URL = http://www.opensubsystems.org/firstblog/index.html - Entry belonging to "firstblog" with ID 123456789 page URL = http://www.opensubsystems.org/firstblog/123456789.html

Version:
$Id: BlogNavigator.java,v 1.6 2007/02/20 02:04:36 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.3 2006/07/15 09:09:26 bastafidli

Field Summary
static java.lang.String LOGIN_WEB_PAGE
          Page where user can login to the system.
static java.lang.String LOGOUT_WEB_PAGE
          Page where user can logout to the system.
protected  javax.servlet.http.HttpServletRequest m_hsrqRequest
          Request that will be used by this navigator
protected  java.lang.String m_strBlogDirectoryURL
          URL to the directory containing all blogs.
 
Constructor Summary
BlogNavigator(javax.servlet.http.HttpServletRequest hsrqRequest)
          Creates a new instance of BlogNavigator
 
Method Summary
 org.opensubsystems.blog.www.BlogEntryIdentification getBlogEntryIdentification(javax.servlet.http.HttpServletRequest hsrqRequest)
          Get blog and entries which coresponds to given request.
protected  java.lang.String getBlogEntryURL(java.lang.String strFolder, int iEntryId)
          Get URL to the page which displays specified blog entry.
 java.lang.Object getBlogIdentification(javax.servlet.http.HttpServletRequest hsrqRequest)
          Get blog which coresponds to given request.
protected  java.lang.StringBuffer getBlogRootURL(java.lang.String strId)
          Get URL to the root directory where all entries for given blog exist.
 java.lang.String getBlogURL(java.lang.Object objBlogIdentification)
          Get URL to the page that displays specified blog.
 java.lang.String getPostURL()
          Get URL to where a form can be posted to be processed
 java.lang.String getRootURL()
          Get URL to the root directory where all blogs exist.
 java.lang.String getURL(Blog blog)
          Get URL to the page which displays this blog.
 java.lang.String getURL(Blog blog, Entry entry)
          Get URL to the page which displays specified entry.
 java.lang.String getURL(org.opensubsystems.blog.www.BlogEntryIdentification entryIdentification)
          Get URL to the page which displays specified blog entry.
 boolean isLoginPage()
          Test if the requested path is path to the page where user can login to the system.
 boolean isLogoutPage()
          Test if the requested path is path to the page where user can login to the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN_WEB_PAGE

public static final java.lang.String LOGIN_WEB_PAGE
Page where user can login to the system.

See Also:
Constant Field Values

LOGOUT_WEB_PAGE

public static final java.lang.String LOGOUT_WEB_PAGE
Page where user can logout to the system.

See Also:
Constant Field Values

m_strBlogDirectoryURL

protected java.lang.String m_strBlogDirectoryURL
URL to the directory containing all blogs.


m_hsrqRequest

protected javax.servlet.http.HttpServletRequest m_hsrqRequest
Request that will be used by this navigator

Constructor Detail

BlogNavigator

public BlogNavigator(javax.servlet.http.HttpServletRequest hsrqRequest)
Creates a new instance of BlogNavigator

Parameters:
hsrqRequest - - request that will be used by this navigator
Method Detail

getPostURL

public java.lang.String getPostURL()
Get URL to where a form can be posted to be processed

Returns:
String - URL to posts the forms to

getRootURL

public java.lang.String getRootURL()
Get URL to the root directory where all blogs exist.

Returns:
String - URL ends with WebCommonConstants.URL_SEPARATOR_CHAR

getURL

public java.lang.String getURL(Blog blog)
Get URL to the page which displays this blog.

Parameters:
blog - - blog to get page URL for
Returns:
String

getBlogURL

public java.lang.String getBlogURL(java.lang.Object objBlogIdentification)
Get URL to the page that displays specified blog.

Parameters:
objBlogIdentification - - identification of the blog to get page URL for, which should be the folder
Returns:
String

getURL

public java.lang.String getURL(Blog blog,
                               Entry entry)
Get URL to the page which displays specified entry.

Parameters:
blog - - blog to which this entry belongs to
entry - - entry to get page URL for
Returns:
String - URL to the page displaying specified entry

getURL

public java.lang.String getURL(org.opensubsystems.blog.www.BlogEntryIdentification entryIdentification)
Get URL to the page which displays specified blog entry.

Parameters:
entryIdentification - - identification of entry
Returns:
String - URL to the page displaying specified entry

getBlogIdentification

public java.lang.Object getBlogIdentification(javax.servlet.http.HttpServletRequest hsrqRequest)
Get blog which coresponds to given request.

Parameters:
hsrqRequest - - the servlet request.
Returns:
Object - Identification of Blog coresponding to given request. This can be either String value identifying the Blog folder or Integer value identifying the Blog URL. Ff no such Blog exists, an exception will be thrown

getBlogEntryIdentification

public org.opensubsystems.blog.www.BlogEntryIdentification getBlogEntryIdentification(javax.servlet.http.HttpServletRequest hsrqRequest)
Get blog and entries which coresponds to given request.

Parameters:
hsrqRequest - - the servlet request.
Returns:
BlogEntryIdentification

isLoginPage

public boolean isLoginPage()
Test if the requested path is path to the page where user can login to the system.

Returns:
boolean - true if the page is login page

isLogoutPage

public boolean isLogoutPage()
Test if the requested path is path to the page where user can login to the system.

Returns:
boolean - true if the page is login page

getBlogRootURL

protected java.lang.StringBuffer getBlogRootURL(java.lang.String strId)
Get URL to the root directory where all entries for given blog exist.

Parameters:
strId - - ID of the blog to get root URL for
Returns:
String - URL ends with WebCommonConstants.URL_SEPARATOR_CHAR

getBlogEntryURL

protected java.lang.String getBlogEntryURL(java.lang.String strFolder,
                                           int iEntryId)
Get URL to the page which displays specified blog entry.

Parameters:
strFolder - - folder where this entry belongs to
iEntryId - - id of entry to get page URL for
Returns:
String - URL to the page displaying specified entry


Copyright © 2003 - 2007 OpenSubsystems s.r.o.