Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 999 → Rev 1026

/backpath/trunk/src/ak/backpath/BackPath.java/BackPath.java
59,6 → 59,8
protected boolean forwardParamsFormed = false;
protected String currentParams;
protected boolean currentParamsFormed = false;
protected String currentUrl;
protected boolean currentUrlFormed = false;
protected String backwardParams;
protected boolean backwardParamsFormed = false;
protected String backwardUrl;
82,15 → 84,23
String backPathParam, String backPathIgnore, boolean zip)
throws Exception
{
String[] ignores = null;
 
if(backPathIgnore != null)
ignores = backPathIgnore.trim().split(IGNORES_DELIMITER);
 
return findBackPath(request, backPathKey, backPathParam, ignores, zip);
}
 
public static BackPath findBackPath(HttpServletRequest request, String backPathKey,
String backPathParam, String[] ignores, boolean zip)
throws Exception
{
Object backPathObj = request.getAttribute(backPathKey);
 
if(backPathObj == null) {
BackPath backPath;
String[] ignores = null;
 
if(backPathIgnore != null)
ignores = backPathIgnore.trim().split(IGNORES_DELIMITER);
 
backPath = new BackPath(request, backPathParam, ignores, zip);
request.setAttribute(backPathKey, backPath);
return backPath;
256,6 → 266,37
}
}
 
public String getCurrentUrl()
{
if(!currentParamsFormed) {
currentUrl = formCurrentUrl();
currentUrlFormed = true;
}
 
return currentUrl;
}
 
protected String formCurrentUrl()
{
if(stack.size() < 1) return null;
 
try {
StringBuffer url = new StringBuffer((String)stack.get(stack.size()-1));
if(stack.size() > 1) {
String s = encode(stack, zip, 1);
if(url.indexOf(URL_PARAM_START_STR) >= 0) url.append(URL_PARAM_SEPARATOR);
else url.append(URL_PARAM_START);
url.append(param).append(URL_PARAM_VALUE).append(s);
}
 
return url.toString();
}
catch(IOException ex) {
log.error("Cannot form current url", ex);
return null;
}
}
 
public void init(HttpServletRequest request)
{
try {
297,6 → 338,7
// form url
if(query.length() > 0) url = query.insert(0, url).toString();
}
 
stack.add(url);
}
catch(IOException ex) {
386,6 → 428,8
forwardParamsFormed = false;
currentParams = null;
currentParamsFormed = false;
currentUrl = null;
currentUrlFormed = false;
backwardParams = null;
backwardParamsFormed = false;
backwardUrl = null;