如何禁用特定模块的错误控制器(How to disable error controller for a specific module)
我有一个模块Api,我正在尝试实现RESTful API。 问题是当我在该模块中抛出异常时,我希望抛出异常而不是由默认模块中的错误控制器处理。
是否可以在Zend Framework中仅为特定模块禁用错误控制器?
I have a module Api where I am trying to implement a RESTful API. The problem is that when I throw an exception in that module, I would like the exception to be thrown and not handled by the error controller in the default module.
Is it possible to disable the error controller for just a specific module in Zend Framework?
原文:https://stackoverflow.com/questions/9137119
最满意答案
这里有两个问题:
- cd本身不是可执行文件; 它是命令shell的内置命令。
exec
只运行可执行文件(在自己的文件中)。 这就是为什么没找到它。exec
可以运行命令shell,但是......- 即使您在命令shell中更改了目录,该更改仅对新生成的进程有效,而不是对启动它的程序有效。
抱歉,这种方法在Java中不起作用。
Thank you everyone for your answers. They were wordy, though, so in this answer I will try to summarize it.
When you call
Runtime.getRuntime.exec()
, you must specify what shell you are using (only on Windows). So, you would sayRuntime.getRuntime.exec("command here", "cmd.exe")
. As you probably know, CMD is the Windows command shell for modern Windows operating systems.Once again, thank you for your answers.
相关问答
更多-
LINUX 如何查看JPG文件[2022-06-13]
find -
直接将word.txt作为项目根文件夹和src的同级的子项 Project_Root src word.txt 免责声明:我想解释为什么这适用于这种特殊情况,以及为什么它可能不适用于其他人。 它为什么有效: 当您使用File或任何其他FileXxx变体时,您正在文件系统上查找与“工作目录”相关的文件。 工作目录,可以这样描述: 当你从命令行运行时 C:\EclipseWorkspace\ProjectRoot\bin > java com.mypackage.Hangman1 工作目录是C ...
-
你能试试吗? // Java runtime Runtime runtime = Runtime.getRuntime(); // Command String command = "I:/Release/program.exe" ; // Process Process process = runtime.exec(command, null, new File("I:/Release")); Can you try this ? // Java runtime Runtime runtime = Ru ...
-
我拿了你的代码并使用以下命令行参数执行它: in.txt out.txt 它完全没有问题。 检查命令行。 I took your code and executed it with the following command-line params: in.txt out.txt It works with no problems at all. Check your command line.
-
要么您没有在系统中设置系统属性'conf.path',要么您没有在'conf.path'路径下放置文件。 查看用于设置系统属性的setting-system- properties。 如果您不想设置系统属性'conf.path',则可以更改文件的位置。 要轻松更改属性,最好将所有属性文件保存在一个位置,该位置不属于Web容器的一部分。 在'user.home'中存储属性是明智的想法。 例如:你必须flush() ,你应该在写入File后close() (也将flush() )。 out.write(prg); out.close(); // <-- add this. 此外,您需要将python添加到PATH中。 Sorry, this is probably really unhelpful, but somehow, it just started working. No idea why or how, because I haven't changed anything. Eclip ...
无法启动java.exe:系统找不到指定的文件(Unable to start java.exe: The system cannot find the file specified)[2022-09-14]
确保你已经安装了Java运行时环境,并且所有的路径都设置正确 - 特别是PATH (对jre / bin)和JAVA_HOME环境变量。 Make sure you have Java Runtime Environment installed, and all the paths set correctly - especially PATH(to the jre/bin) and JAVA_HOME environment variables.我们需要看到方法getFileName()以确定,但基于错误消息和方法名称,我怀疑问题只是该方法只返回文件的名称,删除路径信息,以便文件确实没有找到。 We need to see the method getFileName() to be sure, but based on the error message and the method name, I suspect the problem is just that this method returns only the name of the ...这是因为你没有正确使用ProcessBuilder 。 Javadocs非常清晰。 您不能将--version参数作为您尝试调用的进程名称的一部分传递; 这不是流程的文件名。 在幕后你直接执行一个流程 - 不涉及任何外壳。 ProcessBuilder svnProcessBuilder = new ProcessBuilder("svn", "--version"); It's because you're not using ProcessBuilder correctly. The Javadocs ...这里有两个问题: cd本身不是可执行文件; 它是命令shell的内置命令。 exec只运行可执行文件(在自己的文件中)。 这就是为什么没找到它。 exec可以运行命令shell,但是...... 即使您在命令shell中更改了目录,该更改仅对新生成的进程有效,而不是对启动它的程序有效。 抱歉,这种方法在Java中不起作用。 Thank you everyone for your answers. They were wordy, though, so in this answer I will try to ...相关文章
更多- The connection to adb is down, and a severe error has occured.
- 第四章 Controller接口控制器详解(1)——跟着开涛学SpringMVC
- 第四章 Controller接口控制器详解(7 完)——跟着开涛学SpringMVC
- 第四章 Controller接口控制器详解 (4)——跟着开涛学SpringMVC
- 第四章 Controller接口控制器详解(5)——跟着开涛学SpringMVC
- 第四章 Controller接口控制器详解(6)——跟着开涛学SpringMVC
- 第四章 Controller接口控制器详解(2)——跟着开涛学SpringMVC
- 第四章 Controller接口控制器详解(3)——跟着开涛学SpringMVC
- eclipse里报:An internal error occurred during:
- Drupal Forums instead of phpBB or vBulletin: A casestudy
最新问答
更多- h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
- 创建一个功能(Create a function)
- 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
- PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
- Qt冻结循环的原因?(Qt freezing cause of the loop?)
- TableView重复youtube-api结果(TableView Repeating youtube-api result)
- 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
- SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
- 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
- 以编程方式创建UITableView(Creating a UITableView Programmatically)
- 如何打破按钮上的生命周期循环(How to break do-while loop on button)
- C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
- 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
- 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
- Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
- 设置kotlin扩展名(Setting a kotlin extension)
- 如何并排放置两个元件?(How to position two elements side by side?)
- 如何在vim中启用python3?(How to enable python3 in vim?)
- 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
- 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
- Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
- dedecms如何安装?
- 在哪儿学计算机最好?
- 学php哪个的书 最好,本人菜鸟
- 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
- 如何覆盖错误堆栈getter(How to override Error stack getter)
- 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
- USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
- 电脑高中毕业学习去哪里培训
- 正则表达式验证SMTP响应(Regex to validate SMTP Responses)