当前位置: 首页>>代码示例>>Java>>正文


Java IStatus类代码示例

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


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

示例1: newFixedLengthResponse

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
/**
 * Create a text response with known length.
 */
public static Response newFixedLengthResponse(IStatus status, String mimeType, String txt) {
    ContentType contentType = new ContentType(mimeType);
    if (txt == null) {
        return newFixedLengthResponse(status, mimeType, new ByteArrayInputStream(new byte[0]), 0);
    } else {
        byte[] bytes;
        try {
            CharsetEncoder newEncoder = Charset.forName(contentType.getEncoding()).newEncoder();
            if (!newEncoder.canEncode(txt)) {
                contentType = contentType.tryUTF8();
            }
            bytes = txt.getBytes(contentType.getEncoding());
        } catch (UnsupportedEncodingException e) {
            NanoHTTPD.LOG.log(Level.SEVERE, "encoding problem, responding nothing", e);
            bytes = new byte[0];
        }
        return newFixedLengthResponse(status, contentType.getContentTypeHeader(), new ByteArrayInputStream(bytes), bytes.length);
    }
}
 
开发者ID:xm0625,项目名称:VBrowser-Android,代码行数:23,代码来源:NanoHTTPD.java

示例2: Response

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
/**
 * Creates a fixed length response if totalBytes>=0, otherwise chunked.
 */
protected Response(IStatus status, String mimeType, InputStream data, long totalBytes) {
    this.status = status;
    this.mimeType = mimeType;
    if (data == null) {
        this.data = new ByteArrayInputStream(new byte[0]);
        this.contentLength = 0L;
    } else {
        this.data = data;
        this.contentLength = totalBytes;
    }
    this.chunkedTransfer = this.contentLength < 0;
    keepAlive = true;
}
 
开发者ID:xm0625,项目名称:VBrowser-Android,代码行数:17,代码来源:NanoHTTPD.java

示例3: render

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
public Response render(ModelAndView model) {
	IStatus status;
	if (model.getStatus() != null) {
		status = model.getStatus();
	} else {
		status = Status.OK;
	}
	return NanoHTTPD.newFixedLengthResponse(status, MimeType.JSON.getType(), model.getData());
}
 
开发者ID:dernasherbrezon,项目名称:r2cloud,代码行数:10,代码来源:GsonRenderer.java

示例4: Response

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
/**
 * Creates a fixed length response if totalBytes>=0, otherwise chunked.
 */
public Response(IStatus status, String mimeType, InputStream data, long totalBytes) {
    this.status = status;
    this.mimeType = mimeType;
    if (data == null) {
        this.data = new ByteArrayInputStream(new byte[0]);
        this.contentLength = 0L;
    } else {
        this.data = data;
        this.contentLength = totalBytes;
    }
    this.chunkedTransfer = this.contentLength < 0;
    keepAlive = true;
}
 
开发者ID:panda73111,项目名称:FakeLocation,代码行数:17,代码来源:NanoHTTPD.java

示例5: newFixedLengthResponse

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
/**
 * Create a text response with known length.
 */
public Response newFixedLengthResponse(IStatus status, String mimeType, String txt) {
    if (txt == null) {
        return newFixedLengthResponse(status, mimeType, new ByteArrayInputStream(new byte[0]), 0);
    } else {
        byte[] bytes;
        try {
            bytes = txt.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            NanoHTTPD.LOG.log(Level.SEVERE, "encoding problem, responding nothing", e);
            bytes = new byte[0];
        }
        return newFixedLengthResponse(status, mimeType, new ByteArrayInputStream(bytes), bytes.length);
    }
}
 
开发者ID:UWNetworksLab,项目名称:colony,代码行数:18,代码来源:NanoHTTPD.java

示例6: newFixedLengthResponse

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
/**
 * Create a text response with known length.
 */
public static Response newFixedLengthResponse(IStatus status, String mimeType, String txt) {
    if (txt == null) {
        return newFixedLengthResponse(status, mimeType, new ByteArrayInputStream(new byte[0]), 0);
    } else {
        byte[] bytes;
        try {
            bytes = txt.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            NanoHTTPD.LOG.log(Level.SEVERE, "encoding problem, responding nothing", e);
            bytes = new byte[0];
        }
        return newFixedLengthResponse(status, mimeType, new ByteArrayInputStream(bytes), bytes.length);
    }
}
 
开发者ID:RinatKurmaev,项目名称:Tether-companion,代码行数:18,代码来源:NanoHTTPD.java

示例7: newFixedLengthResponse

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
public static Response newFixedLengthResponse(IStatus status, String mimeType, String message) {
    Response response = NanoHTTPD.newFixedLengthResponse(status, mimeType, message);
    response.addHeader("Accept-Ranges", "bytes");
    return response;
}
 
开发者ID:xm0625,项目名称:VBrowser-Android,代码行数:6,代码来源:SimpleWebServer.java

示例8: getStatus

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
public IStatus getStatus() {
    return this.status;
}
 
开发者ID:xm0625,项目名称:VBrowser-Android,代码行数:4,代码来源:NanoHTTPD.java

示例9: setStatus

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
public void setStatus(IStatus status) {
    this.status = status;
}
 
开发者ID:xm0625,项目名称:VBrowser-Android,代码行数:4,代码来源:NanoHTTPD.java

示例10: newChunkedResponse

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
/**
 * Create a response with unknown length (using HTTP 1.1 chunking).
 */
public static Response newChunkedResponse(IStatus status, String mimeType, InputStream data) {
    return new Response(status, mimeType, data, -1);
}
 
开发者ID:xm0625,项目名称:VBrowser-Android,代码行数:7,代码来源:NanoHTTPD.java

示例11: getStatus

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
public IStatus getStatus() {
	return status;
}
 
开发者ID:dernasherbrezon,项目名称:r2cloud,代码行数:4,代码来源:ModelAndView.java

示例12: setStatus

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
public void setStatus(IStatus status) {
	this.status = status;
}
 
开发者ID:dernasherbrezon,项目名称:r2cloud,代码行数:4,代码来源:ModelAndView.java

示例13: getStatus

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
@Override
public IStatus getStatus() {
    return Status.OK;
}
 
开发者ID:macacajs,项目名称:UIAutomatorWD,代码行数:5,代码来源:RouterNanoHTTPD.java

示例14: getStatus

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
@Override
public IStatus getStatus() {
    return Status.NOT_ACCEPTABLE;
}
 
开发者ID:codetoart,项目名称:r2-streamer-java,代码行数:5,代码来源:SearchQueryHandler.java

示例15: newChunkedResponse

import fi.iki.elonen.NanoHTTPD.Response.IStatus; //导入依赖的package包/类
/**
 * Create a response with unknown length (using HTTP 1.1 chunking).
 */
public Response newChunkedResponse(IStatus status, String mimeType, InputStream data) {
    return new Response(status, mimeType, data, -1);
}
 
开发者ID:UWNetworksLab,项目名称:colony,代码行数:7,代码来源:NanoHTTPD.java


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