定制 garvinhicking/redirect-forward-example 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

garvinhicking/redirect-forward-example

最新稳定版本:0.1.0

Composer 安装命令:

composer require garvinhicking/redirect-forward-example

包简介

README 文档

README

A TYPO3 example of handling redirects and forwards.

TYPO3 Extbase has an ActionController::processRequest() handling that calls:

  • execute initializeAction()
  • execute initialize[TARGET]Action()
  • Perform argument mapping
  • execute [TARGET]Action()

The actual actions return ResponseInterface objects. Only those can interact properly with a RedirectResponse or a ForwardResponse.

The difference:

  • Redirect performs an additional HTTP request
  • Forward operates within the same HTTP request

The initialize[TARGET]Action() methods however can not deal with forwarding to other methods, because vital arguments and view mapping has not yet taken place.

To deal with this you can:

  • throw an immediate PropagateResponseException($response) exception. That ends the FULL HTTP Request and emits an error. Note that if your Extbase plugin is just one content element on a page, this will "kill" the full page flow and emit the message you have passed in $response.

  • Let your initialize actions make the arguments valid again, so that your actual action can be called. Then the actual action handles this state and performs redirection or forwarding. You can for example enrich your request context with a specific attribute to flag this needed forwarding. This will allow you to just act on the Extbase plugin level, and not the whole page-level.

To showcase this, this extensions DummyController makes use of several variants on how to handle it.

Enjoy. Let me know if this helped you in any way, shape or form.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-10-17