Nope, because the two classes you posted me are used by a WebdavUploader
class which is missing (and the exception that is generated,
UploadException); could you find any reference to these classes somewhere?
If not, which are the project references to the UploadContext object?

Thx
  mau

On Mon, Dec 28, 2009 at 8:57 AM, Jasha Joachimsthal <
[email protected]> wrote:

> Hi Maoo,
>
> 2009/12/22 Maurizio Pillitu <[email protected]>:
> > Hi Jasha,
> > I'm still missing the WebdavUploader and the UploadException classes
> which
> > are mentioned in the following snippet from the sample
> >
> > try {
> > new WebdavUploader(context).upload(comment);
> > dispatch = request.getRequestDispatcher("succes.jsp");
> > } catch(UploadException e) {
> > dispatch = request.getRequestDispatcher("failure.jsp");
> > }
> >
> > Couldn't find them on SVN; could you point me to the right tag where I
> can
> > find these classes?
>
> I guess they've never been in the public SVN. The snippets I posted
> were taken from a customer project. Do they work for you?
>
> Jasha
>
> >
> > Thanks!
> >
> >  mau
> >
> > On Mon, Dec 14, 2009 at 4:01 PM, Jasha Joachimsthal <
> > [email protected]> wrote:
> >
> >> 2009/12/14 Maurizio Pillitu <[email protected]>
> >>
> >> > Thanks Jasha!
> >> >
> >> > Shall I copy/paste your code in my project and try it out?
> >> >
> >>
> >> Yes please
> >>
> >>
> >> Jasha Joachimsthal
> >>
> >> [email protected] - [email protected]
> >>
> >> www.onehippo.com
> >> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
> >> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952
> +1
> >> (707) 7734646
> >>
> >>
> >>
> >>
> >> >
> >> > On Mon, Dec 14, 2009 at 3:49 PM, Jasha Joachimsthal <
> >> > [email protected]> wrote:
> >> >
> >> > > 2009/12/14 Maurizio Pillitu <[email protected]>
> >> > >
> >> > > > Hi everyone,
> >> > > > I was following the HST1 tutorial on how to upload content
> >> > > >
> >> > > >
> >> > > >
> >> > >
> >> >
> >>
> http://hst.hippocms.org/technical-documentation/building-a-JSP-front-end/examples/user-generated/comments.html
> >> > > >
> >> > > > It seems fairly easy, but I'm missing the mentioned classes:
> >> > > >
> >> > > > import nl.hippo.client.api.upload.WebdavUploadable;
> >> > > >
> >> > > > import nl.hippo.client.api.upload.UploadContext;
> >> > > >
> >> > > >
> >> > > Hmm I guess we've documented this feature before even adding it to
> the
> >> > HST
> >> > > ;-)
> >> > > I found some matching classes in a project:
> >> > >
> >> > > WebdavUploadable:
> >> > > package nl.hippo.client.api.upload;
> >> > >
> >> > > import java.io.InputStream;
> >> > > import nl.hippo.client.api.content.Property;
> >> > >
> >> > > public interface WebdavUploadable {
> >> > >  /**
> >> > >  * getInputStream() specifies how this WebdavUploadable generates an
> >> > >  * InputStream. This is needed by the WebdavUploader to
> >> > >  * put objects in the repository.
> >> > >  *
> >> > >  * @return a new InputStream
> >> > >  */
> >> > >  public InputStream getInputStream();
> >> > >  /**
> >> > >  * A WebdavUploadable document must be able to return it's document
> >> > >  * type. This is needed in the uploading process for the CMS to
> >> > >  * recognize it as a valid document.
> >> > >  *
> >> > >  * @return a document type
> >> > >  */
> >> > > public Property getDocumentType();
> >> > > }
> >> > >
> >> > >
> >> > >
> >> > > UploadContext
> >> > > package nl.hippo.client.api.upload;
> >> > >
> >> > > import javax.servlet.http.HttpServletResponse;
> >> > >
> >> > > import org.apache.commons.logging.Log;
> >> > > import org.apache.commons.logging.LogFactory;
> >> > >
> >> > > import nl.hippo.client.api.ClientException;
> >> > > import nl.hippo.client.api.content.DocumentPath;
> >> > > import nl.hippo.client.api.service.WebdavService;
> >> > > import nl.hippo.client.webdav.WebdavConfig;
> >> > > import nl.hippo.client.webdav.service.WebdavServiceImpl;
> >> > >
> >> > > public abstract class UploadContext {
> >> > >    private final static Log log =
> >> LogFactory.getLog(UploadContext.class);
> >> > >
> >> > >    private WebdavService service;
> >> > >    private DocumentPath rootFolder;
> >> > >    private DocumentPath documentFolder;
> >> > >    private DocumentPath documentTarget;
> >> > >    private String[] folders;
> >> > >
> >> > >    public UploadContext() {
> >> > >
> >> > >    }
> >> > >
> >> > >    /**
> >> > >     * This constructor creates an UploadContext object with a
> >> > configuration
> >> > >     * specified in the WebdavConfig object
> >> > >     *
> >> > >     * @param config contains the repository configuration
> >> > >     */
> >> > >    public UploadContext(WebdavConfig config, String folder, String
> >> > > documentName) {
> >> > >        service = getWebdavService(config);
> >> > >        rootFolder = service.getBasePath();
> >> > >        documentFolder =
> >> service.getBasePath().createRelativePath(folder);
> >> > >        documentTarget =
> service.getBasePath().createRelativePath(folder
> >> +
> >> > > documentName);
> >> > >        folders = folder.split("/");
> >> > >    }
> >> > >
> >> > >    /**
> >> > >     * This constructor creates an UploadContext object with a
> >> > >     * given webdav service
> >> > >     *
> >> > >     * @param webdav service to use for uploading
> >> > >     */
> >> > >    public UploadContext(WebdavService webdavService, String folder,
> >> > String
> >> > > documentName) {
> >> > >        service = webdavService;
> >> > >        rootFolder = service.getBasePath();
> >> > >        documentFolder =
> >> service.getBasePath().createRelativePath(folder);
> >> > >        documentTarget =
> service.getBasePath().createRelativePath(folder
> >> +
> >> > > documentName);
> >> > >        folders = folder.split("/");
> >> > >    }
> >> > >
> >> > >    public DocumentPath getRootFolder() {
> >> > >        return rootFolder;
> >> > >    }
> >> > >
> >> > >    public DocumentPath getDocumentFolder() {
> >> > >        return documentFolder;
> >> > >    }
> >> > >
> >> > >    public DocumentPath getDocumentTarget() {
> >> > >        return documentTarget;
> >> > >    }
> >> > >
> >> > >    public WebdavService getWebdavService(WebdavConfig config) {
> >> > >        return new WebdavServiceImpl(config);
> >> > >    }
> >> > >
> >> > >    public WebdavService getWebdavService() {
> >> > >        return service;
> >> > >    }
> >> > >
> >> > >    public void createFolder(DocumentPath path) throws
> ClientException {
> >> > >        service.executeMkCol(path);
> >> > >    }
> >> > >
> >> > >    public void createPath() throws ClientException {
> >> > >        String path = "";
> >> > >        int i = 0;
> >> > >        int index = 0;
> >> > >        int repositoryResponseCode = 0;
> >> > >
> >> > >        while (i < folders.length) {
> >> > >
> >> > >            while (index < i) {
> >> > >                // Get the folders that come before this one
> >> > >                path += folders[index] + "/";
> >> > >                index++;
> >> > >            }
> >> > >            // Reset index
> >> > >            index = 0;
> >> > >
> >> > >            path += folders[i];
> >> > >            DocumentPath newPath =
> rootFolder.createRelativePath(path);
> >> > >            int headResponse = 0;
> >> > >            try {
> >> > >                headResponse = service.executeHead(newPath);
> >> > >            } catch(Exception e) {
> >> > >                log.warn("Head: " + e.getLocalizedMessage());
> >> > >            }
> >> > >            if( headResponse == HttpServletResponse.SC_NOT_FOUND ||
> >> > > headResponse == 0 ) {
> >> > >                repositoryResponseCode =
> service.executeMkCol(newPath);
> >> > >            } else {
> >> > >                log.info("Path " + path + " not created.");
> >> > >            }
> >> > >
> >> > >            if (repositoryResponseCode >= 400) {
> >> > >                throw new ClientException("Couldn't create folder
> >> > structure
> >> > > '" + path + "'");
> >> > >            }
> >> > >            // Reset path
> >> > >            path = "";
> >> > >            i++;
> >> > >        }
> >> > >    }
> >> > >
> >> > >    /**
> >> > >     * This method creates a folder structure for a specific
> >> > >     * application. Different implementations of the class may
> >> > >     * use different folder structures.
> >> > >     *
> >> > >     * @param documentName is a documentName that the UploadContext
> >> > >     * has to create a folder structure for.
> >> > >     *
> >> > >     * @return a String representing a folder structure.
> >> > >     */
> >> > >    public abstract String createFolderStructure(String
> documentName);
> >> > > }
> >> > > ********************************************
> >> > > Hippocms-dev: Hippo CMS development public mailinglist
> >> > >
> >> > > Searchable archives can be found at:
> >> > > MarkMail: http://hippocms-dev.markmail.org
> >> > > Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
> >> > >
> >> > >
> >> >
> >> >
> >> > --
> >> >
> >> > Met vriendelijke groet,
> >> > --
> >> > Maurizio Pillitu - 0031 (0)615655668
> >> > Opensource Software Engineer
> >> > Scrum Certified Master - http://www.scrumalliance.org
> >> > Sourcesense - making sense of Open Source: http://www.sourcesense.com
> >> > ********************************************
> >> > Hippocms-dev: Hippo CMS development public mailinglist
> >> >
> >> > Searchable archives can be found at:
> >> > MarkMail: http://hippocms-dev.markmail.org
> >> > Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
> >> >
> >> >
> >> ********************************************
> >> Hippocms-dev: Hippo CMS development public mailinglist
> >>
> >> Searchable archives can be found at:
> >> MarkMail: http://hippocms-dev.markmail.org
> >> Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
> >>
> >>
> >
> >
> > --
> >
> > Met vriendelijke groet,
> > --
> > Maurizio Pillitu - 0031 (0)615655668
> > Opensource Software Engineer
> > Scrum Certified Master - http://www.scrumalliance.org
> > Sourcesense - making sense of Open Source: http://www.sourcesense.com
> > ********************************************
> > Hippocms-dev: Hippo CMS development public mailinglist
> >
> > Searchable archives can be found at:
> > MarkMail: http://hippocms-dev.markmail.org
> > Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
> >
> >
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
>
> Searchable archives can be found at:
> MarkMail: http://hippocms-dev.markmail.org
> Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
>
>


-- 

Met vriendelijke groet,
-- 
Maurizio Pillitu - 0031 (0)615655668
Opensource Software Engineer
Scrum Certified Master - http://www.scrumalliance.org
Sourcesense - making sense of Open Source: http://www.sourcesense.com
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html

Reply via email to