Examples of ResponseImpl


Examples of org.apache.clerezza.triaxrs.mock.ResponseImpl

        RequestURIImpl uri = new RequestURIImpl();
        uri.setPath("/test-resource/blabla");
        request.setRequestURI(uri);
        request.setMethod(Method.GET);
       
        ResponseImpl response = new ResponseImpl();
       

        handler.handle(request, response);
    assertEquals(ResponseStatus.NOT_FOUND, response.getStatus());
       
       
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.impl.ResponseImpl

                                  Message message,
                                  Response theResponse,
                                  OperationResourceInfo ori,
                                  boolean firstTry) {
       
        ResponseImpl response = (ResponseImpl)JAXRSUtils.copyResponseIfNeeded(theResponse);
       
        final Exchange exchange = message.getExchange();
       
        boolean headResponse = response.getStatus() == 200 && firstTry
            && ori != null && HttpMethod.HEAD.equals(ori.getHttpMethod());
        Object entity = response.getActualEntity();
        if (headResponse && entity != null) {
            LOG.info(new org.apache.cxf.common.i18n.Message("HEAD_WITHOUT_ENTITY", BUNDLE).toString());
            entity = null;
        }
              
              
        Method invoked = ori == null ? null : ori.getAnnotatedMethod() != null
            ? ori.getAnnotatedMethod() : ori.getMethodToInvoke();
       
        Annotation[] annotations = null;
        Annotation[] staticAnns = invoked != null ? invoked.getAnnotations() : new Annotation[]{};
        Annotation[] responseAnns = response.getEntityAnnotations();
        if (responseAnns != null) {
            annotations = new Annotation[staticAnns.length + responseAnns.length];
            System.arraycopy(staticAnns, 0, annotations, 0, staticAnns.length);
            System.arraycopy(responseAnns, 0, annotations, staticAnns.length, responseAnns.length);
        } else {
            annotations = staticAnns;
        }
       
        response.setStatus(getActualStatus(response.getStatus(), entity));
        response.setEntity(entity, annotations);
       
        // Prepare the headers
        MultivaluedMap<String, Object> responseHeaders = response.getMetadata();
        Map<String, List<Object>> userHeaders =
            (Map<String, List<Object>>)message.get(Message.PROTOCOL_HEADERS);
        if (firstTry && userHeaders != null) {
            responseHeaders.putAll(userHeaders);
        }
        if (entity != null) {
            String initialResponseContentType = (String)message.get(Message.CONTENT_TYPE);
            if (initialResponseContentType != null && !responseHeaders.containsKey(HttpHeaders.CONTENT_TYPE)) {
                responseHeaders.putSingle(HttpHeaders.CONTENT_TYPE, initialResponseContentType);
            }
        } else {
            message.remove(Message.CONTENT_TYPE);
        }
       
        message.put(Message.PROTOCOL_HEADERS, responseHeaders);
       
        setResponseDate(responseHeaders, firstTry);
              
        // Run the filters
        try {
            JAXRSUtils.runContainerResponseFilters(providerFactory, response, message, ori, invoked);
        } catch (IOException ex) {
            handleWriteException(providerFactory, message, ex, firstTry);
            return;
        } catch (Throwable ex) {
            handleWriteException(providerFactory, message, ex, firstTry);
            return;
        }
  
        // Write the entity
        entity = InjectionUtils.getEntity(response.getActualEntity());
        setResponseStatus(message, getActualStatus(response.getStatus(), entity));
        if (entity == null) {
            if (!headResponse) {
                responseHeaders.putSingle(HttpHeaders.CONTENT_LENGTH, "0");
                responseHeaders.remove(HttpHeaders.CONTENT_TYPE);
                message.remove(Message.CONTENT_TYPE);
            }
            HttpUtils.convertHeaderValuesToString(responseHeaders, true);
            return;
        }
       
        Object ignoreWritersProp = exchange.get(JAXRSUtils.IGNORE_MESSAGE_WRITERS);
        boolean ignoreWriters =
            ignoreWritersProp == null ? false : Boolean.valueOf(ignoreWritersProp.toString());
        if (ignoreWriters) {
            writeResponseToStream(message.getContent(OutputStream.class), entity);
            return;
        }
       
        MediaType responseMediaType =
            getResponseMediaType(responseHeaders.getFirst(HttpHeaders.CONTENT_TYPE));
       
        Class<?> serviceCls = invoked != null ? ori.getClassResourceInfo().getServiceClass() : null;
        Class<?> targetType = InjectionUtils.getRawResponseClass(entity);
        Type genericType = InjectionUtils.getGenericResponseType(invoked, serviceCls,
                                                                 response.getActualEntity(), targetType, exchange);
        targetType = InjectionUtils.updateParamClassToTypeIfNeeded(targetType, genericType);
        annotations = response.getEntityAnnotations();       
       
        List<WriterInterceptor> writers = providerFactory
            .createMessageBodyWriterInterceptor(targetType, genericType, annotations, responseMediaType, message,
                                                ori == null ? null : ori.getNameBindings());
       
View Full Code Here

Examples of org.apache.tapestry.internal.services.ResponseImpl

            public boolean service(HttpServletRequest request, HttpServletResponse response)
                    throws IOException
            {
                _requestGlobals.store(request, response);

                return handler.service(new RequestImpl(request), new ResponseImpl(response));
            }
        };

        return _pipelineBuilder.build(
                log,
View Full Code Here

Examples of org.apache.tapestry5.internal.services.ResponseImpl

        final String[] HEADER_VALUES = {"asdfasdf", "FHDFGH", "####"};
       
        final HttpServletResponse httpServletResponse = mockHttpServletResponse();
        final HttpServletRequest httpServletRequest = mockHttpServletRequest();
       
        Response response = new ResponseImpl(httpServletRequest, httpServletResponse);
        for (String value : HEADER_VALUES)
        {
            httpServletResponse.addHeader(HEADER_NAME, value);
        }
       
        replay();
   
        for (String value : HEADER_VALUES)
        {
            response.addHeader(HEADER_NAME, value);
        }
       
        verify();
       
    }
View Full Code Here

Examples of org.exist.debugger.dbgp.ResponseImpl

   
    Thread session = new Thread(new HttpSession(this, url));
    session.start();

    // 30s timeout
    ResponseImpl response = (ResponseImpl) getResponse("init", 30 * 1000);
    setSession(response.getSession());

    // TODO: fileuri as constant???
    return getSource(response.getAttribute("fileuri"));
  }
View Full Code Here

Examples of railo.runtime.cfx.ResponseImpl

    }
        catch (CFXTagException e) {
      throw Caster.toPageException(e);
    }
    Request req=new RequestImpl(pageContext,attributes);
    Response rsp=new ResponseImpl(pageContext,req.debug());
    try {
      ct.processRequest(req,rsp);
    } catch (Exception e) {
      throw Caster.toPageException(e);
    }
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.