18 package org.turro.pivot.servlet;
21 import java.io.IOException;
23 import javax.servlet.ServletException;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26 import org.apache.pivot.collections.ArrayList;
27 import org.apache.pivot.collections.adapter.ListAdapter;
28 import org.apache.pivot.io.FileSerializer;
29 import org.apache.pivot.serialization.BinarySerializer;
30 import org.apache.pivot.serialization.Serializer;
31 import org.apache.pivot.web.QueryException;
32 import org.apache.pivot.web.server.QueryServlet;
33 import org.turro.elephant.context.ElephantApplication;
34 import org.turro.wd.entities.AttachWd;
35 import org.turro.wd.entities.ServerFile;
44 protected void service(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
46 super.service(request, response);
50 protected Object
doGet(Path path)
throws QueryException {
51 if(
"/queryFolders".equals(path.toString())) {
53 getParameters().
get(
"path"),
54 getParameters().
get(
"user"))));
55 }
else if (
"/queryFiles".equals(path.toString())) {
57 getParameters().
get(
"path"),
58 getParameters().
get(
"user"))));
59 }
else if (
"/download".equals(path.toString())) {
61 getParameters().
get(
"path"),
62 getParameters().
get(
"fileName"),
63 getParameters().
get(
"user"),
64 "true".equals(getParameters().
get(
"forEditing")));
65 }
else if (
"/unlock".equals(path.toString())) {
67 getParameters().
get(
"path"),
68 getParameters().
get(
"fileName"),
69 getParameters().
get(
"user"));
114 protected URL
doPost(Path path, Object value)
throws QueryException {
115 if(
"/upload".equals(path.toString())) {
117 getParameters().
get(
"fileName"),
118 getParameters().
get(
"fileDate"),
119 getParameters().
get(
"path"),
120 getParameters().
get(
"user"),
121 getParameters().
get(
"comment"),
122 "true".equals(getParameters().
get(
"lock")),
131 if(
"/upload".equals(path.toString()) ||
"/download".equals(path.toString())) {
132 return new FileSerializer();
134 return new BinarySerializer();
URL doPost(Path path, Object value)
void service(HttpServletRequest request, HttpServletResponse response)
Serializer<?> createSerializer(Path path)
static List< String > queryFolders(String path, String user)
static File convertToFile(String path, String fileName, String user, boolean forEditing)
static Attachment saveFromFile(File file, String fileName, String fileDate, String path, String user, String comment, boolean lock, boolean validated)
static Object unlockFile(String path, String fileName, String user)
static List< ServerFile > queryVersionedAttachments(String path, String user)