Package org.mortbay.jetty

Examples of org.mortbay.jetty.HttpFields$Field


        long length=resource.length();
       
        if (response instanceof Response)
        {
            HttpFields fields = ((Response)response).getHttpFields();

            if (length>0)
                fields.putLongField(HttpHeaders.CONTENT_LENGTH_BUFFER,length);
               
            if (_cacheControl!=null)
                fields.put(HttpHeaders.CACHE_CONTROL_BUFFER,_cacheControl);
        }
        else
        {
            if (length>0)
                response.setHeader(HttpHeaders.CONTENT_LENGTH,TypeUtil.toString(length));
View Full Code Here


                EasyMock.expect(request.getQueryString()).andReturn(query);   
                EasyMock.expect(request.getHeader("Accept")).andReturn("*/*")
                EasyMock.expect(request.getContentType()).andReturn("text/xml charset=utf8").times(2);
                EasyMock.expect(request.getAttribute("org.mortbay.jetty.ajax.Continuation")).andReturn(null);
               
                HttpFields httpFields = new HttpFields();
                httpFields.add("content-type", "text/xml");
                httpFields.add("content-type", "charset=utf8");
                httpFields.put(JettyHTTPDestinationTest.AUTH_HEADER, JettyHTTPDestinationTest.BASIC_AUTH);
               
                EasyMock.expect(request.getHeaderNames()).andReturn(httpFields.getFieldNames());
                request.getHeaders("content-type");
                EasyMock.expectLastCall().andReturn(httpFields.getValues("content-type"));
                request.getHeaders(JettyHTTPDestinationTest.AUTH_HEADER);
                EasyMock.expectLastCall().andReturn(
                    httpFields.getValues(JettyHTTPDestinationTest.AUTH_HEADER));
                
                EasyMock.expect(request.getInputStream()).andReturn(is);
                request.setHandled(true);
                EasyMock.expectLastCall()
                response.flushBuffer();
View Full Code Here

            response.setContentType(content.getContentType().toString());
       
        if (response instanceof Response)
        {
            Response r=(Response)response;
            HttpFields fields = r.getHttpFields();

            if (content.getLastModified()!=null
                fields.put(HttpHeaders.LAST_MODIFIED_BUFFER,content.getLastModified(),content.getResource().lastModified());
            else if (content.getResource()!=null)
            {
                long lml=content.getResource().lastModified();
                if (lml!=-1)
                    fields.putDateField(HttpHeaders.LAST_MODIFIED_BUFFER,lml);
            }
               
            if (count != -1)
                r.setLongContentLength(count);

            if (_acceptRanges)
                fields.put(HttpHeaders.ACCEPT_RANGES_BUFFER,HttpHeaderValues.BYTES_BUFFER);

            if (_cacheControl!=null)
                fields.put(HttpHeaders.CACHE_CONTROL_BUFFER,_cacheControl);
           
        }
        else
        {
            long lml=content.getResource().lastModified();
View Full Code Here

        long length=resource.length();
       
        if (response instanceof Response)
        {
            HttpFields fields = ((Response)response).getHttpFields();

            if (length>0)
                fields.putLongField(HttpHeaders.CONTENT_LENGTH_BUFFER,length);
               
            if (_cacheControl!=null)
                fields.put(HttpHeaders.CACHE_CONTROL_BUFFER,_cacheControl);
        }
        else
        {
            if (length>0)
                response.setHeader(HttpHeaders.CONTENT_LENGTH,TypeUtil.toString(length));
View Full Code Here

  @SuppressWarnings( "unchecked" )
  public void finish()
  {
    if( mockRequest.getHttpResponse() instanceof org.mortbay.jetty.Response )
    {
      HttpFields httpFields = ( ( org.mortbay.jetty.Response )mockRequest.getHttpResponse() ).getHttpFields();

      Enumeration<String> e = httpFields.getFieldNames();
      while( e.hasMoreElements() )
      {
        String nextElement = e.nextElement();
        responseHeaders.add( nextElement, httpFields.getStringField( nextElement ) );
      }
    }
  }
View Full Code Here

            response.setContentType(content.getContentType().toString());
       
        if (response instanceof Response)
        {
            Response r=(Response)response;
            HttpFields fields = r.getHttpFields();

            if (content.getLastModified()!=null
                fields.put(HttpHeaders.LAST_MODIFIED_BUFFER,content.getLastModified(),content.getResource().lastModified());
            else if (content.getResource()!=null)
            {
                long lml=content.getResource().lastModified();
                if (lml!=-1)
                    fields.putDateField(HttpHeaders.LAST_MODIFIED_BUFFER,lml);
            }
               
            if (count != -1)
                r.setLongContentLength(count);
View Full Code Here

        private String responseStatusText;
        private HttpFields responseFields;

        public XMLHttpRequestExchange(Scriptable thiz, Function function, String method, String url)
        {
            responseFields=new HttpFields();
            this.thiz = thiz;
            this.function = function;
            setMethod(method == null ? "GET" : method.toUpperCase());
            setURL(url);
            aborted = false;
View Full Code Here

                EasyMock.expect(request.getPathInfo()).andReturn("/foo");
                EasyMock.expect(request.getCharacterEncoding()).andReturn("UTF-8");
                EasyMock.expect(request.getQueryString()).andReturn(query);           
                EasyMock.expect(request.getContentType()).andReturn("text/xml charset=utf8");
               
                HttpFields httpFields = new HttpFields();
                httpFields.add("content-type", "text/xml");
                httpFields.add("content-type", "charset=utf8");
                httpFields.put(JettyHTTPDestinationTest.AUTH_HEADER, JettyHTTPDestinationTest.BASIC_AUTH);
               
                EasyMock.expect(request.getHeaderNames()).andReturn(httpFields.getFieldNames());
                request.getHeaders("content-type");
                EasyMock.expectLastCall().andReturn(httpFields.getValues("content-type"));
                request.getHeaders(JettyHTTPDestinationTest.AUTH_HEADER);
                EasyMock.expectLastCall().andReturn(
                    httpFields.getValues(JettyHTTPDestinationTest.AUTH_HEADER));
                
                EasyMock.expect(request.getInputStream()).andReturn(is);
                request.setHandled(true);
                EasyMock.expectLastCall()
                response.flushBuffer();
View Full Code Here

                EasyMock.expect(request.getCharacterEncoding()).andReturn("UTF-8");
                EasyMock.expect(request.getQueryString()).andReturn(query);   
                EasyMock.expect(request.getHeader("Accept")).andReturn("*/*")
                EasyMock.expect(request.getContentType()).andReturn("text/xml charset=utf8");
               
                HttpFields httpFields = new HttpFields();
                httpFields.add("content-type", "text/xml");
                httpFields.add("content-type", "charset=utf8");
                httpFields.put(JettyHTTPDestinationTest.AUTH_HEADER, JettyHTTPDestinationTest.BASIC_AUTH);
               
                EasyMock.expect(request.getHeaderNames()).andReturn(httpFields.getFieldNames());
                request.getHeaders("content-type");
                EasyMock.expectLastCall().andReturn(httpFields.getValues("content-type"));
                request.getHeaders(JettyHTTPDestinationTest.AUTH_HEADER);
                EasyMock.expectLastCall().andReturn(
                    httpFields.getValues(JettyHTTPDestinationTest.AUTH_HEADER));
                
                EasyMock.expect(request.getInputStream()).andReturn(is);
                request.setHandled(true);
                EasyMock.expectLastCall()
                response.flushBuffer();
View Full Code Here

                EasyMock.expect(request.getContextPath()).andReturn("/bar");
                EasyMock.expect(request.getPathInfo()).andReturn("/foo");
                EasyMock.expect(request.getQueryString()).andReturn(query);           
                EasyMock.expect(request.getContentType()).andReturn("text/xml charset=utf8");
               
                HttpFields httpFields = new HttpFields();
                httpFields.add("content-type", "text/xml");
                httpFields.add("content-type", "charset=utf8");
                httpFields.put(JettyHTTPDestinationTest.AUTH_HEADER, JettyHTTPDestinationTest.BASIC_AUTH);
               
                EasyMock.expect(request.getHeaderNames()).andReturn(httpFields.getFieldNames());
                request.getHeaders("content-type");
                EasyMock.expectLastCall().andReturn(httpFields.getValues("content-type"));
                request.getHeaders(JettyHTTPDestinationTest.AUTH_HEADER);
                EasyMock.expectLastCall().andReturn(
                    httpFields.getValues(JettyHTTPDestinationTest.AUTH_HEADER));
                
                EasyMock.expect(request.getInputStream()).andReturn(is);
                request.setHandled(true);
                EasyMock.expectLastCall()
                response.flushBuffer();
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.HttpFields$Field

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.