本文整理汇总了Java中com.google.gwt.user.server.rpc.SerializationPolicy类的典型用法代码示例。如果您正苦于以下问题:Java SerializationPolicy类的具体用法?Java SerializationPolicy怎么用?Java SerializationPolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerializationPolicy类属于com.google.gwt.user.server.rpc包,在下文中一共展示了SerializationPolicy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGetSerializationPolicy
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
@Override
protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest request, String moduleBaseURL, String strongName) {
if (Config.SYSTEM_APACHE_REQUEST_HEADER_FIX) {
// Get base url from the header instead of the body. This way
// Apache reverse proxy with rewrite on header can work.
// Suggested at http://stackoverflow.com/questions/1517290/problem-with-gwt-behind-a-reverse-proxy-either-nginx-or-apache
// ProxyPass /app/ ajp://localhost:8009/OpenKM/
// RequestHeader edit X-GWT-Module-Base ^(.*)/app/(.*)$ $1/OpenKM/$2
String moduleBaseURLHdr = request.getHeader("X-GWT-Module-Base");
log.debug("X-GWT-Module-Base: {}", moduleBaseURLHdr);
if (moduleBaseURLHdr != null) {
moduleBaseURL = moduleBaseURLHdr;
}
}
return super.doGetSerializationPolicy(request, moduleBaseURL, strongName);
}
示例2: getSerializationPolicy
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
@Override
public SerializationPolicy getSerializationPolicy(String moduleBaseURL,
String strongName) {
SerializationPolicy serializationPolicy = null;
synchronized (serializationPolicyCache) {
serializationPolicy = serializationPolicyCache.get(moduleBaseURL
+ strongName);
}
if (serializationPolicy != null) {
return serializationPolicy;
}
serializationPolicy = loadSerializationPolicy(moduleBaseURL, strongName);
if (serializationPolicy == null) {
serializationPolicy = RPC.getDefaultSerializationPolicy();
}
serializationPolicyCache.put(moduleBaseURL + strongName,
serializationPolicy);
return serializationPolicy;
}
示例3: createCometServletResponse
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
private CometServletResponseImpl createCometServletResponse(HttpServletRequest request, HttpServletResponse response, SerializationPolicy serializationPolicy, ClientOracle clientOracle, int requestHeartbeat) {
String accept = request.getHeader("Accept");
String userAgent = request.getHeader("User-Agent");
if ("text/event-stream".equals(accept)) {
return new EventSourceCometServletResponse(request, response, serializationPolicy, clientOracle, this, async, requestHeartbeat);
}
else if ("application/comet".equals(accept)) {
return new HTTPRequestCometServletResponse(request, response, serializationPolicy, clientOracle, this, async, requestHeartbeat);
}
else if (userAgent != null && userAgent.contains("Opera")) {
return new OperaEventSourceCometServletResponse(request, response, serializationPolicy, clientOracle, this, async, requestHeartbeat);
}
else {
return new IEHTMLFileCometServletResponse(request, response, serializationPolicy, clientOracle, this, async, requestHeartbeat);
}
}
示例4: ManagedStreamCometServletResponseImpl
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public ManagedStreamCometServletResponseImpl(HttpServletRequest request, HttpServletResponse response, SerializationPolicy serializationPolicy, ClientOracle clientOracle, CometServlet servlet, AsyncServlet async, int heartbeat) {
super(request, response, serializationPolicy, clientOracle, servlet, async, heartbeat);
String paddingParameter = getRequest().getParameter("padding");
if (paddingParameter != null) {
paddingRequired = Integer.parseInt(paddingParameter);
}
else {
paddingRequired = getPaddingRequired();
}
String lengthParameter = getRequest().getParameter("length");
if (lengthParameter != null) {
length = Integer.parseInt(lengthParameter);
}
else {
length = 0;
}
}
示例5: serialize
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public <T> String serialize(Class<? super T> clazz, T instance, SerializationPolicy serializationPolicy) throws SerializationException {
if (instance == null) {
return null;
}else if(String.class.equals(clazz)){
return (String) instance;
}
if (serializationPolicy == null) {
throw new IllegalArgumentException("SerializationPolicy is null, please call StorageUtils.PolicyLoader.load(...) before");
}
ServerSerializationStreamWriter stream = new ServerSerializationStreamWriter(serializationPolicy);
stream.setFlags(AbstractSerializationStream.DEFAULT_FLAGS);
stream.prepareToWrite();
if (clazz != void.class) {
stream.serializeValue(instance, clazz);
}
return stream.toString();
}
示例6: SyncClientSerializationStreamWriter
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public SyncClientSerializationStreamWriter(Serializer serializer,
String moduleBaseURL, String serializationPolicyStrongName,
SerializationPolicy serializationPolicy, RpcToken rpcToken) {
this.serializer = serializer;
this.moduleBaseURL = moduleBaseURL;
this.serializationPolicyStrongName = serializationPolicyStrongName;
this.serializationPolicy = serializationPolicy;
this.rpcToken = rpcToken;
if (rpcToken != null) {
addFlags(FLAG_RPC_TOKEN_INCLUDED);
}
}
示例7: doGetSerializationPolicy
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
/**
* Attempt to load the RPC serialization policy normally. If it isn't found,
* try loading it using the context path instead of the URL.
*/
@Override
protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest request, String moduleBaseURL, String strongName)
{
SerializationPolicy policy = super.doGetSerializationPolicy(request, moduleBaseURL, strongName);
if(policy == null) {
return SerializationPolicyUtil.loadSerializationPolicy(this, request, moduleBaseURL, strongName);
} else {
return policy;
}
}
示例8: invokeAndEncodeResponse
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public static String invokeAndEncodeResponse(Object target,
Method serviceMethod,
Object[] args,
SerializationPolicy serializationPolicy)
throws SerializationException {
return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
AbstractSerializationStream.DEFAULT_FLAGS);
}
示例9: CometServletResponseImpl
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
protected CometServletResponseImpl(HttpServletRequest request, HttpServletResponse response, SerializationPolicy serializationPolicy, ClientOracle clientOracle, CometServlet servlet, AsyncServlet async, int heartbeat) {
this.request = request;
this.response = response;
this.serializationPolicy = serializationPolicy;
this.clientOracle = clientOracle;
this.servlet = servlet;
this.async = async;
this.heartbeat = heartbeat;
}
示例10: load
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public static void load(InputStream is, String moduleName, boolean isDefault) throws IOException, ParseException {
SerializationPolicy serializationPolicy = SerializationPolicyLoader.loadFromStream(is, null);
synchronized (StorageUtils.StorageUtilsHolder.SERIALIZATION_POLICY_CACHE) {
boolean shouldDefault = StorageUtils.StorageUtilsHolder.SERIALIZATION_POLICY_CACHE.isEmpty();
StorageUtils.StorageUtilsHolder.SERIALIZATION_POLICY_CACHE.put(moduleName, serializationPolicy);
if (isDefault || shouldDefault) {
StorageUtils.StorageUtilsHolder.SERIALIZATION_POLICY_CACHE.put(DEFAULT_POLICY_MODULE, serializationPolicy);
}
}
}
示例11: deserialize
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public static <T> T deserialize(Class<? super T> clazz, String serializedString, String moduleName) throws SerializationException {
if(clazz == null || serializedString == null){
return null;
}
SerializationPolicy policy;
synchronized (StorageUtilsHolder.SERIALIZATION_POLICY_CACHE) {
String _mn = (moduleName != null && !moduleName.trim().isEmpty()) ? moduleName.trim() : DEFAULT_POLICY_MODULE;
policy = StorageUtilsHolder.SERIALIZATION_POLICY_CACHE.get(_mn);
}
if (policy == null) policy = RPC.getDefaultSerializationPolicy();
return StorageUtilsHolder.SERIALIZER.deserialize(clazz, serializedString, policy);
}
示例12: serialize
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public static <T> String serialize(Class<? super T> clazz, T instance, String moduleName) throws SerializationException {
if(clazz == null || instance == null){
return null;
}
SerializationPolicy policy;
synchronized (StorageUtilsHolder.SERIALIZATION_POLICY_CACHE) {
String _mn = (moduleName != null && !moduleName.trim().isEmpty()) ? moduleName.trim() : DEFAULT_POLICY_MODULE;
policy = StorageUtilsHolder.SERIALIZATION_POLICY_CACHE.get(_mn);
}
if (policy == null) policy = RPC.getDefaultSerializationPolicy();
return serialize(clazz, instance, policy);
}
示例13: SyncClientSerializationStreamReader
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public SyncClientSerializationStreamReader(
SerializationPolicy serializationPolicy) {
this.serializationPolicy = serializationPolicy;
}
示例14: invokeAndEncodeResponse
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args,
SerializationPolicy serializationPolicy) throws SerializationException {
return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
AbstractSerializationStream.DEFAULT_FLAGS);
}
示例15: getPolicy
import com.google.gwt.user.server.rpc.SerializationPolicy; //导入依赖的package包/类
public static SerializationPolicy getPolicy()
{
return s_policy;
}