Examples of RequestData


Examples of com.google.appengine.tck.taskqueue.support.RequestData

        String name = "testRequestHeaders-1-" + System.currentTimeMillis();
        Queue defaultQueue = QueueFactory.getDefaultQueue();
        defaultQueue.add(withTaskName(name));
        sync();

        RequestData request = DefaultQueueServlet.getLastRequest();
        assertEquals("default", request.getHeader(QUEUE_NAME));
        assertEquals(name, request.getHeader(TASK_NAME));
        assertNotNull(request.getHeader(TASK_RETRY_COUNT));
        assertNotNull(request.getHeader(TASK_EXECUTION_COUNT));
        assertNotNull(request.getHeader(TASK_ETA));

        String name2 = "testRequestHeaders-2-" + System.currentTimeMillis();
        Queue testQueue = QueueFactory.getQueue("test");
        testQueue.add(withTaskName(name2));
        sync();

        request = TestQueueServlet.getLastRequest();
        assertEquals("test", request.getHeader(QUEUE_NAME));
        assertEquals(name2, request.getHeader(TASK_NAME));
    }
View Full Code Here

Examples of com.google.greaze.webservice.server.RequestData

    return (RestRequestSpec) spec;
  }

  public RestRequestBase<I, R> receive(HttpServletRequest request, I resourceId) {
    try {
      RequestData requestData = RequestData.create(request, spec, gson);
      @SuppressWarnings("unchecked")
      R requestBody = requestData.hasRequestBody()
        ? (R) requestData.getRequestBody().getSimpleBody() : null;
      return createRequest(requestData.getMethod(), requestData.getHeaders(),
          requestData.getUrlParams(), resourceId, requestBody, requestData.isInlined());
    } catch (IOException e) {
      throw new WebServiceSystemException(e);
    } catch (JsonParseException e) {
      // Not a Web service request
      throw new WebServiceSystemException(e);
View Full Code Here

Examples of com.google.gwt.requestfactory.shared.impl.RequestData

      // Create the request, just filling in the RequestData details
      AbstractRequest<Object> req = new AbstractRequest<Object>(
          InProcessRequestContext.this) {
        @Override
        protected RequestData makeRequestData() {
          return new RequestData(operation, actualArgs, propertyRefs,
              returnType, elementType);
        }
      };

      if (!isInstance) {
View Full Code Here

Examples of com.google.web.bindery.requestfactory.shared.impl.RequestData

      Class<?> returnType = TypeUtils.ensureBaseType(returnGenericType);
      Class<?> elementType = Collection.class.isAssignableFrom(returnType)
          ? TypeUtils.ensureBaseType(TypeUtils.getSingleParameterization(
              Collection.class, returnGenericType)) : null;

      final RequestData data;
      if (dialect.equals(Dialect.STANDARD)) {
        String operation = method.getDeclaringClass().getName() + "::"
            + method.getName();

        data = new RequestData(operation, actualArgs, returnType, elementType);
      } else {
        // Calculate request metadata
        JsonRpcWireName wireInfo = method.getReturnType().getAnnotation(
            JsonRpcWireName.class);
        String apiVersion = wireInfo.version();
        String operation = wireInfo.value();

        int foundContent = -1;
        final String[] parameterNames = args == null ? new String[0]
            : new String[args.length];
        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
        parameter : for (int i = 0, j = parameterAnnotations.length; i < j; i++) {
          for (Annotation annotation : parameterAnnotations[i]) {
            if (PropertyName.class.equals(annotation.annotationType())) {
              parameterNames[i] = ((PropertyName) annotation).value();
              continue parameter;
            } else if (JsonRpcContent.class.equals(annotation.annotationType())) {
              foundContent = i;
              continue parameter;
            }
          }
          throw new UnsupportedOperationException("No "
              + PropertyName.class.getCanonicalName()
              + " annotation on parameter " + i + " of method "
              + method.toString());
        }
        final int contentIdx = foundContent;

        data = new RequestData(operation, actualArgs, returnType, elementType);
        for (int i = 0, j = args.length; i < j; i++) {
          if (i != contentIdx) {
            data.setNamedParameter(parameterNames[i], args[i]);
          } else {
            data.setRequestContent(args[i]);
          }
          data.setApiVersion(apiVersion);
        }
      }

      // Create the request, just filling in the RequestData details
      final AbstractRequest<Object> req = new AbstractRequest<Object>(
          InProcessRequestContext.this) {
        @Override
        protected RequestData makeRequestData() {
          data.setPropertyRefs(propertyRefs);
          return data;
        }
      };

      if (!isInstance) {
View Full Code Here

Examples of com.xceptance.xlt.api.engine.RequestData

        LOG.debug(String.format(format, httpHeaders, soapMessage, messageContextProperties));
    }

    private void registerMessage(SOAPMessageContext context)
    {
        RequestData reqData = new RequestData(getOperationName(context));
        reqData.setBytesSent(0);

        context.put(XLT_REQUEST_DATA, reqData);
        context.setScope(XLT_REQUEST_DATA, MessageContext.Scope.HANDLER);
    }
View Full Code Here

Examples of org.apache.airavata.gfac.RequestData

        if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof UnicoreHostType
                || registeredHost.getType() instanceof SSHHostType) {
            logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
        } else if (registeredHost.getType() instanceof GsisshHostType) {
            String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // this is set by the framework
            RequestData requestData = new RequestData(ServerSettings.getDefaultUserGateway());
            requestData.setTokenId(credentialStoreToken);
            PBSCluster pbsCluster = null;
            GSISecurityContext context = null;
            try {
                TokenizedMyProxyAuthInfo tokenizedMyProxyAuthInfo = new TokenizedMyProxyAuthInfo(requestData);
                GsisshHostType gsisshHostType = (GsisshHostType) registeredHost.getType();
                ServerInfo serverInfo = new ServerInfo(requestData.getMyProxyUserName(), registeredHost.getType().getHostAddress(),
                        gsisshHostType.getPort());

                JobManagerConfiguration jConfig = null;
                String installedParentPath = ((HpcApplicationDeploymentType)
                        jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
View Full Code Here

Examples of org.apache.beehive.netui.tools.testrecorder.shared.RequestData

                String msg = "Failed processing file for record session( " + test.getName() + " ), file( " +
                        recFile.getAbsolutePath() + " )";
                forward( request, response, msg, Constants.ERROR_PAGE, true );
                return;
            }
            RequestData rd = bean.getRequestData( 0 );
            if ( rd == null ) {
                String msg = "Unable to find the first request in the test ( " + test.getName() + " ), file( " +
                        recFile.getAbsolutePath() + " )";
                forward( request, response, msg, Constants.ERROR_PAGE, true );
                return;
            }
            String host = config.getServer().getHostname();
            if ( host.equals( "localhost" ) )
            {
                host = request.getServerName();
            }
            response.sendRedirect( rd.getUri( host, config.getServer().getPort() ) );
            return;
        }
        catch ( Exception e ) {
            String msg = "ERROR: failed to display test details, exception( " + e.getMessage() +
                    " ), test( " + test.getName() + " )";
View Full Code Here

Examples of org.apache.jackrabbit.server.util.RequestData

            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here

Examples of org.apache.sling.engine.impl.request.RequestData

    public void doProcessRequest(final HttpServletRequest servletRequest,
            final HttpServletResponse servletResponse,
            final ResourceResolver resourceResolver) throws IOException {

        // setting the Sling request and response
        final RequestData requestData = new RequestData(this, servletRequest,
            servletResponse);
        final SlingHttpServletRequest request = requestData.getSlingRequest();
        final SlingHttpServletResponse response = requestData.getSlingResponse();

        // record the request for the web console display
        RequestHistoryConsolePlugin.recordRequest(request);

        try {
            final ServletResolver sr = this.servletResolver;

            // check that we have all required services
            if (resourceResolver == null) {
                throw new UnavailableException("ResourceResolver");
            } else if (sr == null) {
                throw new UnavailableException("ServletResolver");
            }

            // initialize the request data - resolve resource and servlet
            Resource resource = requestData.initResource(resourceResolver);
            requestData.initServlet(resource, sr);

            Filter[] filters = filterManager.getFilters(FilterChainType.REQUEST);
            if (filters != null) {
                FilterChain processor = new RequestSlingFilterChain(this,
                    filters);

                request.getRequestProgressTracker().log(
                    "Applying " + FilterChainType.REQUEST + "filters");

                processor.doFilter(request, response);

            } else {

                // no filters, directly call resource level filters and servlet
                processComponent(request, response, FilterChainType.COMPONENT);

            }

        } catch ( final SlingHttpServletResponseImpl.WriterAlreadyClosedException wace ) {
            log.error("Writer has already been closed.", wace);
        } catch (ResourceNotFoundException rnfe) {

            // send this exception as a 404 status
            log.info("service: Resource {} not found", rnfe.getResource());

            handleError(HttpServletResponse.SC_NOT_FOUND, rnfe.getMessage(),
                request, response);

        } catch (final SlingException se) {

            // if we have request data and a non-null active servlet name
            // we assume, that this is the name of the causing servlet
            if (requestData.getActiveServletName() != null) {
                request.setAttribute(ERROR_SERVLET_NAME,
                    requestData.getActiveServletName());
            }

            // send this exception as is (albeit unwrapping and wrapped
            // exception.
            Throwable t = se;
            while ( t instanceof SlingException && t.getCause() != null ) {
                t = t.getCause();
            }
            log.error("service: Uncaught SlingException", t);
            handleError(t, request, response);

        } catch (AccessControlException ace) {

            // SLING-319 if anything goes wrong, send 403/FORBIDDEN
            log.info(
                "service: Authenticated user {} does not have enough rights to executed requested action",
                request.getRemoteUser());
            handleError(HttpServletResponse.SC_FORBIDDEN, null, request,
                response);

        } catch (UnavailableException ue) {

            // exception is thrown before the SlingHttpServletRequest/Response
            // is properly set up due to missing dependencies. In this case
            // we must not use the Sling error handling infrastructure but
            // just return a 503 status response handled by the servlet
            // container environment

            final int status = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
            final String errorMessage = ue.getMessage()
                + " service missing, cannot service requests";
            log.error("{} , sending status {}", errorMessage, status);
            servletResponse.sendError(status, errorMessage);

        } catch (IOException ioe) {

            // forward IOException up the call chain to properly handle it
            throw ioe;

        } catch (Throwable t) {

            // if we have request data and a non-null active servlet name
            // we assume, that this is the name of the causing servlet
            if (requestData.getActiveServletName() != null) {
                request.setAttribute(ERROR_SERVLET_NAME,
                    requestData.getActiveServletName());
            }

            log.error("service: Uncaught Throwable", t);
            handleError(t, request, response);
View Full Code Here

Examples of org.apache.sling.engine.impl.request.RequestData

        // to continue
        SlingHttpServletRequest cRequest = RequestData.toSlingHttpServletRequest(request);
        SlingHttpServletResponse cResponse = RequestData.toSlingHttpServletResponse(response);

        // get the request data (and btw check the correct type)
        final RequestData requestData = RequestData.getRequestData(cRequest);
        final ContentData oldContentData = requestData.getContentData();
        final ContentData contentData = requestData.setContent(resource, resolvedURL);

        try {
            // resolve the servlet
            Servlet servlet = servletResolver.resolveServlet(cRequest);
            contentData.setServlet(servlet);

            FilterChainType type = include
                    ? FilterChainType.INCLUDE
                    : FilterChainType.FORWARD;

            processComponent(cRequest, cResponse, type);
        } finally {
            requestData.resetContent(oldContentData);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.