• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Buffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jetty.io.Buffer的典型用法代码示例。如果您正苦于以下问题:Java Buffer类的具体用法?Java Buffer怎么用?Java Buffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Buffer类属于org.eclipse.jetty.io包,在下文中一共展示了Buffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doGet

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String requestLine = req.getRequestURL().toString();
    String file = requestLine.substring(requestLine.lastIndexOf('/'));
    for (int i = 0; i < paths.size(); i++) {
        String s = paths.get(i);
        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(s + "/" + file);
        if (inputStream != null) {

            Buffer mime = mimeTypes.getMimeByExtension(req.getPathInfo());
            if (mime != null) {
                resp.setContentType(mime.toString());
            }
            XMLSecurityUtils.copy(inputStream, resp.getOutputStream());
            inputStream.close();
            return;
        }
    }
    resp.sendError(HttpServletResponse.SC_NOT_FOUND);
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:21,代码来源:HttpRequestRedirectorProxy.java


示例2: toString

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
public String toString()
{
    // Do NOT use synchronized (SslConnection.this)
    // because it's very easy to deadlock when debugging is enabled.
    // We do a best effort to print the right toString() and that's it.
    Buffer inbound = _inbound;
    Buffer outbound = _outbound;
    Buffer unwrap = _unwrapBuf;
    int i = inbound == null? -1 : inbound.length();
    int o = outbound == null ? -1 : outbound.length();
    int u = unwrap == null ? -1 : unwrap.length();
    return String.format(Locale.getDefault(), "SSL %s i/o/u=%d/%d/%d ishut=%b oshut=%b {%s}",
            _engine.getHandshakeStatus(),
            i, o, u,
            _ishut, _oshut,
            _connection);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:18,代码来源:SslConnection.java


示例3: flush

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Override
public int flush(Buffer buffer) throws IOException
{
    int l = super.flush(buffer);

    // If there was something to write and it wasn't written, then we are not writable.
    if (l==0 && buffer!=null && buffer.hasContent())
    {
        synchronized (this)
        {
            _writable=false;
            if (_state<STATE_DISPATCHED)
                updateKey();
        }
    }
    else if (l>0)
    {
        _writable=true;
        notIdle();
    }

    return l;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:24,代码来源:SelectChannelEndPoint.java


示例4: onResponseStatus

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Override
public void onResponseStatus( Buffer version, int status, Buffer reason )
    throws IOException
{
    _redirected = ((status == HttpStatus.MOVED_PERMANENTLY_301 ||
                    status == HttpStatus.MOVED_TEMPORARILY_302) &&
                   _attempts < _destination.getHttpClient().maxRedirects() );

    // Redirection is applied only to resources selected by state-less.txt (ELDAD):
    if (_redirected && _exchange instanceof HtmlSpeedHttpExchange)
    {
        HtmlSpeedHttpExchange exchange = (HtmlSpeedHttpExchange)_exchange;
        ConfigData configData = exchange.getContext().configData;
        if (!configData.isStateLess("//" + exchange.getHost() + exchange.getRequestURI()))
                _redirected = false;
    }

    if (_redirected)
    {
        setDelegatingRequests(false);
        setDelegatingResponses(false);
    }

    super.onResponseStatus(version,status,reason);
}
 
开发者ID:TimelyPick,项目名称:HtmlSpeed,代码行数:26,代码来源:RedirectListener.java


示例5: onResponseHeader

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Override
public void onResponseHeader( Buffer name, Buffer value )
    throws IOException
{
    if (_redirected)
    {
        int header = HttpHeaders.CACHE.getOrdinal(name);
        switch (header)
        {
            case HttpHeaders.LOCATION_ORDINAL:
                _location = value.toString();
                break;
        }
    }
    super.onResponseHeader(name,value);
}
 
开发者ID:TimelyPick,项目名称:HtmlSpeed,代码行数:17,代码来源:RedirectListener.java


示例6: flush

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Override
public int flush(Buffer buffer) throws IOException
{
    int l = super.flush(buffer);

    // If there was something to write and it wasn't written, then we are not writable.
    if (l==0 && buffer!=null && buffer.hasContent())
    {
        synchronized (this)
        {   
            _writable=false;
            if (_state<STATE_DISPATCHED)
                updateKey();
        }
    }
    else if (l>0)
    {
        _writable=true;
        notIdle();
    }

    return l;
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:24,代码来源:SelectChannelEndPoint.java


示例7: testMetadata

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Test
public void testMetadata() throws Exception {
	// for usage see
	// http://www.eclipse.org/jetty/documentation/current/http-client-api.html
	HttpClient http = new HttpClient();
	http.start();
	
	HttpExchange request = new HttpExchange() {
           protected void onResponseContent(Buffer content) {
               try {
                   Assert.assertEquals(ObjectConverterUtil.convertFileToString(UnitTestUtil.getTestDataFile("loopy-edmx-metadata.xml")), new String(content.asArray()));
               } catch (IOException e) {
                   Assert.fail();
               }
           }
           protected void onResponseStatus(Buffer version, int status, Buffer reason){
               Assert.assertEquals(200, status);
           }            
	};
	request.setURL("http://localhost:"+port+"/odata4/loopy/vm1/$metadata");
	request.setMethod("GET");
	
	http.send(request);
	request.waitForDone();
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:26,代码来源:TestODataIntegration.java


示例8: testEntitySet

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Test
public void testEntitySet() throws Exception {
	// for usage see
	// http://www.eclipse.org/jetty/documentation/current/http-client-api.html
	HttpClient http = new HttpClient();
	http.start();
       
       HttpExchange request = new HttpExchange() {
           protected void onResponseContent(Buffer content) {
               Assert.assertEquals("{\"@odata.context\":\"$metadata#G1\",\"value\":[{\"e1\":\"ABCDEFGHIJ\",\"e2\":0,\"e3\":0.0}]}", new String(content.asArray()));
           }
           protected void onResponseStatus(Buffer version, int status, Buffer reason){
               Assert.assertEquals(200, status);
           }            
       };
       request.setURL("http://localhost:"+port+"/odata4/loopy/vm1/G1");
       request.setMethod("GET");
       http.send(request);   
       request.waitForDone();
       request.waitForDone();
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:22,代码来源:TestODataIntegration.java


示例9: testIndividualProperty

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Test
public void testIndividualProperty() throws Exception {
    // for usage see
    // http://www.eclipse.org/jetty/documentation/current/http-client-api.html
    HttpClient http = new HttpClient();
    http.start();

    HttpExchange request = new HttpExchange() {
        protected void onResponseContent(Buffer content) {
            Assert.assertEquals("{\"@odata.context\":\"$metadata#Edm.String\",\"value\":\"ABCDEFGHIJ\"}", new String(content.asArray()));
        }
        protected void onResponseStatus(Buffer version, int status, Buffer reason){
            Assert.assertEquals(200, status);
        }            
    };
    request.setURL("http://localhost:"+port+"/odata4/loopy/vm1/G1(1)/e1");
    request.setMethod("GET");
    http.send(request);
    request.waitForDone();
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:21,代码来源:TestODataIntegration.java


示例10: put

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
/**
 * Set a field.
 * 
 * @param name the name of the field
 * @param value the value of the field. If null the field is cleared.
 */
public void put(Buffer name, Buffer value)
{
    remove(name);
    if (value == null)
        return;

    if (!(name instanceof BufferCache.CachedBuffer)) 
        name = HttpHeaders.CACHE.lookup(name);
    if (!(value instanceof CachedBuffer))
        value= HttpHeaderValues.CACHE.lookup(value).asImmutableBuffer();
    
    // new value;
    Field field = new Field(name, value);
    _fields.add(field);
    _names.put(name, field);
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:23,代码来源:HttpFields.java


示例11: toString

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
public String toString()
{
    // Do NOT use synchronized (SslConnection.this)
    // because it's very easy to deadlock when debugging is enabled.
    // We do a best effort to print the right toString() and that's it.
    Buffer inbound = _inbound;
    Buffer outbound = _outbound;
    Buffer unwrap = _unwrapBuf;
    int i = inbound == null? -1 : inbound.length();
    int o = outbound == null ? -1 : outbound.length();
    int u = unwrap == null ? -1 : unwrap.length();
    return String.format("SSL %s i/o/u=%d/%d/%d ishut=%b oshut=%b {%s}",
            _engine.getHandshakeStatus(),
            i, o, u,
            _ishut, _oshut,
            _connection);
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:18,代码来源:SslConnection.java


示例12: tesSystemMetadata

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Test
public void tesSystemMetadata() throws Exception {
	// for usage see
	// http://www.eclipse.org/jetty/documentation/current/http-client-api.html
	HttpClient http = new HttpClient();
	http.start();

       HttpExchange request = new HttpExchange() {
           protected void onResponseStatus(Buffer version, int status, Buffer reason){
               Assert.assertEquals(200, status);
           }            
       };
       request.setURL("http://localhost:"+port+"/odata4/loopy/SYS/$metadata");
       request.setMethod("GET");
       http.send(request);
       request.waitForDone();
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:18,代码来源:TestODataIntegration.java


示例13: testProcedure

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Ignore
@Test
public void testProcedure() throws Exception {
    // for usage see
    // http://www.eclipse.org/jetty/documentation/current/http-client-api.html
    HttpClient http = new HttpClient();
    http.start();

    HttpExchange request = new HttpExchange() {
        protected void onResponseContent(Buffer content) {
            Assert.assertEquals("{\"@odata.context\":\"$metadata#Edm.String\",\"value\":\"ABCDEFGHIJ\"}", new String(content.asArray()));
        }
        protected void onResponseStatus(Buffer version, int status, Buffer reason){
            Assert.assertEquals(200, status);
        }            
    };
    request.setURL("http://localhost:"+port+"/odata4/loopy/vm1/proc(x='foo')");
    request.setMethod("GET");
    http.send(request);
    request.waitForDone();
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:22,代码来源:TestODataIntegration.java


示例14: testEntitySetWithKey

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Test
public void testEntitySetWithKey() throws Exception {
	// for usage see
	// http://www.eclipse.org/jetty/documentation/current/http-client-api.html
	HttpClient http = new HttpClient();
	http.start();

       HttpExchange request = new HttpExchange() {
           protected void onResponseContent(Buffer content) {
               Assert.assertEquals("{\"@odata.context\":\"$metadata#G1/$entity\",\"value\":[{\"e1\":\"ABCDEFGHIJ\",\"e2\":0,\"e3\":0.0}]}", new String(content.asArray()));
           }
           protected void onResponseStatus(Buffer version, int status, Buffer reason){
               Assert.assertEquals(200, status);
           }            
       };
       request.setURL("http://localhost:"+port+"/odata4/loopy/vm1/G1(0)");
       request.setMethod("GET");
       http.send(request);
       request.waitForDone();
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:21,代码来源:TestODataIntegration.java


示例15: fill

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
public void fill(Buffer buffer)
{
    if (buffer!=null && buffer.length()>0)
    {
        if (_buffer==null)
            _buffer=_buffers.getBuffer();

        _buffer.put(buffer);
        buffer.clear();
    }
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:12,代码来源:WebSocketParserRFC6455.java


示例16: getBuffer

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
public Buffer getBuffer()
{
    _lock.lock();
    try
    {
        return _buffer;
    }
    finally
    {
        _lock.unlock();
    }
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:13,代码来源:WebSocketGeneratorRFC6455.java


示例17: toString

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
@Override
public String toString()
{
    // Do NOT use synchronized (this)
    // because it's very easy to deadlock when debugging is enabled.
    // We do a best effort to print the right toString() and that's it.
    Buffer buffer = _buffer;
    return String.format(Locale.getDefault(), "%[email protected]%x closed=%b buffer=%d",
            getClass().getSimpleName(),
            hashCode(),
            _closed,
            buffer == null ? -1 : buffer.length());
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:14,代码来源:WebSocketGeneratorRFC6455.java


示例18: getHeaderBuffer

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
public Buffer getHeaderBuffer()
{
    if (_header == null)
    {
        _header=_buffers.getHeader();
        _tok0.update(_header);
        _tok1.update(_header);
    }
    return _header;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:11,代码来源:HttpParser.java


示例19: fill

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
public int fill(Buffer buffer) throws IOException
{
    int size=buffer.length();
    process(buffer, null);

    int filled=buffer.length()-size;

    if (filled==0 && isInputShutdown())
        return -1;
    return filled;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:12,代码来源:SslConnection.java


示例20: flush

import org.eclipse.jetty.io.Buffer; //导入依赖的package包/类
public int flush(Buffer buffer) throws IOException
{
    Buffer buf = buffer.buffer();
    int len=0;
    if (buf instanceof NIOBuffer)
    {
        final NIOBuffer nbuf = (NIOBuffer)buf;
        final ByteBuffer bbuf=nbuf.getByteBuffer().asReadOnlyBuffer();
        try
        {
            bbuf.position(buffer.getIndex());
            bbuf.limit(buffer.putIndex());
            len=_channel.write(bbuf);
        }
        finally
        {
            if (len>0)
                buffer.skip(len);
        }
    }
    else if (buffer.array()!=null)
    {
        ByteBuffer b = ByteBuffer.wrap(buffer.array(), buffer.getIndex(), buffer.length());
        len=_channel.write(b);
        if (len>0)
            buffer.skip(len);
    }
    else
    {
        throw new IOException("Not Implemented");
    }
    return len;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:34,代码来源:ChannelEndPoint.java



注:本文中的org.eclipse.jetty.io.Buffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CalciteSchema类代码示例发布时间:2022-05-22
下一篇:
Java PrintJob类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap