/** * Builds the request. * @return a build of the given parameters */ public RequestImpl build() { return new RequestImpl(new play.api.mvc.RequestImpl( body(), id, asScala(tags()), uri.toString(), uri.getRawPath(), method, version, mapListToScala(splitQuery()), buildHeaders(), remoteAddress, secure)); }
@Override public CompletionStage<Result> call(Http.Request req) { CSRFActionHelper helper = new CSRFActionHelper(sessionConfiguration, config, tokenSigner, tokenProvider); play.api.mvc.Request<RequestBody> taggedRequest = helper.tagRequestFromHeader(req.asScala()); if (helper.getTokenToValidate(taggedRequest).isEmpty()) { // No token in header and we have to create one if not found, so create a new token CSRF.Token newToken = helper.generateToken(); // Create a new Scala RequestHeader with the token taggedRequest = helper.tagRequest(taggedRequest, newToken); // Also add it to the response return delegate.call(new RequestImpl(taggedRequest)).thenApply(result -> placeToken(req, result, newToken)); } return delegate.call(new RequestImpl(taggedRequest)); }
@Override public CompletionStage<Result> call(Http.Request req) { CSRFActionHelper helper = new CSRFActionHelper(sessionConfiguration, config, tokenSigner, tokenProvider); play.api.mvc.Request<RequestBody> taggedRequest = helper.tagRequestFromHeader(req.asScala()); if (helper.getTokenToValidate(taggedRequest).isEmpty()) { // No token in header and we have to create one if not found, so create a new token CSRF.Token newToken = helper.generateToken(); // Create a new Scala RequestHeader with the token taggedRequest = helper.tagRequest(taggedRequest, newToken); // Also add it to the response return delegate.call(new RequestImpl(taggedRequest)).thenApply(result -> placeToken(req, result, newToken)); } return delegate.call(new RequestImpl(taggedRequest)); }
@Override public void preStart() { try { this.playWebSocket = new PlayWebSocket(actorRef, atmosphereConfig); this.webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(atmosphereConfig.framework()); AtmosphereRequest atmosphereRequest = AtmosphereUtils.request(new Http.RequestImpl(requestHeader), additionalAttributes); this.webSocketProcessor.open(playWebSocket, atmosphereRequest, AtmosphereResponseImpl.newInstance(atmosphereConfig, atmosphereRequest, playWebSocket)); } catch (Throwable throwable) { LOG.error("Failed to start the actor ", throwable); } }
/** * Builds the request. * * @return a build of the given parameters */ public RequestImpl build() { return new RequestImpl(req); }
/** * Builds the request. * * @return a build of the given parameters */ public RequestImpl build() { return new RequestImpl(req); }
/** * This method returns a new request, based on the current underlying with a giving username. * @param username the new user name * @return a new request with a request body based on the current request */ public Request withUsername(String username) { return new RequestImpl(this.underlying, username); }
/** * Builds the request. * * @return a build of the given parameters */ public RequestImpl build() { return new RequestImpl(req); }