/*
* Copyright (c) 2001-2008 Caucho Technology, Inc. All rights reserved.
*
* The Apache Software License, Version 1.1
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Caucho Technology (http://www.caucho.com/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "Hessian", "Resin", and "Caucho" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [email protected].
*
* 5. Products derived from this software may not be called "Resin"
* nor may "Resin" appear in their names without prior written
* permission of Caucho Technology.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL CAUCHO TECHNOLOGY OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Scott Ferguson
*/
package com.caucho.hessian.io;
import java.io.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Input stream for Hessian requests.
*
* <p>HessianInput is unbuffered, so any client needs to provide
* its own buffering.
*
* <pre>
* InputStream is = ...; // from http connection
* HessianInput in = new HessianInput(is);
* String value;
*
* in.startReply(); // read reply header
* value = in.readString(); // read string value
* in.completeReply(); // read reply footer
* </pre>
*/
public class Hessian2Input
extends AbstractHessianInput
implements Hessian2Constants
{
private static final Logger log
= Logger.getLogger(Hessian2Input.class.getName());
private static final int END_OF_DATA = -2;
private static Field _detailMessageField;
private static final int SIZE = 1024;
private static final int GAP = 16;
// standard, unmodified factory for deserializing objects
protected SerializerFactory _defaultSerializerFactory;
// factory for deserializing objects in the input stream
protected SerializerFactory _serializerFactory;
private static boolean _isCloseStreamOnClose;
protected ArrayList<Object> _refs
= new ArrayList<Object>();
protected ArrayList<ObjectDefinition> _classDefs
= new ArrayList<ObjectDefinition>();
protected ArrayList<String> _types
= new ArrayList<String>();
// the underlying input stream
private InputStream _is;
private final byte []_buffer = new byte[SIZE];
// a peek character
private int _offset;
private int _length;
// the method for a call
private String _method;
private Throwable _replyFault;
private StringBuilder _sbuf = new StringBuilder();
// true if this is the last chunk
private boolean _isLastChunk;
// the chunk length
private int _chunkLength;
private HessianDebugInputStream _dIs;
public Hessian2Input()
{
if (log.isLoggable(Level.FINEST)) {
_dIs = new HessianDebugInputStream(log, Level.FINEST);
}
}
/**
* Creates a new Hessian input stream, initialized with an
* underlying input stream.
*
* @param is the underlying input stream.
*/
public Hessian2Input(InputStream is)
{
this();
init(is);
}
/**
* Sets the serializer factory.
*/
public void setSerializerFactory(SerializerFactory factory)
{
_serializerFactory = factory;
}
/**
* Gets the serializer factory.
*/
public SerializerFactory getSerializerFactory()
{
// the default serializer factory cannot be modified by external
// callers
if (_serializerFactory == _defaultSerializerFactory) {
_serializerFactory = new SerializerFactory();
}
return _serializerFactory;
}
/**
* Gets the serializer factory.
*/
protected final SerializerFactory findSerializerFactory()
{
SerializerFactory factory = _serializerFactory;
if (factory == null) {
factory = SerializerFactory.createDefault();
_defaultSerializerFactory = factory;
_serializerFactory = factory;
}
return factory;
}
public void allow(String pattern)
{
ClassFactory factory = getSerializerFactory().getClassFactory();
factory.allow(pattern);
}
public void setCloseStreamOnClose(boolean isClose)
{
_isCloseStreamOnClose = isClose;
}
public boolean isCloseStreamOnClose()
{
return _isCloseStreamOnClose;
}
/**
* Returns the calls method
*/
public String getMethod()
{
return _method;
}
/**
* Returns any reply fault.
*/
public Throwable getReplyFault()
{
return _replyFault;
}
@Override
public void init(InputStream is)
{
if (_dIs != null) {
_dIs.initPacket(is);
is = _dIs;
}
_is = is;
reset();
}
public void initPacket(InputStream is)
{
if (_dIs != null) {
_dIs.initPacket(is);
is = _dIs;
}
_is = is;
resetReferences();
}
/**
* Starts reading the call
*
* <pre>
* c major minor
* </pre>
*/
public int readCall()
throws IOException
{
int tag = read();
if (tag != 'C')
throw error("expected hessian call ('C') at " + codeName(tag));
return 0;
}
/**
* Starts reading the envelope
*
* <pre>
* E major minor
* </pre>
*/
public int readEnvelope()
throws IOException
{
int tag = read();
int version = 0;
if (tag == 'H') {
int major = read();
int minor = read();
version = (major << 16) + minor;
tag = read();
}
if (tag != 'E')
throw error("expected hessian Envelope ('E') at " + codeName(tag));
return version;
}
/**
* Completes reading the envelope
*
* <p>A successful completion will have a single value:
*
* <pre>
* Z
* </pre>
*/
public void completeEnvelope()
throws IOException
{
int tag = read();
if (tag != 'Z')
error("expected end of envelope at " + codeName(tag));
}
/**
* Starts reading the call
*
* <p>A successful completion will have a single value:
*
* <pre>
* string
* </pre>
*/
public String readMethod()
throws IOException
{
_method = readString();
return _method;
}
/**
* Returns the number of method arguments
*
* <pre>
* int
* </pre>
*/
@Override
public int readMethodArgLength()
throws IOException
{
return readInt();
}
/**
* Starts reading the call, including the headers.
*
* <p>The call expects the following protocol data
*
* <pre>
* c major minor
* m b16 b8 method
*
没有合适的资源?快使用搜索试试~ 我知道了~
MoonBox-main.zip
共861个文件
java:625个
xml:53个
js:50个
0 下载量 49 浏览量
2023-03-06
08:19:53
上传
评论
收藏 129.42MB ZIP 举报
温馨提示
Moonbox(月光宝盒)是JVM-Sandbox生态下的,基于jvm-sandbox-repeater重新开发的一款流量回放平台产品。在jvm-sandbox-repeater基础上提供了更加丰富功能,同时便于线上部署和使用。
资源推荐
资源详情
资源评论
收起资源包目录
MoonBox-main.zip (861个子文件)
default.conf 1KB
app.2ad668b6.css 211KB
dashboard.a134081f.css 8KB
style.css 5KB
playbackJavaDetail~playbackdubboDetail~playbackhttpDetail.68f5a009.css 1KB
chunk-vendors.91d43fda.css 1KB
mock.c0dbfe98.css 1KB
addRecord.9fa8fb7c.css 873B
playback.a6fa2f8c.css 597B
javaDetail.93cfc52a.css 561B
playbackJavaDetail.171a59cc.css 561B
httpDetail.6813a3f1.css 538B
playbackhttpDetail.f28be423.css 538B
dubboDetail.e4e70564.css 499B
playbackdubboDetail.e529f00a.css 499B
addReplay.1261eccb.css 426B
record.393075da.css 337B
addReplay~executionConfig.7c4224c7.css 196B
deserializers 191B
Dockerfile 1KB
Dockerfile 837B
Dockerfile 777B
.gitignore 569B
index.html 3KB
package.html 2KB
package.html 2KB
index.html 982B
favicon.ico 31KB
favicon.ico 31KB
favicon.ico 31KB
Hessian2Input.java 68KB
JsonFormat.java 52KB
HessianDebugState.java 51KB
Hessian2Output.java 38KB
TaskRunInfoExample.java 36KB
BurlapInput.java 36KB
TestAgentService.java 34KB
HessianInput.java 32KB
TestHessian2.java 29KB
TestHessian2Servlet.java 28KB
RecordTaskTemplateExample.java 28KB
ReplayDiffConfigExample.java 25KB
MicroBurlapInput.java 23KB
SerializerFactory.java 23KB
BurlapOutput.java 21KB
UnsafeDeserializer.java 21KB
SpecialMockConfigExample.java 21KB
HessianOutput.java 20KB
ApacheHttpClientProcessor.java 20KB
HttpStandaloneListener.java 20KB
ElasticSearchInvocationProcessor.java 20KB
JavaDeserializer.java 19KB
HeartbeatInfoExample.java 18KB
TaskRunCountDetailExample.java 18KB
ContextSerializerFactory.java 17KB
MoonboxModule.java 17KB
ReplayDataServiceImpl.java 17KB
MicroBurlapOutput.java 16KB
HttpComponent.java 16KB
UnsafeSerializer.java 16KB
RecordDataServiceImpl.java 15KB
HessianProxyFactory.java 15KB
BasicDeserializer.java 15KB
HttpUtil.java 14KB
AbstractTaskRunService.java 14KB
AbstractHessianOutput.java 14KB
HttpUtil.java 13KB
JavaSerializer.java 13KB
RedisPlugin.java 13KB
MicroHessianOutput.java 13KB
DubboRepeater.java 13KB
HessianProxy.java 12KB
HessianServlet.java 11KB
AnnotationSerializer.java 11KB
ReplayServiceImpl.java 11KB
DefaultEventListener.java 11KB
AbstractReflectCompareStrategy.java 11KB
BurlapProxyFactory.java 10KB
HessianSkeleton.java 10KB
TaskConfigServiceImpl.java 10KB
DubboEventListener.java 10KB
MicroHessianInput.java 10KB
X509Encryption.java 10KB
AbstractHessianInput.java 10KB
X509Signature.java 10KB
OkhttpInvocationProcessor.java 10KB
PluginClassRouting.java 9KB
RecordConvert.java 9KB
ReplayConvert.java 9KB
MoonboxRepeaterTask.java 9KB
Invocation.java 9KB
BasicSerializer.java 9KB
AgentDistributionServiceImpl.java 9KB
BeanSerializer.java 9KB
MoonboxRecordCache.java 8KB
MuxServer.java 8KB
SpringMongoPlugin.java 8KB
EnhanceModel.java 8KB
SerializerWrapper.java 8KB
BeanDeserializer.java 8KB
共 861 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
m0_72731342
- 粉丝: 2
- 资源: 1832
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功