Package org.wymiwyg.rwcf.form

Examples of org.wymiwyg.rwcf.form.MultiPartBody


   */
 
  protected void setItemOrTopicProperties(Resource itemOrTopic, EnhancedRequest request)
      throws HandlerException {
    //get request body
    MultiPartBody requestBody = (MultiPartBody) request.getBody();
    // URL baseURL = new URL(target.getURI());
    URL baseURL = request.getRequestURLWithoutParams();
    String uri = requestBody.getParameter("uri");
    if (uri != null) {
      try {
        //try to create a new resource itemOrTopic
        itemOrTopic = model.createResource(new URL(baseURL, uri).toString());
      } catch (MalformedURLException e) {
        throw new HandlerException(e);
      }
    }
   
    //retrieve parameters from body:
   
    String language = requestBody.getParameter("language");
    String title = requestBody.getParameter("title");
    String summary = requestBody.getParameter("description");
    if (!"yes".equals(requestBody.getParameter("custom_summary"))) {
      summary = null;
    }
    String creator = requestBody.getParameter("creator");
    String date = requestBody.getParameter("date");
    String content = requestBody.getParameter("body");
   
    String[] permissions = requestBody.getParameterValues("permission");
    String[] maxShowInlineLength = requestBody.getParameterValues("maxShowInlineLength");
    if ((maxShowInlineLength != null) && (maxShowInlineLength.length > 0)) {
      Literal maxShowInlineLengthLiteral = model.createTypedLiteral(maxShowInlineLength[0], XSDDatatype.XSDdecimal);
      itemOrTopic.removeAll(KNOBOT.maxShowInlineLength);
      itemOrTopic.addProperty(KNOBOT.maxShowInlineLength, maxShowInlineLengthLiteral);
    }
    addPermissions(itemOrTopic, permissions);
    //shop
    boolean shop = "checked".equals(requestBody.getParameter("shop"));
    String priceString = requestBody.getParameter("price");
    String articleID = requestBody.getParameter("articleID");
    boolean commentable = "yes"
        .equals(requestBody.getParameter("comments"));
    float price = 0;
    if ((priceString != null) && (!priceString.equals(""))) {
      price = Float.parseFloat(priceString);
    }
   
    //custom shipping costs parameter (has to be float):
    String customShippingCostsString = requestBody.getParameter("customShippingCosts");
    String useDefaultShippingCosts = requestBody.getParameter("useShippingCosts");
    float customShippingCosts = 0;
    if ((customShippingCostsString != null) && (!customShippingCostsString.equals(""))) {
      customShippingCosts = Float.parseFloat(customShippingCostsString);
    }
   
View Full Code Here


              && (!path.startsWith("/layout"))
              && (!path.startsWith("/languageSetter"))
              && (!path.startsWith("/scripts"))
              && (!path.startsWith("/images"))) {
            if (request.getMethod().equals(Method.POST)) {
              MultiPartBody body = (MultiPartBody) request
                  .getBody();
              String canonicalBase = "yes".equals(body
                  .getParameter("existing")) ? body
                  .getParameter("existingCanonicalBase")
                  : body.getParameter("newCanonicalBase");
              // model.leaveCriticalSection();
              try {
                model.enterCriticalSection(ModelLock.WRITE);
                Resource newCanonicalizer = model
                    .createResource(HOSTCANONICALIZER.Canonicalizer);
View Full Code Here

public class RedirectionsEditPostHandler implements Handler {

  private Model model;

  public void handle(Request request, Response response, HandlerChain chain) throws HandlerException {
    MultiPartBody body = (MultiPartBody) request.getBody();
    String target = body.getParameter("target");
    String statusCode = body.getParameter("statusCode");
    String redirectionURI = body.getParameter("redirectionURI");
    Resource redirectionResource = model.getResource(redirectionURI);
    redirectionResource.removeAll(REDIRECTIONS.target);
    redirectionResource.removeAll(REDIRECTIONS.statusCode);   
    Resource targetResource = model.getResource(target);
    redirectionResource.addProperty(REDIRECTIONS.target, targetResource);
View Full Code Here

  /**
   * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  protected void doPost(Request req, Response resp) throws HandlerException {
    MultiPartBody body = (MultiPartBody) req.getBody();
    String accessURL = body.getParameter("access");
    String action = body.getParameter("action");
    String canonicalURL = body.getParameter("canonical");
    if (action.equals("register")) {
      Resource participant = model
          .createResource(HOSTCANONICALIZER.Canonicalizer);
      participant.addProperty(HOSTCANONICALIZER.accessURLBase, model
          .createResource(accessURL));
View Full Code Here

   * @throws HandlerException
   */
  public static void handleFormFiles(URL baseURL, Model importing,
      Request request, Model model, HashStore hashStore)
      throws HandlerException {
    MultiPartBody body = (MultiPartBody) request.getBody();
    NodeIterator objects = importing.listObjects();
    Map uploadedFiles = null;
    Set processingRes = new HashSet();
    while (objects.hasNext()) {
      RDFNode currentNode = objects.nextNode();
View Full Code Here

     *      org.wymiwyg.rwcf.Response, org.wymiwyg.rwcf.HandlerChain)
     */
    public void handle(Request request, Response response, HandlerChain chain)
            throws HandlerException {
        EnhancedRequest ehRequest = new EnhancedRequest(request);
        MultiPartBody body = (MultiPartBody) request.getBody();
        String serializedModel = body.getParameter("model");
        Model importing = ModelFactory.createDefaultModel();
        importing.read(new StringReader(serializedModel), ehRequest
                .getRequestURLWithoutParams().toString(), "RDF/XML");  
        FormModelPost.handleFormFiles(ehRequest.getRootURL(), importing,
                request, model, hashStore);
View Full Code Here

   * @see org.wymiwyg.rwcf.Handler#handle(org.wymiwyg.wrhapi.Request,
   *      org.wymiwyg.rwcf.Response, org.wymiwyg.rwcf.HandlerChain)
   */
  public void handle(Request request, Response response, HandlerChain chain)
      throws HandlerException {
    MultiPartBody body = (MultiPartBody) request.getBody();
    String uriNew = body.getParameter("uri_new");
    String uriOrig = body.getParameter("uri_orig");
    String label = body.getParameter("label");
    String comment = body.getParameter("comment");
    if (uriOrig != null) {
      Resource resOrig = model.getResource(uriOrig);
      if (uriNew != null) {
        Resource permission = model.getResource(uriOrig);
        JenaUtil.replace(model, resOrig, permission);
View Full Code Here

  public void handle(Request request, Response response, HandlerChain chain)
      throws HandlerException {
    Resource target = model.createResource(new EnhancedRequest(request)
        .getRequestURLWithoutParams().toString());
    try {
      MultiPartBody body;
      body = (MultiPartBody) request.getBody();
      String contentType = body.getParameter("contentType");
      String contentURI = body.getParameter("contentURI");
      if (body.getParameter("action_remove") != null) {
        removeVariant(target, contentURI, contentType);
      }
    } catch (ClassCastException e) {
    }
    chain.doNext(request, response);
View Full Code Here

      HandlerChain chain) throws HandlerException {
    Resource target = model.createResource(new EnhancedRequest(request)
        .getRequestURLWithoutParams().toString());

    try {
      MultiPartBody body;
      body = (MultiPartBody) request.getBody();
      if (body.getParameter("action_upload") != null) {
        createDocument(target, body, "file");
      }
    } catch (ClassCastException e) {
    }
    chain.doNext(request, response);
View Full Code Here

   * @param request
   * @param response
   * @throws HandlerException
   */
  private void hanlePost(Request request, Response response) throws HandlerException {
    MultiPartBody body = (MultiPartBody)request.getBody();
    String username = body.getParameter("username");
    String password = body.getParameter("password");
    String firstName = body.getParameter("firstName");
    String lastName = body.getParameter("lastName");
    String separator = lastName.equals("") ||  firstName.equals("") ? "" : " ";
    String name = firstName+separator+lastName;
    String mbox = body.getParameter("mbox");
    String foafURL = body.getParameter("foafURL");
    String canonicalBase = body.getParameter("canonicalBase");
    if (canonicalBase.charAt(canonicalBase.length()-1) != '/') {
      canonicalBase += '/';
    }
    model.leaveCriticalSection();
    model.enterCriticalSection(ModelLock.WRITE);
View Full Code Here

TOP

Related Classes of org.wymiwyg.rwcf.form.MultiPartBody

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.