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


Java Response.SC_OK属性代码示例

本文整理汇总了Java中com.google.gwt.http.client.Response.SC_OK属性的典型用法代码示例。如果您正苦于以下问题:Java Response.SC_OK属性的具体用法?Java Response.SC_OK怎么用?Java Response.SC_OK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.gwt.http.client.Response的用法示例。


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

示例1: syncRequest

public XMLHttpRequest2 syncRequest(String aUrl, ResponseType aResponseType) throws Exception {
	final XMLHttpRequest2 req = syncRequest(aUrl, aResponseType, null, RequestBuilder.GET);
	if (req.getStatus() == Response.SC_OK)
		return req;
	else
		throw new Exception(req.getStatus() + " " + req.getStatusText());
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:7,代码来源:AppClient.java

示例2: syncApiRequest

public XMLHttpRequest2 syncApiRequest(String aUrlPrefix, final String aUrlQuery, ResponseType aResponseType) throws Exception {
	String url = apiUrl + (aUrlPrefix != null ? aUrlPrefix : "") + "?" + aUrlQuery;
	final XMLHttpRequest2 req = syncRequest(url, aResponseType, null, RequestBuilder.GET);
	if (req.getStatus() == Response.SC_OK)
		return req;
	else
		throw new Exception(req.getStatus() + " " + req.getStatusText());
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:8,代码来源:AppClient.java

示例3: getError

/**
 * Return error associated with response.
 *
 * @param response the response.
 * @return the error if any, null otherwise.
 */
@Nullable
protected Throwable getError( @Nonnull final Response response )
{
  final int statusCode = response.getStatusCode();
  if ( Response.SC_OK == statusCode )
  {
    return null;
  }
  else
  {
    return new Exception( "Bad status code: " + statusCode );
  }
}
 
开发者ID:realityforge,项目名称:gwt-webpoller,代码行数:19,代码来源:AbstractHttpRequestFactory.java

示例4: onSubmit

private void onSubmit(String result) {
	switch (ServletConstants.getErrorCode(result)) {
		case Response.SC_OK:
			if (view.getAutomatedField().getValue()) {
				doAutomatedImport(result);
			} else {
				loadImportResults(result);
			}
			break;

		default:
			N10N.error(I18N.CONSTANTS.createFormIncomplete(), I18N.MESSAGES.importFormIncompleteDetails(""));
			break;
	}
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:15,代码来源:ImportationPresenter.java

示例5: onReceiving

private void onReceiving(int statusCode, String responseText, boolean connected) {
	if (statusCode != Response.SC_OK) {
		if (!connected) {
			super.disconnect();
			listener.onError(new StatusCodeException(statusCode, responseText), connected);
		}
	}
	else {
		int index = responseText.lastIndexOf(SEPARATOR);
		if (index > read) {
			List<Serializable> messages = new ArrayList<Serializable>();
			
			SplitResult data = separator.split(responseText.substring(read, index), index);
			int length = data.length();
			for (int i = 0; i < length; i++) {
				if (disconnecting) {
					return;
				}
				
				String message = data.get(i);
				if (!message.isEmpty()) {
					parse(message, messages);
				}
			}
			read = index + 1;
			if (!messages.isEmpty()) {
				listener.onMessage(messages);
			}
		}
		
		if (!connected) {
			super.disconnected();
		}
	}
}
 
开发者ID:rzschech,项目名称:gwt-comet,代码行数:35,代码来源:HTTPRequestCometTransport.java

示例6: onResponseReceived

@Override
public void onResponseReceived(Request request, Response response) {
    if (response != null && response.getStatusCode() == Response.SC_OK) {
        dispatch(SERVER_AVAILABLE);
    } else {
        dispatch(RESPONSE_TIMEOUT);
    }
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:8,代码来源:OfflineModeEntrypoint.java

示例7: onResponseReceived

@Override
public void onResponseReceived(Request nativeRequest, Response nativeResponse)
{
	TransactionRequest request = this.getDispatchedRequest(nativeRequest);
	m_reusedResponse.clear();
	int statusCode = nativeResponse.getStatusCode();
	
	if( statusCode != Response.SC_OK )
	{
		String statusText = nativeResponse.getStatusText();
		m_reusedResponse.setError(E_ResponseError.HTTP_ERROR);
		
		this.onError(nativeRequest, request, m_reusedResponse);
		
		return;
	}
	
	I_JsonObject responseJson = m_jsonFactory.createJsonObject(nativeResponse.getText());
	m_reusedResponse.readJson(m_jsonFactory, responseJson);
	
	if( !(request instanceof TransactionRequestBatch) )
	{
		m_callbacks.onResponseReceived(request, m_reusedResponse);
	}
	else
	{
		if( m_reusedResponse.getError() != E_ResponseError.NO_ERROR )
		{
			this.onError(nativeRequest, request, m_reusedResponse);
			
			return;
		}

		TransactionRequestBatch batch = (TransactionRequestBatch) request;

		I_JsonArray responseList = m_jsonFactory.getHelper().getJsonArray(responseJson, E_JsonKey.responseList);
		
		m_callbacks.onResponseReceived(batch, responseList);
	}
	
	this.m_nativeRequestMap.remove(nativeRequest);
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:42,代码来源:GwtRequestDispatcher.java

示例8: getErrorCode

/**
 * Parse the error message and return the embeded error code as an integer. If the message does not denote an error,
 * 200 is returned.
 * 
 * @param message
 *          Message returned by a servlet.
 * @return The error code if available, 200 otherwise.
 */
public static int getErrorCode(String message) {
	if (!isErrorResponse(message)) {
		return Response.SC_OK;
	} else {
		return Integer.parseInt(message.substring(1));
	}
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:15,代码来源:ServletConstants.java


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