- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 WebSphere 上使用 JSF 1.1 (MyFaces 1.1.8) 时遇到问题。在 Tomcat 5.5 上部署我的应用程序时,此行为不适用,一切正常。
当我尝试从 Ogone(支付网关)发回的 URL 读取参数并再次加入我的 JSF session ( session 仍然存在)时,查询字符串无法通过
final HttpServletRequest request = (HttpServletRequest)FacesContext
.getCurrentInstance().getExternalContext().getRequest();
String qs = request.getQueryString(); // null on WebSphere, filled on Tomcat
为了更完整一点,查询字符串看起来像这样:
http://100.100.100.100:9080/my_app_context/pages/screen7.jsf?orderID=4208013442596271¤cy=EUR&amount=60&PM=iDEAL&ACCEPTANCE=0000000000&STATUS=9&CARDNO=11-XXXX-11&ED=&CN=K%C3%A9m+Birdy&TRXDATE=08%2F06%2F12&PAYID=15879916&NCERROR=0&BRAND=iDEAL&COMPLUS=personID%3D01%26subscriptionID%3D02&IP=100.100.100.100&SHASIGN=9642468EE016BD49787B62EA7231124B3C24F9BBFC5B3B3B4D9E97D678979E57E5EED9B47D611441A6FCA2EB1D2DB87348C8111ACFF366A4E244106CCCFAFDA5
我正在考虑一些 WebSphere Web 容器设置,这些设置可能会阻止容器正确处理外部请求。或者这里可能存在一些类加载问题,但我无法找到它。
WebSphere 上的堆栈跟踪如下所示:
12-08-07 08:02:26 ERROR -
java.lang.NullPointerException
at ... own code trying to getQueryString()...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:459)
at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
at org.apache.myfaces.custom.security.SecurityContextPropertyResolver.getValue(SecurityContextPropertyResolver.java:101)
at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:539)
at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
at javax.faces.component.UIOutput.getValue(UIOutput.java:118)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:267)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:226)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:69)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:57)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:799)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:678)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
at com.ibm._jsp._aanmeldScherm7._jspx_meth_h_outputText_1(_aanmeldScherm7.java:204)
at com.ibm._jsp._aanmeldScherm7._jspx_meth_f_subview_0(_aanmeldScherm7.java:1870)
at com.ibm._jsp._aanmeldScherm7._jspService(_aanmeldScherm7.java:85)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1213)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1154)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:848)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:691)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:654)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:526)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:248)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:648)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1042)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:484)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at com.ibm._jsp._defaultLayout2._jspx_meth_tiles_insert_2(_defaultLayout2.java:392)
at com.ibm._jsp._defaultLayout2._jspx_meth_h_form_0(_defaultLayout2.java:597)
at com.ibm._jsp._defaultLayout2._jspx_meth_f_view_0(_defaultLayout2.java:715)
at com.ibm._jsp._defaultLayout2._jspService(_defaultLayout2.java:92)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1213)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1154)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:848)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:691)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:654)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:526)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:248)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:325)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:426)
at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:236)
at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:222)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:146)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:147)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1213)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1154)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:848)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:691)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:654)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:526)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:764)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:271)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1560)
如果有人能指出我正确的方向,请。
WebSphere 版本是 6.1.0.43。
最佳答案
好的,这可能对其他人有用。
深入研究 WebSphere Application Server 的自定义 Web 容器属性,我发现了这个:
Make query string available to the welcome file [Fix Pack 25 or later]
Typically, when a request is initially sent to the context root of the application, the request is forwarded to a welcome file. If a query string is included in an initial request, it is not available to the welcome file if you included the request.getQueryString() attribute in the welcome file. However, the query string is available to the welcome file if you included the javax.servlet.forward.query_string attribute in the welcome file.
If you need to use the request.getQueryString() attribute, instead of the javax.servlet.forward.query_string attribute, to make the query string available to the welcome file, add the com.ibm.ws.webcontainer.provideQStringToWelcomeFile custom property to your Web container configuration and set the property to true. The default value for this property is false. Name Value com.ibm.ws.webcontainer.provideQStringToWelcomeFile true
对于 WebSphere 6.1,可以在此处找到这些自定义属性:http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Frweb_custom_props.html
线索是,一旦转发请求,查询字符串本身就会从请求对象中剥离,为“内部”查询字符串留出空间。初始查询字符串仍然可用
request.getAttribute("javax.servlet.forward.query_string");
一切都有点棘手,但我们的代码现在很健壮,能够在 WebSphere 和其他 servlet 容器内运行,并且能够管理 Ogone 发送的 UTF-8 和 ISO-8859-1 编码查询字符串参数。
感谢您的聆听。
关于java - 在 WebSphere 上,ExternalContext 的 Request 对象上的 getQueryString 返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11840995/
我对 UTF-8 有一些问题。我的客户端(在 GWT 中实现)向我的 servlet 发出请求,在 URL 中包含一些参数,如下所示: http://localhost:8080/servlet?pa
我使用的是 Java EE,request.getQueryString() 不返回 #hash 部分 my/page?id=4#hash 我正在使用 Struts 2。 有什么解决办法吗? 最佳答案
我使用以下代码附加带有两个链接的查询字符串。但我想从查询字符串中排除分页的 page 参数。 Teachers Courses 有什么方法可以做到吗?我尝试了以下代码,但它生成错误。 except('
我有一个 java servlet 应用程序,我们正在将其从 WebSphere 移植到 TC Server 并从 java 2 升级到 java 7。 在测试中,我们发现以 % 符号结尾的参数(包括
我正在尝试将包含部分 URL 的变量输出到我页面上的 Javascript 中。当我这样做时,它会将任何 & 更改为 &,这会破坏 URL。 我试过使用 str_replace、html_entity
我的网址如 http://example.com/foo/?locale=en_US&xyz ,当我在 URL 上执行 getQueryString() 时,我返回一个空字符串 我正在 URL 上执行
我正在尝试将包含部分 URL 的变量输出到我页面上的 Javascript 中。当我这样做时,它会将任何 & 更改为 &,这会破坏 URL。 我试过使用 str_replace、html_entity
我有一个 JSP,可以从像这样的 url 访问 http://localhost/products.jsp (因此没有查询字符串),而该页面包含其他 JSP: 在 product.jsp
我有一个请求,在浏览器地址栏输入: http://localhost:8888/cmens-tops-outwear/t-b-f-a-c-s-fLoose-p-g-e-i-o.htm?'"-->net
在我当前的 Spring MVC 应用程序中,我们有如下所示的网关模块代码。 URI uri = new URI(restURLProtocol, null, URLDomain, URLPort,
我在菜单栏顶部构建了一个登录代码片段。如果用户通过导航进入任何页面并突然按下登录按钮,我希望看到该人通过身份验证,同时留在他最初来自的页面上。所以我在支持 bean 上使用了它: HttpServle
我在 WebSphere 上使用 JSF 1.1 (MyFaces 1.1.8) 时遇到问题。在 Tomcat 5.5 上部署我的应用程序时,此行为不适用,一切正常。 当我尝试从 Ogone(支付网关
我是一名优秀的程序员,十分优秀!