My bad, The exact version is: 2.0.5.R899194
I tried 2.0.5-SNAPSHOT but it broke dependency :P I will wait until CMS version updates sling. I verified that I can file upload and add mixin in two POSTs (from https://issues.apache.org/jira/browse/SLING-1703): 1. POST to file upload (creates nt:file) 2. POST to add mixin to existing nt:file. Thank you. Sam On Mon, Sep 20, 2010 at 3:49 PM, Justin Edelson <[email protected]>wrote: > The next release of Servlets Post will be 2.0.6. Until the release, the > trunk version will be 2.0.5-SNAPSHOT. This even/odd thing is mentioned > briefly here: http://sling.apache.org/site/version-policy.html > > IMHO, if someone is distributing Sling binaries, they should be > transparent about how those binaries were created including what > Subversion revision they were built from. The onus shouldn't be on the > recipient of those binaries (i.e. you in this case) to figure this out. > > Justin > > On 9/20/10 3:44 PM, sam lee wrote: > > It looks like 2.0.5 is the latest. when I build the trunk, it outputs: > > org.apache.sling.servlets.post-2.0.5-SNAPSHOT.jar > > > > Thanks > > Sam > > > > On Mon, Sep 20, 2010 at 3:39 PM, sam lee <[email protected] > > <mailto:[email protected]>> wrote: > > > > Ah, thank you so much! > > > > How is Servlets Post component versioned? > > I am trying to see if the latest Servlets Post is post 990831 or pre > > 990831. > > > > http://sling.apache.org/site/downloads.cgi > > There is Servlets Get. But, no Servlets Post. > > > > Should I compile from trunk? > > > > > http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.servlets.post-2.0.4-incubator/ > > is this the latest released version? > > > > > > On Mon, Sep 20, 2010 at 3:23 PM, Justin Edelson > > <[email protected] <mailto:[email protected]>> wrote: > > > > Support for invoking the ModifyOperation from your own operation > > can be > > tracked in SLING-1725. It will be in version 2.1.0 of the post > > servlets > > module. > > > > Incidentally, there is no release 2.0.5 of the servlets.post > module. > > 2.0.5 is a development version. Sling module releases always end > > in even > > numbers. You should ask whomever provided you with this JAR what > > revision they built it against and, assuming this was prior to > > 990831 > > (when SLING-1703 was fixed), to give you an updated build. Or > > just build > > it yourself. > > > > Justin > > > > > > On 9/20/10 3:00 PM, sam lee wrote: > > > Okay, I'm trying to extend AbstractSlingPostOperation: > > > > > > @Component(immediate = true, metatype = false) > > > @Service(value=SlingPostOperation.class) > > > @Property(name="sling.post.operation", value="myUpload") > > > public class MyUploadOperation extends > > AbstractSlingPostOperation { > > > protected void doRun(SlingHttpServletRequest request, > > HtmlResponse > > > response, List<Modification> changes) { > > > // I WANT TO CALL: ModifyOperation.doRun() > > > final Session session = > > > request.getResourceResolver().adaptTo(Session.class); > > > final String path = response.getPath(); > > > final Node node = session.getNode(path); > > > node.addMixin("my:mixin"); > > > } > > > } > > > > > > > > > when I do POST with :operation=myUpload, it does come to > > > MyUploadOperation.doRun() method. > > > But, I need to do file creation myself. > > > Is there a way to get ModifyOperation (from SlingPostServlet) > and > > > execute that object first? > > > Then, I'll get the node and add mixin. > > > > > > Or, should I extend some other class? > > > > > > I am using sling.servlets.post 2.0.5 (proprietary CMS I'm > > using has that > > > version shipped). > > > Maybe newer version already fixed adding mixins for nt:file. > > > > > > I also tried: > > > ./filename....@typehint=my:mixin > > > but that failed. > > > (from comments on: > > > > > > http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingFileUploadHandler.java > ) > > > > > > Thanks. > > > Sam > > > > > > On Fri, Sep 17, 2010 at 3:04 PM, sam lee <[email protected] > > <mailto:[email protected]> > > > <mailto:[email protected] <mailto:[email protected]>>> wrote: > > > > > > Thanks.. But it does not add jcr:mixinTypes. > > > I deleted the nt:file node and retried a few times since I > > found a > > > bug report saying that setting jcr:mixinTypes only works > > for node > > > creation, not modification.. > > > > > > I'm gonna create a servlet that handles file upload :P > > > > > > > > > > > > On Thu, Sep 16, 2010 at 2:48 PM, Justin Edelson > > > <[email protected] <mailto:[email protected]> > > <mailto:[email protected] > > <mailto:[email protected]>>> wrote: > > > > > > This should be > > > <form method="POST" action="/path/to" > > > enctype="multipart/form-data" > > > > <input type="file" name="./filename.jpg" /> > > > <input type="submit" value="upload" /> > > > <input type="hidden" name="./filename....@typehint" > > > value="nt:file" /> > > > <input type="hidden" > name="./filename.jpg/jcr:mixinTypes" > > > value="my:mixin" /> > > > </form> > > > > > > As it is below, you are setting the type of /path/to > > to nt:file, not > > > /path/to/filename.jpg. Same thing with the mixin > > declaration. > > > > > > HTH, > > > Justin > > > > > > On 9/16/10 11:24 AM, sam lee wrote: > > > > Hey, > > > > > > > > I am trying to upload a file to /path/to/filename.jpg > > > > /path/to/filename.jpg should be nt:file and have > > > jcr:mixinTypes set to > > > > my:mixin. > > > > > > > > I am trying: > > > > <form method="POST" action="/path/to" > > > enctype="multipart/form-data" > > > > > <input type="file" name="./filename.jpg" /> > > > > <input type="submit" value="upload" /> > > > > <input type="hidden" name="*...@typehint" > > value="nt:file" /> > > > > <input type="hidden" name="./jcr:mixinTypes" > > > value="my:mixin" /> > > > > </form> > > > > > > > > > > > > This is what I get: > > > > javax.jcr.nodetype.ConstraintViolationException: > > /path/to: > > > mandatory child > > > > node > > {http://www.jcp.org/jcr/1.0}content<http://www.jcp.org/jcr/1.0%7Dcontent> > > <http://www.jcp.org/jcr/1.0%7Dcontent> > > > <http://www.jcp.org/jcr/1.0%7Dcontent> does not exist > > > > > > > > What am I doing wrong? > > > > > > > > Should I create my own servlet to handle file > > uploading that > > > should be > > > > mixin? > > > > If so, is there example of file uploading servlet? > > > > > > > > Thanks. > > > > Sam > > > > > > > > > > > > > > > > > > > > >
