/PhotoAlbum/trunk/src/ak/photoalbum/webapp/ServletResourceFactory.java |
---|
2,7 → 2,6 |
import java.io.InputStream; |
import javax.servlet.ServletContext; |
import ak.photoalbum.logic.ResourceFactory; |
public class ServletResourceFactory |
implements ResourceFactory |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/InitServlet.java |
---|
6,7 → 6,6 |
import javax.servlet.ServletResponse; |
import javax.servlet.GenericServlet; |
import javax.servlet.ServletException; |
import ak.photoalbum.logic.Logic; |
public class InitServlet |
extends GenericServlet |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/IndexAction.java |
---|
9,8 → 9,6 |
import org.apache.struts.action.ActionForward; |
import org.apache.log4j.Logger; |
import ak.photoalbum.util.FileUtils; |
import ak.photoalbum.logic.Logic; |
import ak.photoalbum.logic.IndexEntry; |
public final class IndexAction |
extends BaseAction |
22,7 → 20,6 |
throws Exception |
{ |
IndexForm theForm = (IndexForm)form; |
String branch = theForm.getBranch(); |
String dir = theForm.getPath(); |
int page = theForm.getPageInt(); |
IndexEntry entry = new IndexEntry(); |
36,8 → 33,8 |
if(dir == null) dir = ""; // the images root |
logger.info("get index for " + dir); |
Logic.getLogic().getEntry(branch, dir, entry, top, prev, current, next); |
if(!Logic.getLogic().listDirectory(branch, dir, page, index, pages)) |
Logic.getLogic().getEntry(dir, entry, top, prev, current, next); |
if(!Logic.getLogic().listDirectory(dir, page, index, pages)) |
return mapping.findForward("error"); |
request.setAttribute("dir", FileUtils.replaceFileSeparator(dir, " - ")); |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/PageItem.java |
---|
0,0 → 1,30 |
package ak.photoalbum.webapp; |
import java.io.File; |
public class PageItem |
{ |
private int number; |
private boolean isCurrent; |
public PageItem(int number, boolean isCurrent) |
{ |
this.number = number; |
this.isCurrent = isCurrent; |
} |
public int getNumber() |
{ |
return number; |
} |
public int getDisplayNumber() |
{ |
return (number+1); |
} |
public boolean getIsCurrent() |
{ |
return isCurrent; |
} |
} |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/BuildCacheAction.java |
---|
8,7 → 8,6 |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.log4j.Logger; |
import ak.photoalbum.logic.Logic; |
public final class BuildCacheAction |
extends Action |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/BaseAction.java |
---|
10,7 → 10,6 |
import org.apache.struts.action.ActionForward; |
import org.apache.log4j.Logger; |
import ak.photoalbum.util.FileUtils; |
import ak.photoalbum.logic.LogicSecurityException; |
public abstract class BaseAction |
extends Action |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/PageAction.java |
---|
6,8 → 6,6 |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.log4j.Logger; |
import ak.photoalbum.logic.Logic; |
import ak.photoalbum.logic.IndexEntry; |
public final class PageAction |
extends BaseAction |
19,7 → 17,6 |
throws Exception |
{ |
PathForm theForm = (PathForm)form; |
String branch = theForm.getBranch(); |
String page = theForm.getPath(); |
IndexEntry entry = new IndexEntry(); |
IndexEntry index = new IndexEntry(); |
30,7 → 27,7 |
if(page == null) page = ""; // the images root |
logger.info("get page " + page); |
Logic.getLogic().getEntry(branch, page, entry, index, prev, current, next); |
Logic.getLogic().getEntry(page, entry, index, prev, current, next); |
request.setAttribute("page", page); |
request.setAttribute("entry", entry); |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/ImageAction.java |
---|
7,7 → 7,6 |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.log4j.Logger; |
import ak.photoalbum.logic.Logic; |
public final class ImageAction |
extends BaseAction |
19,7 → 18,6 |
throws Exception |
{ |
PathForm theForm = (PathForm)form; |
String branch = theForm.getBranch(); |
String path = theForm.getPath(); |
Logic logic = Logic.getLogic(); |
26,20 → 24,20 |
logger.info("get image " + mapping.getParameter() + " for " + path); |
if("dir".equals(mapping.getParameter())) { |
response.setContentType(logic.getThumbnailMime(branch)); |
logic.writeDir(branch, path, response.getOutputStream()); |
response.setContentType(logic.getThumbnailMime()); |
logic.writeDir(path, response.getOutputStream()); |
} |
else if("small".equals(mapping.getParameter())) { |
response.setContentType(logic.getThumbnailMime(branch)); |
logic.writeSmall(branch, path, response.getOutputStream()); |
response.setContentType(logic.getThumbnailMime()); |
logic.writeSmall(path, response.getOutputStream()); |
} |
else if("medium".equals(mapping.getParameter())) { |
response.setContentType(logic.getThumbnailMime(branch)); |
logic.writeMedium(branch, path, response.getOutputStream()); |
response.setContentType(logic.getThumbnailMime()); |
logic.writeMedium(path, response.getOutputStream()); |
} |
else if("origin".equals(mapping.getParameter())) { |
response.setContentType(logic.getOriginMime(branch, path)); |
logic.writeOrigin(branch, path, response.getOutputStream()); |
response.setContentType(logic.getOriginMime(path)); |
logic.writeOrigin(path, response.getOutputStream()); |
} |
return null; |
/PhotoAlbum/trunk/src/ak/photoalbum/webapp/PathForm.java |
---|
9,19 → 9,8 |
public class PathForm |
extends ActionForm |
{ |
protected String branch; |
protected String path; |
public String getBranch() |
{ |
return branch; |
} |
public void setBranch(String branch) |
{ |
this.branch = branch; |
} |
public String getPath() |
{ |
return path; |