Package org.wymiwyg.rwcf.util

Examples of org.wymiwyg.rwcf.util.EnhancedResponse


                // model.enterCriticalSection(ModelLock.READ);
              }
              loadCache();
              response
                  .setResponseStatus(ResponseStatus.MOVED_TEMPORARILY);
              new EnhancedResponse(response).sendRedirect(request
                  .getRequestURI().toString());
              return;
            }

            request = new InvalidHostErrorPageRequest(
View Full Code Here


        result.append(':');
        result.append(port);
      }
    }
    result.append(request.getRequestURI().toString());
    EnhancedResponse ehResponse = new EnhancedResponse(response);
    ehResponse.sendRedirect(result.toString());
  }
View Full Code Here

    redirectionResource.removeAll(REDIRECTIONS.statusCode);   
    Resource targetResource = model.getResource(target);
    redirectionResource.addProperty(REDIRECTIONS.target, targetResource);
    Literal statusLiteral = model.createTypedLiteral(Integer.parseInt(statusCode));
    redirectionResource.addProperty(REDIRECTIONS.statusCode, statusLiteral);
    new EnhancedResponse(response).sendRedirect(redirectionURI+"?mode=edit");
  }
View Full Code Here

  /**
   * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  protected void doGet(Request req, Response rawResp) throws HandlerException {
    EnhancedResponse resp = new EnhancedResponse(rawResp);
    resp.setHeader(HeaderName.CONTENT_TYPE, "text/html");
    PrintWriter out = resp.getWriter();
    ResIterator canonicalizers = model.listSubjectsWithProperty(RDF.type,
        HOSTCANONICALIZER.Canonicalizer);
    out.println("<html><body>");
    out.println("<h2>HOST-Canonicalizer:</h2>");
    out.println("<table>");
View Full Code Here

  /* (non-Javadoc)
   * @see org.wymiwyg.rwcf.Handler#handle(org.wymiwyg.rwcf.Request, org.wymiwyg.rwcf.Response, org.wymiwyg.rwcf.HandlerChain)
   */
  public void handle(Request request, Response response, HandlerChain chain) throws HandlerException {
    PrintWriter out = new EnhancedResponse(response).getWriter();
    printHeader(out);
    ResIterator users = model.listSubjectsWithProperty(AUTHORIZATION.shortName);
      //model.listSubjectsWithProperty(RDF.type, AUTHORIZATION.User);
    while (users.hasNext()) {
      printTemplate(out, users.nextResource());
View Full Code Here

            || (path.startsWith("/images/"))
            || (path.startsWith("/scripts/"))) {
          chain.doNext(request, response);
          return;
        }
        EnhancedResponse ehResponse = new EnhancedResponse(response);
        ehResponse.sendRedirect("/admin/initial-configuration");
        return;
      }
    }
    try {
     
      try {
        httpLoginForced = request.getRequestURI().getParameterValues(
            "forceHttpLogin")[0].equals("true");
      } catch (Exception ex) {
      }
      CallbackHandler callbackHandler;
      if (useCookieLogin && !httpLoginForced) {
        callbackHandler = new CookieCallBackHandler(ehRequest, response);
      } else {
        callbackHandler = new WebCallBackHandler(request);
      }

      loginContext = new LoginContext(servletContextName, callbackHandler);
    } catch (LoginException e) {
      logger.error("Initializing LoginContext", e);
      throw new RuntimeException(e.toString());
    }
    try {
      loginContext.login();

    } catch (LoginException e) {

    }
    try {
      Subject subject = loginContext.getSubject();
      Subject.doAsPrivileged(subject, new PrivilegedExceptionAction() {
        public Object run() throws Exception {
          // setting the policy only in the init method causes the
          // current ProtectionDomain to
          // be cached, i.E. all checks from classes within the
          // current classpath entry to authorized
          Policy.setPolicy(new RPolicy());
          boolean isAdmin = false;
          try {
            AccessController.checkPermission(new RPermission(
                AUTHORIZATION.admin));
            isAdmin = true;
          } catch (Exception e) {
          }
          if (!isAdmin) {
            AccessControlFilter.checkPermssionOnResource(model
                .createResource(ehRequest
                    .getRequestURLWithoutParams()
                    .toString()));
          }
          Request requestNoLoginParam = checkLoginRequested(request);
          chain.doNext(requestNoLoginParam, response);
          return null;
        }
      }, null);
    } catch (AccessControlException e) {
      // Authentication failed.
      logger.debug("AccessControlException, will prompt for login", e);
      if (useCookieLogin  && !httpLoginForced
          && !ehRequest.getMethod().equals(Method.POST)
          && !ehRequest.getMethod().equals(Method.PUT)
          && !ehRequest.getMethod().equals(Method.MKCOL)
          && !ehRequest.getMethod().equals(Method.PROPFIND)) {
        EnhancedResponse ehResponse = new EnhancedResponse(response);
        try {
          ehResponse.sendRedirect("/login?target="
              + URLEncoder.encode(ehRequest.getFullRequestURL()
                  .toString(), "utf-8"));
        } catch (UnsupportedEncodingException e1) {
          throw new RuntimeException(e1);
        }
View Full Code Here

    Resource defaults = model.createResource("urn://wymiwyg.org/knobot/defaults");
    Property notEmail = model
    .createProperty("urn://wymiwyg.org/knobot/default/notificationEmail");
    defaults.removeAll(notEmail);
    defaults.addProperty(notEmail, model.createResource(mbox));
    EnhancedResponse ehResponse = new EnhancedResponse(response);
    ehResponse.sendRedirect("/?login=any");
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.wymiwyg.rwcf.Handler#handle(org.wymiwyg.rwcf.Request, org.wymiwyg.rwcf.Response, org.wymiwyg.rwcf.HandlerChain)
   */
  public void handle(Request request, Response response, HandlerChain chain) throws HandlerException {

    EnhancedResponse resp = new EnhancedResponse(response);
    PrintWriter out = resp.getWriter();
    String subjectString = request.getRequestURI().getParameterValues("subject")[0];
    String predicateString = request.getRequestURI().getParameterValues("predicate")[0];
    String objectString = request.getRequestURI().getParameterValues("object")[0];
    Resource subject;
    Property predicate;
View Full Code Here

     * AUTHORIZATION.Permission); permission.removeAll(RDFS.comment); if
     * (!comment.equals("")) { permission.addProperty(RDFS.comment,
     * comment); } permission.removeAll(RDFS.label); if (!label.equals("")) {
     * permission.addProperty(RDFS.label, label); } }
     */
    EnhancedResponse ehResponse = new EnhancedResponse(response);
    String go = body.getParameter("go");
    if (go == null) {
      String[] referers = request.getHeaderValues(HeaderName.REFERER);
      if (referers.length == 0) {
        throw new HandlerException("no 'go' parameter specified and no htpp-referer found");
      }
      go =referers[0] ;
    }
    ehResponse.sendRedirect(go);

  }
View Full Code Here

        .getRootURL());
    String go = body.getParameter("go");
    if (go == null) {
      go = source.getURI();
    }
    new EnhancedResponse(response).sendRedirect(go);
  }
View Full Code Here

TOP

Related Classes of org.wymiwyg.rwcf.util.EnhancedResponse

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.