本文整理汇总了Java中org.apache.tapestry5.services.RequestHandler类的典型用法代码示例。如果您正苦于以下问题:Java RequestHandler类的具体用法?Java RequestHandler怎么用?Java RequestHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestHandler类属于org.apache.tapestry5.services包,在下文中一共展示了RequestHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildTimingFilter
import org.apache.tapestry5.services.RequestHandler; //导入依赖的package包/类
public RequestFilter buildTimingFilter(final Logger log) {
return new RequestFilter() {
public boolean service(Request request, Response response, RequestHandler handler) throws IOException {
long startTime = System.currentTimeMillis();
try {
return handler.service(request, response);
} finally {
long elapsed = System.currentTimeMillis() - startTime;
log.info(String.format("Request time: %d ms, %s", elapsed, request.getPath()));
}
}
};
}
开发者ID:Zabrimus,项目名称:vdr-jonglisto,代码行数:17,代码来源:AppModule.java
示例2: buildTimingFilter
import org.apache.tapestry5.services.RequestHandler; //导入依赖的package包/类
/**
* This is a service definition, the service will be named "TimingFilter".
* The interface, RequestFilter, is used within the RequestHandler service
* pipeline, which is built from the RequestHandler service configuration.
* Tapestry IoC is responsible for passing in an appropriate Logger
* instance. Requests for static resources are handled at a higher level, so
* this filter will only be invoked for Tapestry related requests.
* <p/>
* <p/>
* Service builder methods are useful when the implementation is inline as
* an inner class (as here) or require some other kind of special
* initialization. In most cases, use the static bind() method instead.
* <p/>
* <p/>
* If this method was named "build", then the service id would be taken from
* the service interface and would be "RequestFilter". Since Tapestry
* already defines a service named "RequestFilter" we use an explicit
* service id that we can reference inside the contribution method.
*/
public RequestFilter buildTimingFilter(final Logger log) {
return new RequestFilter() {
public boolean service(Request request, Response response, RequestHandler handler) throws IOException {
long startTime = System.currentTimeMillis();
try {
// The responsibility of a filter is to invoke the
// corresponding method
// in the handler. When you chain multiple filters together,
// each filter
// received a handler that is a bridge to the next filter.
return handler.service(request, response);
} finally {
long elapsed = System.currentTimeMillis() - startTime;
log.info(String.format("Request time: %d ms", elapsed));
}
}
};
}
开发者ID:beargiles,项目名称:project-student,代码行数:41,代码来源:AppModule.java
示例3: buildTimingFilter
import org.apache.tapestry5.services.RequestHandler; //导入依赖的package包/类
/**
* This is a service definition, the service will be named "TimingFilter". The interface,
* RequestFilter, is used within the RequestHandler service pipeline, which is built from the
* RequestHandler service configuration. Tapestry IoC is responsible for passing in an
* appropriate Logger instance. Requests for static resources are handled at a higher level, so
* this filter will only be invoked for Tapestry related requests.
* <p/>
* <p/>
* Service builder methods are useful when the implementation is inline as an inner class
* (as here) or require some other kind of special initialization. In most cases,
* use the static bind() method instead.
* <p/>
* <p/>
* If this method was named "build", then the service id would be taken from the
* service interface and would be "RequestFilter". Since Tapestry already defines
* a service named "RequestFilter" we use an explicit service id that we can reference
* inside the contribution method.
*/
public RequestFilter buildTimingFilter(final Logger log)
{
return new RequestFilter()
{
public boolean service(Request request, Response response, RequestHandler handler)
throws IOException
{
long startTime = System.currentTimeMillis();
try
{
// The responsibility of a filter is to invoke the corresponding method
// in the handler. When you chain multiple filters together, each filter
// received a handler that is a bridge to the next filter.
return handler.service(request, response);
} finally
{
long elapsed = System.currentTimeMillis() - startTime;
log.info(String.format("Request time: %d ms", elapsed));
}
}
};
}
开发者ID:wso2as-developer,项目名称:tapestry-samples,代码行数:44,代码来源:AppModule.java
示例4: buildUtf8Filter
import org.apache.tapestry5.services.RequestHandler; //导入依赖的package包/类
public RequestFilter buildUtf8Filter(@InjectService("RequestGlobals") final RequestGlobals requestGlobals,
final Logger log) {
return new RequestFilter() {
public boolean service(Request request, Response response, RequestHandler handler) throws IOException {
requestGlobals.getHTTPServletRequest().setCharacterEncoding("UTF-8");
return handler.service(request, response);
}
};
}
开发者ID:Zabrimus,项目名称:vdr-jonglisto,代码行数:11,代码来源:AppModule.java
示例5: service
import org.apache.tapestry5.services.RequestHandler; //导入依赖的package包/类
/**
* Filter interface for the HttpServletRequestHandler pipeline. A filter
* should delegate to the handler. It may perform operations before or after
* invoking the handler, and may modify the request and response passed in to
* the handler.
*
* @param request
* @param response
* @param handler
*
* @return true if the request has been handled, false otherwise
*/
@Override
public boolean service(final Request request, final Response response, final RequestHandler handler)
throws IOException {
{
if (path.equals(request.getPath())) {
String operation = request.getParameter("operation");
switch (operation) {
case "retrieve-alerts":
handleRetrieveAlerts(request, response);
break;
case "dismiss-alerts":
handleDismissAlerts(request, response);
break;
default:
response.sendError(400, "Invalid operation: " + operation);
break;
}
return true;
} else {
return handler.service(request, response);
}
}
}
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:40,代码来源:ReactAPIFilter.java
示例6: buildTimingFilter
import org.apache.tapestry5.services.RequestHandler; //导入依赖的package包/类
/**
* This is a service definition, the service will be named "TimingFilter". The interface,
* RequestFilter, is used within the RequestHandler service pipeline, which is built from the
* RequestHandler service configuration. Tapestry IoC is responsible for passing in an
* appropriate Logger instance. Requests for static resources are handled at a higher level, so
* this filter will only be invoked for Tapestry related requests.
*
* <p>
* Service builder methods are useful when the implementation is inline as an inner class
* (as here) or require some other kind of special initialization. In most cases,
* use the static bind() method instead.
*
* <p>
* If this method was named "build", then the service id would be taken from the
* service interface and would be "RequestFilter". Since Tapestry already defines
* a service named "RequestFilter" we use an explicit service id that we can reference
* inside the contribution method.
*/
public RequestFilter buildTimingFilter(final Logger log)
{
return new RequestFilter()
{
public boolean service(Request request, Response response, RequestHandler handler)
throws IOException
{
long startTime = System.currentTimeMillis();
try
{
// The responsibility of a filter is to invoke the corresponding method
// in the handler. When you chain multiple filters together, each filter
// received a handler that is a bridge to the next filter.
return handler.service(request, response);
}
finally
{
long elapsed = System.currentTimeMillis() - startTime;
log.info(String.format("Request time: %d ms", elapsed));
}
}
};
}
开发者ID:wso2as-developer,项目名称:tapestry-samples,代码行数:45,代码来源:AppModule.java
示例7: addReactAPIRequestFilter
import org.apache.tapestry5.services.RequestHandler; //导入依赖的package包/类
@Contribute(RequestHandler.class)
public static void addReactAPIRequestFilter(final OrderedConfiguration<RequestFilter> configuration) {
configuration.addInstance("react-api", ReactAPIFilter.class);
}
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:5,代码来源:ReactModule.java
注:本文中的org.apache.tapestry5.services.RequestHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论