本文整理汇总了Java中com.vaadin.server.RequestHandler类的典型用法代码示例。如果您正苦于以下问题:Java RequestHandler类的具体用法?Java RequestHandler怎么用?Java RequestHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestHandler类属于com.vaadin.server包,在下文中一共展示了RequestHandler类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createRequestHandlers
import com.vaadin.server.RequestHandler; //导入依赖的package包/类
@Override
protected List<RequestHandler> createRequestHandlers()
throws ServiceException {
List<RequestHandler> handlers = super.createRequestHandlers();
handlers.add(0, new ServletBootstrapHandler());
handlers.add(new ServletUIInitHandler());
if (isAtmosphereAvailable()) {
handlers.add((RequestHandler) (session, request, response) -> {
if (!ServletPortletHelper.isPushRequest(request)) {
return false;
}
if (request instanceof VertxVaadinRequest) {
((VertxVaadinRequest) request).getRoutingContext().next();
}
return true;
});
}
return handlers;
}
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:20,代码来源:VertxVaadinService.java
示例2: initRequestHandler
import com.vaadin.server.RequestHandler; //导入依赖的package包/类
/**
* initalize a unique RequestHandler
*/
private void initRequestHandler() {
if (this.requestHandlerUri == null) {
this.requestHandlerUri = UUID.randomUUID()
.toString();
VaadinSession.getCurrent()
.addRequestHandler(new RequestHandler() {
@Override
public boolean handleRequest(final VaadinSession session, final VaadinRequest request, final VaadinResponse response)
throws IOException {
if (String.format("/%s", Jcrop.this.requestHandlerUri)
.equals(request.getPathInfo())) {
Jcrop.this.resource.getStream()
.writeResponse(request, response);
return true;
} else {
return false;
}
}
});
}
}
开发者ID:melistik,项目名称:vaadin-jcrop,代码行数:26,代码来源:Jcrop.java
示例3: servletInitialized
import com.vaadin.server.RequestHandler; //导入依赖的package包/类
@Override
protected void servletInitialized() throws ServletException {
super.servletInitialized();
HeaderTagHandler.init(getService());
getService().addSessionInitListener(new SessionInitListener() {
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
event.getSession().addRequestHandler(new RequestHandler() {
@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request,
VaadinResponse response) throws IOException {
String pathInfo = request.getPathInfo();
InputStream in = null;
if (pathInfo.endsWith("sw.js")) {
response.setContentType("application/javascript");
in = getClass().getResourceAsStream("/sw.js");
}
if (in != null) {
OutputStream out = response.getOutputStream();
IOUtils.copy(in, out);
in.close();
out.close();
return true;
} else {
return false;
}
}
});
}
});
}
开发者ID:amahdy,项目名称:java-pwa,代码行数:41,代码来源:MyUI.java
示例4: createRequestHandler
import com.vaadin.server.RequestHandler; //导入依赖的package包/类
/**
* Creates the parameter handler that will be invoked when the user returns
* from the OAuth service.
*
* @return the parameter handler
*/
protected RequestHandler createRequestHandler() {
return new RequestHandler() {
public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response)
throws IOException {
if (request.getParameterMap().containsKey(getVerifierName())) {
String v = request.getParameter(getVerifierName());
Verifier verifier = new Verifier(v);
accessToken = service
.getAccessToken(requestToken, verifier);
User user = getUser();
VaadinSession.getCurrent().removeRequestHandler(handler);
handler = null;
//String url = getAuthUrl();
//callbackPage.open(url, "Authentificate", 400, 300, BorderStyle.DEFAULT);
authListener.userAuthenticated(user);
} else if (getFailureParameters() != null) {
for (String key : getFailureParameters()) {
if (request.getParameterMap().containsKey(key)) {
authListener.failed(request.getParameter(key));
break;
}
}
}
return true;
}
};
}
开发者ID:ahn,项目名称:mideaas,代码行数:40,代码来源:OAuthButton.java
注:本文中的com.vaadin.server.RequestHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论