本文整理汇总了Java中com.wm.app.b2b.server.ContentHandler类的典型用法代码示例。如果您正苦于以下问题:Java ContentHandler类的具体用法?Java ContentHandler怎么用?Java ContentHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContentHandler类属于com.wm.app.b2b.server包,在下文中一共展示了ContentHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.wm.app.b2b.server.ContentHandler; //导入依赖的package包/类
/**
* Returns a new content handler.
*
* @return A new content handler.
*/
public ContentHandler create() {
ContentHandler handler = factory.create();
if (filters != null && filters.size() > 0) {
List<FilterContentHandler> handlers = new ArrayList<FilterContentHandler>(filters.size());
for (FilterContentHandlerFactory filter : filters) {
handlers.add(filter.create());
}
handler = new ChainedFilterContentHandler(handler, handlers);
}
return handler;
}
示例2: process
import com.wm.app.b2b.server.ContentHandler; //导入依赖的package包/类
/**
* Processes an HTTP request.
*
* @param state The HTTP request to be processed.
* @return True if this object was able to process the HTTP request, otherwise false.
* @throws IOException If an I/O problem is encountered reading from or writing to the client socket.
* @throws AccessException If the the HTTP request requires authentication or is not authorized.
*/
public final boolean process(ProtocolState state) throws IOException, AccessException {
long startTime = System.currentTimeMillis();
ContentHandler contentHandler = ServerAPI.getContentHandler(state.getContentType());
Map.Entry<HTTPRoute, IData> matchResult = routes.match(HTTPMethod.valueOf(state.getRequestType()), "/" + state.getHttpRequestUrl());
boolean result;
if (matchResult != null) {
// convert capture URI parameters to query string, so they get added to input pipeline
// of the invoked service
IData parameters = matchResult.getValue();
String queryString = state.getHttpRequestUrlQuery();
if (queryString != null) {
IData queryParameters = URIQueryHelper.parse(queryString, true);
IDataUtil.merge(parameters, queryParameters);
parameters = queryParameters;
}
state.setHttpRequestUrlQuery(URIQueryHelper.emit(parameters, true));
HTTPRoute route = matchResult.getKey();
if (route.isInvoke()) {
// fool the AuditLogManager that the requested URL was for the invoke directive so that it does not
// inadvertently log spurious access denied errors
String originalRequestURL = setRequestURL(INVOKE_REQUEST_URL);
result = DEFAULT_INVOKE_HANDLER._process(state, contentHandler, route.getService());
// restore the original request URL to the invoke state
setRequestURL(originalRequestURL);
} else {
String target = route.getTarget();
if (target.startsWith("/")) target = target.substring(1, target.length());
state.setHttpRequestUrl(target);
result = DEFAULT_DOCUMENT_HANDLER.process(state);
}
} else {
// return forbidden error
int code = 403;
state.setResponse(code, HTTPHelper.getResponseStatusMessage(code));
result = true;
}
long endTime = System.currentTimeMillis();
state.setResponseFieldValue(RESPONSE_DURATION_HEADER, DurationHelper.emit(DurationHelper.parse(endTime - startTime)));
return result;
}
示例3: ChainedFilterContentHandler
import com.wm.app.b2b.server.ContentHandler; //导入依赖的package包/类
/**
* Constructs a new ChainedContentHandler given a list of ContentHandler objects.
*
* @param handler The content handlers which ultimately handles content.
* @param filters The chained filters to be wrapped.
*/
ChainedFilterContentHandler(ContentHandler handler, List<FilterContentHandler> filters) {
super(handler);
this.filters = filters;
}
示例4: ProxyContentHandler
import com.wm.app.b2b.server.ContentHandler; //导入依赖的package包/类
/**
* Creates a new ProxyContentHandler object.
*
* @param handler The content handler which method calls will be proxied to by this object.
*/
public ProxyContentHandler(ContentHandler handler) {
if (handler == null) throw new NullPointerException("handler must not be null");
this.handler = handler;
}
示例5: getContentHandler
import com.wm.app.b2b.server.ContentHandler; //导入依赖的package包/类
/**
* Returns the content handler which is being proxied.
*
* @return The content handler which is being proxied.
*/
public ContentHandler getContentHandler() {
return handler;
}
示例6: create
import com.wm.app.b2b.server.ContentHandler; //导入依赖的package包/类
/**
* Returns a content handler.
*
* @return A content handler.
*/
public ContentHandler create() {
return factory.create();
}
示例7: create
import com.wm.app.b2b.server.ContentHandler; //导入依赖的package包/类
/**
* Returns a new content handler for handling JSON.
*
* @return A new content handler for handling JSON.
*/
public ContentHandler create() {
return new JSONContentHandler(contentType);
}