Package org.wymiwyg.wrhapi.util

Examples of org.wymiwyg.wrhapi.util.EnhancedRequest


  }

  public void handlePost(Request request, Response response,
      HandlerChain chain) throws HandlerException {
    Resource target = model.createResource(new EnhancedRequest(request)
        .getRequestURLWithoutParams().toString());

    try {
      MultiPartBody body;
      body = (MultiPartBody) request.getBody();
View Full Code Here


            throws HandlerException {
        if (log.isDebugEnabled()) {
            log.debug("starting getBestHandlerChain at "
                    + System.currentTimeMillis());
        }
        EnhancedRequest ehRequest = new EnhancedRequest(request);
        Iterator<AcceptHeaderEntry> acceptIter = ehRequest.getAccept();
        HandlerChainImpl currentBestChain = null;
        /*
         * Resource requestedResource = model.getResource(ehRequest
         * .getFullRequestURL().toString());
         */
        Resource requestedResource = model.getResource(ehRequest
                .getRequestURLWithoutParams().toString());
        if (!acceptIter.hasNext()) {
            currentBestChain = getHandlerChain(request, new AcceptHeaderEntry(
                    defaultMediaRange, 1), requestedResource,
                    authorizationInfo, ignoreAuthorization);
View Full Code Here

                languagesForCookie.add(replaceLang[i]);

            }
        }
        if (languagesForCookie.size() == 0) {
            AcceptLanguagesIterator iterator = new EnhancedRequest(request)
                    .getAcceptLanguages();
            while (iterator.hasNext()) {
                languagesForCookie.add(iterator.nextAcceptLanguageHeader()
                        .getLocaleRange().getLocale().getLanguage());
            }
View Full Code Here

    } else {
      Model resultModel = ModelFactory.createDefaultModel();
      Resource transaction = resultModel
          .createResource(TRANSACTION.Transaction);
      transaction.addProperty(DC.description,
          new EnhancedRequest(request).getRootURL().toString());
      response.setBody(resultModel);
    }

  }
View Full Code Here

    ResIterator permissions = model.listSubjectsWithProperty(RDF.type, AUTHORIZATION.Permission);
    while (permissions.hasNext()) {
      Resource current = permissions.nextResource();
      resultModel.add(JenaUtil.getExpandedResource(current,3));
    }
    EnhancedRequest ehRequest = new EnhancedRequest(request);
    LanguageChooser.addLanguageSeq(ehRequest, model, resultModel);
    response.setBody(resultModel);

  }
View Full Code Here

     * @return
     * @throws HandlerException
     */
    private Resource getCookieSubject(Request request) throws HandlerException {
        Resource result = null;
        EnhancedRequest ehRequest = new EnhancedRequest(request);
        Cookie[] cookies = ehRequest.getCookies();
        Cookie cookie = null;
        if (cookies != null) {
            for (int i = 0; i < cookies.length; i++) {
                if (cookies[i].getName().equals("temp_user") && !cookies[i].getValue().equals("")) {
                    cookie = cookies[i];
View Full Code Here

   */
  public void handle(Request request, Response response, HandlerChain chain)
      throws HandlerException {
    Response responseWrapper;
    MimeType targetType = getPrefferedTarget(request);
    responseWrapper = new ResponseWrapper(response, new EnhancedRequest(request), targetType, localized);
    Request requestWrapper = new RequestWrapper(request,
        "application/java-instance?class=com.hp.hpl.jena.rdf.model.Model");
    chain.doNext(requestWrapper, responseWrapper);
    log.info("resourcemodeler returning");
  }
View Full Code Here

     * @param defaultMediaRange2
     * @return
     */
    HandlerChainImpl getHandlerChain(Request request)
            throws HandlerException {
        Resource requestedResource = model.getResource(new EnhancedRequest(
                request).getRequestURLWithoutParams().toString()); //getFullRequestURL().toString());
        HandlerChainImpl result = new HandlerChainImpl(model, 1, true, false);
        for (int i = 0; i < handlerDescriptors.length; i++) {
            HandlerDescriptor current = handlerDescriptors[i];
            if (match(current, request, requestedResource).success()) {
View Full Code Here

    chain.doNext(requestWrapper, responseWrapper);
    log.info("resourcemodeler returning");
  }
  private MimeType getPrefferedTarget(Request request) throws HandlerException {
    String[] acceptHeaderValues = request.getHeaderValues(HeaderName.ACCEPT);
    Iterator<AcceptHeaderEntry> acceptIter = new EnhancedRequest(request).getAccept();
    while (acceptIter.hasNext()) {
      AcceptHeaderEntry range = acceptIter.next();
      Iterator producedTargetIter = targetTypeSet.iterator();
      while (producedTargetIter.hasNext()) {
        MimeType currentTarget = (MimeType) producedTargetIter.next();
View Full Code Here

    //    } catch (IOException e) {
    //      throw new HandlerException(e);
    //    }
    //    super.setBody(in);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    final String baseURL = new EnhancedRequest(request).getFullRequestURL()
        .toString();
    try {
      SerializerInvoker.serialize((Model) body, null, baseURL, locales,
          handler, targetType, "utf-8", forceShow, out);
      out.flush();     
View Full Code Here

TOP

Related Classes of org.wymiwyg.wrhapi.util.EnhancedRequest

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.