本文整理汇总了Java中org.springframework.extensions.webscripts.connector.HttpMethod类的典型用法代码示例。如果您正苦于以下问题:Java HttpMethod类的具体用法?Java HttpMethod怎么用?Java HttpMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpMethod类属于org.springframework.extensions.webscripts.connector包,在下文中一共展示了HttpMethod类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: remoteCall
import org.springframework.extensions.webscripts.connector.HttpMethod; //导入依赖的package包/类
private void remoteCall(HttpServletRequest request, JSONObject auditSample) throws JSONException, URIException,
UnsupportedEncodingException {
Connector connector;
try {
connector = FrameworkUtil.getConnector(request.getSession(true), auditSample.getString(AUDIT_USER_ID),
AlfrescoUserFactory.ALFRESCO_ENDPOINT_ID);
ConnectorContext postContext = new ConnectorContext(null, buildDefaultHeaders());
postContext.setMethod(HttpMethod.POST);
postContext.setContentType("text/plain;charset=UTF-8");
InputStream in = new ByteArrayInputStream(auditSample.toString().getBytes("UTF-8"));
// Webscript call
connector.call("/share-stats/insert-audit", postContext, in);
} catch (ConnectorServiceException e) {
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage(), e);
}
}
}
示例2: remoteCall
import org.springframework.extensions.webscripts.connector.HttpMethod; //导入依赖的package包/类
private void remoteCall(HttpServletRequest request, JSONObject auditSample) throws JSONException, URIException,
UnsupportedEncodingException {
Connector connector;
try {
connector = FrameworkUtil.getConnector(request.getSession(true), auditSample.getString(AUDIT_USER_ID),
AlfrescoUserFactory.ALFRESCO_ENDPOINT_ID);
// if (parameters == null), we use the 'inputstream'
// The webscript is called with the audit converted into JSON.
ConnectorContext postContext = new ConnectorContext(null, buildDefaultHeaders());
postContext.setMethod(HttpMethod.POST);
postContext.setContentType("text/plain;charset=UTF-8");
InputStream in = new ByteArrayInputStream(auditSample.toString().getBytes("UTF-8"));
// Webscript call
connector.call("/share-stats/insert-audit", postContext, in);
} catch (ConnectorServiceException e) {
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage(), e);
}
}
}
示例3: retrieveFormDefinition
import org.springframework.extensions.webscripts.connector.HttpMethod; //导入依赖的package包/类
/**
* Retrieves the form definition from the repository FormService for the
* given item.
*
* @param itemKind The form item kind
* @param itemId The form item id
* @param visibleFields The list of field names to return or null
* to return all fields
* @param formConfig The form configuration
* @return Response object from the remote call
*/
protected Response retrieveFormDefinition(String itemKind, String itemId,
List<String> visibleFields, FormConfigElement formConfig)
{
Response response = null;
try
{
// setup the connection
ConnectorService connService = FrameworkUtil.getConnectorService();
RequestContext requestContext = ThreadLocalRequestContext.getRequestContext();
String currentUserId = requestContext.getUserId();
HttpSession currentSession = ServletUtil.getSession(true);
Connector connector = connService.getConnector(ENDPOINT_ID, currentUserId, currentSession);
ConnectorContext context = new ConnectorContext(HttpMethod.POST, null, buildDefaultHeaders());
context.setContentType("application/json");
// call the form service
response = connector.call("/api/formdefinitions", context, generateFormDefPostBody(itemKind,
itemId, visibleFields, formConfig));
if (logger.isDebugEnabled())
logger.debug("Response status: " + response.getStatus().getCode());
}
catch (Exception e)
{
if (logger.isErrorEnabled())
logger.error("Failed to get form definition: ", e);
}
return response;
}