我一直在使用url参数将参数传递给.jar应用程序的main方法.在Windows 7上更新到最新的jre 7u7后,Java-web-start启动程序在启动文件时崩溃.
(JNLP download-servlet和jsp-page解析url-parameters并在参数中进一步向下输入)
jsp的有趣部分
<jnlp spec="6.0+" codebase="http://localhost:8080/" href="myfile.jnlp?username=charles">
...
<application-desc main-class="MyMain">
<argument><%=request.getParameter("username")%></argument>
</application-desc>
</jnlp>
Run Code Online (Sandbox Code Playgroud)
所以这可能是也可能不是bug,
Q1:我一直在以正确的方式使用href属性吗?
Q2:任何聪明的想法如何解决问题?
有没有人成功使用上述配置?我试图使用从primefaces咆哮的推动.我正在使用primefaces 3.5 GlassFish 4.0和Atmosphere 2.0.0.RC5我的配置如下:
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
Bean方法:
private void assaginTreatment()
{
...
PushContext pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/notifications", facesMsg);
return;
}
Run Code Online (Sandbox Code Playgroud)
最后是xhtml文件:
<p:growl widgetVar="growl" showDetail="true" sticky="true" globalOnly="true" autoUpdate="true" />
<p:socket onMessage="handleMessage" channel="/notifications" autoConnect="true"/>
<script type="text/javascript">
function handleMessage(facesmessage) {
facesmessage.severity = 'info';
PF('growl').show([facesmessage]);
}
</script>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
SEVERE: [http-listener-1(4)] WARN org.atmosphere.cpr.MetaBroadcaster - No Broadcaster match /notifications. Message...
在jee6教程中,我可以阅读以下内容:
@Named限定符允许您使用bean名称访问bean,第一个字母为小写.例如,Facelets页面将bean称为打印机.
您可以指定@Named限定符的参数以使用非默认名称:
但是,当我尝试使用@Named而不添加参数时,找不到我的bean,我得到如下的异常.
@Named
@ViewScoped
public class MTestBean {
...
}
Run Code Online (Sandbox Code Playgroud)
例外;
javax.servlet.ServletException: /MyPage.xhtml @15,65 listener="#{mTestBean.init}": Target Unreachable, identifier 'mTestBean' resolved to null
Run Code Online (Sandbox Code Playgroud)
但如果我使用
@Named("mTestBean")
Run Code Online (Sandbox Code Playgroud)
一切正常.这是预期的行为吗?有没有办法我可以列出EL中可用的bean,也许我假设错误的默认名称?
在实用程序库中,我正在创建ExecutorService
ExecutorService es = Executors.newSingleThreadExecutor();
Run Code Online (Sandbox Code Playgroud)
然后主线程将一些任务发布到此ExecutorService.当主线程完成时,我想关闭ExecutorService以允许应用程序退出.
问题是我只能更改实用程序库中的代码.我考虑过的一个选择是使用守护进程线程.但是,在发布到服务的任务完成之前,它会突然关闭.
我正在做毕业设计,在这里遇到了难题。我需要制作一个生成PDF并按数据库中数据定义的时间表通过电子邮件将其发送给人们的应用程序。我正在为此项目的公司工作,我们已经有一个使用的GlassFish应用程序服务器。最好是像现在这样将整个解决方案打包在一个软件包中交付。带有webstart Web应用程序等的客户端都在一个软件包中
我的新服务需要在单独的线程上运行,生成报告并通过电子邮件发送出去。从Web上可以阅读的内容来看,强烈建议不要使用GlassFish在应用程序服务器中运行自己的线程,因此听起来我需要制作自己的独立应用程序。
真的可以吗?您对此有何评论?最佳实践是什么?
使用地图 API,我可以在清单中声明我的密钥:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AlOtOfNumBersAndLetters123" />
Run Code Online (Sandbox Code Playgroud)
但在 Youtube API 中,我必须以编程方式(AFAIK):
String API_KEY = "AlOtOfNumBersAndLetters123";
youTubePlayerFragment.initialize(API_KEY, myOnInitializedListener);
Run Code Online (Sandbox Code Playgroud)
我该如何使用 Youtube API 清单中声明的密钥?
在使用Android Studio中的预览工具创建布局时,我一直在使用以下内容.
<TextView
android:id="@+id/my_text_view"
android:text="87%" />
Run Code Online (Sandbox Code Playgroud)
缺点是,如果在实际值可用之前存在延迟,则UI将显示87%为瞬间.
有什么办法可以很好地处理这个问题?
让我们说我们有按钮
<h:form>
<p:commandButton id="refreshButton" value="refresh all depending components"/>
</h:form>
Run Code Online (Sandbox Code Playgroud)
在此过程中,我将添加在单击按钮时应更新的组件.所以使用update ="text1,text2"是不够的,因为text3可能会在以后添加,并且不需要更改刷新按钮.
<h:outputText id="text1" value="{bean.someValue1}></h:outputText>
<h:outputText id="text2" value="{bean.someValue2}></h:outputText>
Run Code Online (Sandbox Code Playgroud)
... 然后 ...
<h:outputText id="text3" value="{bean.someValue3}></h:outputText>
Run Code Online (Sandbox Code Playgroud)
我想要做的是将组件绑定到按钮,而不是依赖于组件的按钮
我需要一种Java方法来查找正在运行的操作系统进程,我知道该进程的名称和可执行文件的路径.我想看看它现在是否正在运行,如果我发现它,我需要一种方法来终止这个过程.
我的问题类似于如何从java中查找并杀死 - 运行 - 获胜 - 进程 -但不限于Windows.
我是否被迫每个平台执行一次实现,或者是否有一些技巧/库/ api我不知道可以做到这一点?
使用atmosphere-runtime-2.0.0GlassFish的4一起,primefaces-4.0.RC1我得到下面的错误堆栈跟踪垃圾邮件.这只发生在我的一个glassfish-4安装(linux + openjdk)上,而不是另一个在Windows 7上运行相同的应用程序(我真的不认为它是操作系统问题..)
在glassfish配置中,我为http-listener-1启用了comet和websockets.除此之外,一切都应该是默认的glassfish-4设置(不同的数据库等,但我希望这真的不相关).
是否有一些设置我忘记了导致不同行为的gf4实例之一?
[#|2013-09-21T23:38:23.159+0200|INFO|glassfish 4.0||_ThreadID=20;_ThreadName=Thread-3;_TimeMillis=1379799503159;_LevelValue=800;|
2013-09-21 23:38:23,159 [p-listener-1(2)] ERROR AtmosphereFramework - AtmosphereFramework exception
java.lang.IllegalStateException: Request is within the scope of a filter or servlet that does not support asynchronous operations
at org.apache.catalina.connector.Request.startAsync(Request.java:4259)
at org.apache.catalina.connector.Request.startAsync(Request.java:4236)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1044)
at org.atmosphere.cpr.AtmosphereRequest.startAsync(AtmosphereRequest.java:505)
at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:128)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:103)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1675)
at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:177)
at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:253)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at …Run Code Online (Sandbox Code Playgroud) 我知道谓词的基础知识,并理解下面从这个问题复制的代码
Predicate<Integer> isEven = new Predicate<Integer>() {
@Override public boolean apply(Integer number) {
return (number % 2) == 0;
}
};
Iterable<Integer> evenNumbers = Iterables.filter(numbers, isEven);
Run Code Online (Sandbox Code Playgroud)
但是有可能为与谓词不匹配的项获得可迭代(不更改谓词代码)吗?
java ×6
jsf-2 ×3
primefaces ×3
android ×2
atmosphere ×2
glassfish-4 ×2
ajax ×1
cdi ×1
collections ×1
el ×1
glassfish ×1
guava ×1
java-ee ×1
jnlp ×1
kill ×1
runtime.exec ×1
service ×1
threadpool ×1