You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "hou wj (JIRA)" <ji...@apache.org> on 2012/08/07 05:09:02 UTC
[jira] [Created] (WW-3862) help,request.getServletPath() still
return null
hou wj created WW-3862:
--------------------------
Summary: help,request.getServletPath() still return null
Key: WW-3862
URL: https://issues.apache.org/jira/browse/WW-3862
Project: Struts 2
Issue Type: Improvement
Components: Dispatch Filter
Affects Versions: 2.3.1
Environment: websphere 7.0.12,struts2.3.1.1,jdk1.5
Reporter: hou wj
I tried the URL you provided like this,【http://struts.apache.org/2.x/docs/websphere.html】。
I don’t want a temporary fix,so I try the solution of servlet LaunchServlet as you provided like this:
1) add a servlet that initializes the Struts Dispatcher with the servlet context:
import org.apache.struts2.dispatcher.Dispatcher;
public class LaunchServlet extends HttpServlet implements Servlet {
public LaunchServlet() {
super();
}
public void init(ServletConfig arg0) throws ServletException {
// this works around a bug in the websphere classloader.
super.init(arg0);
Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String, String>());
}
}
2) launch it at start-up (web.xml):
<servlet>
<servlet-name>dummyaction</servlet-name>
<servlet-class>com.xxx.yyyyyy.service.LaunchServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
3) Run application and everything should work.
But it not works ,the method request.getServletPath() still return null
I use struts2.3.1,and websphere 7.0.12
Follws is before my issue: https://issues.apache.org/jira/browse/WW-3859
I use as follows
I create a class:
public abstract class BaseAction extends ActionSupport implements
ServletRequestAware, ServletResponseAware, ServletContextAware {
protected HttpServletRequest request;
protected HttpServletResponse response;
protected HttpSession session;
.........
public String getServletPath(){ return request.getServletPath(); }
..........
// get / set method
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
public void setServletContext(ServletContext context) {
this.context = context;
}
}
now ,in tomcat 5.5 run environment,getServletPath() method can return correct value,but in websphere 7,it return null.first,i distrust it is some problem in webphere.so i create a simple jsp file and write above code in new jsp file,very magical,it return correct value.i arrive the net to look for the answer.but,nothing i find.it's struts bug?Looking forward to reply.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3862) help,request.getServletPath() still
return null
Posted by "jagub zhang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433004#comment-13433004 ]
jagub zhang commented on WW-3862:
---------------------------------
I don't think it is a problem, at least about struts.
It is just different interpretations of RequestURI.
http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html
you can found:
RequestURI = contextPath + sevletPath + pathInfo
for example:
if RequestURI is /sample/aaa/bbb/someAction
in tomcat:
contextPath = /sample
sevletPath = /aaa/bbb/someAction
pathInfo = null
in webphere:
contextPath = /sample
sevletPath = null
pathInfo = /aaa/bbb/someAction
You can use request.getPathInfo() in webphere environment.
or
If you want get same result in tomcat and webphere, use
request.getRequestURI().substring(request.getContextPath().length())
> help,request.getServletPath() still return null
> -----------------------------------------------
>
> Key: WW-3862
> URL: https://issues.apache.org/jira/browse/WW-3862
> Project: Struts 2
> Issue Type: Bug
> Components: Dispatch Filter
> Affects Versions: 2.3.1
> Environment: websphere 7.0.12,struts2.3.1.1,jdk1.5
> Reporter: hou wj
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I tried the URL you provided like this,【http://struts.apache.org/2.x/docs/websphere.html】。
> I don’t want a temporary fix,so I try the solution of servlet LaunchServlet as you provided like this:
> 1) add a servlet that initializes the Struts Dispatcher with the servlet context:
> import org.apache.struts2.dispatcher.Dispatcher;
>
> public class LaunchServlet extends HttpServlet implements Servlet {
>
> public LaunchServlet() {
> super();
> }
>
> public void init(ServletConfig arg0) throws ServletException {
>
> // this works around a bug in the websphere classloader.
> super.init(arg0);
> Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String, String>());
>
> }
>
> }
> 2) launch it at start-up (web.xml):
> <servlet>
> <servlet-name>dummyaction</servlet-name>
> <servlet-class>com.xxx.yyyyyy.service.LaunchServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> 3) Run application and everything should work.
> But it not works ,the method request.getServletPath() still return null
> I use struts2.3.1,and websphere 7.0.12
> Follws is before my issue: https://issues.apache.org/jira/browse/WW-3859
> I use as follows
> I create a class:
> public abstract class BaseAction extends ActionSupport implements
> ServletRequestAware, ServletResponseAware, ServletContextAware {
> protected HttpServletRequest request;
> protected HttpServletResponse response;
> protected HttpSession session;
> .........
> public String getServletPath(){ return request.getServletPath(); }
> ..........
> // get / set method
> public void setServletRequest(HttpServletRequest request) {
> this.request = request;
> }
> public void setServletResponse(HttpServletResponse response) {
> this.response = response;
> }
> public void setServletContext(ServletContext context) {
> this.context = context;
> }
> }
> now ,in tomcat 5.5 run environment,getServletPath() method can return correct value,but in websphere 7,it return null.first,i distrust it is some problem in webphere.so i create a simple jsp file and write above code in new jsp file,very magical,it return correct value.i arrive the net to look for the answer.but,nothing i find.it's struts bug?Looking forward to reply.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3862) help,request.getServletPath() still
return null
Posted by "hou wj (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
hou wj updated WW-3862:
-----------------------
Issue Type: Bug (was: Improvement)
Remaining Estimate: 24h (was: 48h)
Original Estimate: 24h (was: 48h)
> help,request.getServletPath() still return null
> -----------------------------------------------
>
> Key: WW-3862
> URL: https://issues.apache.org/jira/browse/WW-3862
> Project: Struts 2
> Issue Type: Bug
> Components: Dispatch Filter
> Affects Versions: 2.3.1
> Environment: websphere 7.0.12,struts2.3.1.1,jdk1.5
> Reporter: hou wj
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I tried the URL you provided like this,【http://struts.apache.org/2.x/docs/websphere.html】。
> I don’t want a temporary fix,so I try the solution of servlet LaunchServlet as you provided like this:
> 1) add a servlet that initializes the Struts Dispatcher with the servlet context:
> import org.apache.struts2.dispatcher.Dispatcher;
>
> public class LaunchServlet extends HttpServlet implements Servlet {
>
> public LaunchServlet() {
> super();
> }
>
> public void init(ServletConfig arg0) throws ServletException {
>
> // this works around a bug in the websphere classloader.
> super.init(arg0);
> Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String, String>());
>
> }
>
> }
> 2) launch it at start-up (web.xml):
> <servlet>
> <servlet-name>dummyaction</servlet-name>
> <servlet-class>com.xxx.yyyyyy.service.LaunchServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> 3) Run application and everything should work.
> But it not works ,the method request.getServletPath() still return null
> I use struts2.3.1,and websphere 7.0.12
> Follws is before my issue: https://issues.apache.org/jira/browse/WW-3859
> I use as follows
> I create a class:
> public abstract class BaseAction extends ActionSupport implements
> ServletRequestAware, ServletResponseAware, ServletContextAware {
> protected HttpServletRequest request;
> protected HttpServletResponse response;
> protected HttpSession session;
> .........
> public String getServletPath(){ return request.getServletPath(); }
> ..........
> // get / set method
> public void setServletRequest(HttpServletRequest request) {
> this.request = request;
> }
> public void setServletResponse(HttpServletResponse response) {
> this.response = response;
> }
> public void setServletContext(ServletContext context) {
> this.context = context;
> }
> }
> now ,in tomcat 5.5 run environment,getServletPath() method can return correct value,but in websphere 7,it return null.first,i distrust it is some problem in webphere.so i create a simple jsp file and write above code in new jsp file,very magical,it return correct value.i arrive the net to look for the answer.but,nothing i find.it's struts bug?Looking forward to reply.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3862) help,request.getServletPath() still
return null
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-3862:
------------------------------
Fix Version/s: (was: 2.3.5)
2.3.6
> help,request.getServletPath() still return null
> -----------------------------------------------
>
> Key: WW-3862
> URL: https://issues.apache.org/jira/browse/WW-3862
> Project: Struts 2
> Issue Type: Bug
> Components: Dispatch Filter
> Affects Versions: 2.3.1
> Environment: websphere 7.0.12,struts2.3.1.1,jdk1.5
> Reporter: hou wj
> Fix For: 2.3.6
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I tried the URL you provided like this,【http://struts.apache.org/2.x/docs/websphere.html】。
> I don’t want a temporary fix,so I try the solution of servlet LaunchServlet as you provided like this:
> 1) add a servlet that initializes the Struts Dispatcher with the servlet context:
> import org.apache.struts2.dispatcher.Dispatcher;
>
> public class LaunchServlet extends HttpServlet implements Servlet {
>
> public LaunchServlet() {
> super();
> }
>
> public void init(ServletConfig arg0) throws ServletException {
>
> // this works around a bug in the websphere classloader.
> super.init(arg0);
> Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String, String>());
>
> }
>
> }
> 2) launch it at start-up (web.xml):
> <servlet>
> <servlet-name>dummyaction</servlet-name>
> <servlet-class>com.xxx.yyyyyy.service.LaunchServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> 3) Run application and everything should work.
> But it not works ,the method request.getServletPath() still return null
> I use struts2.3.1,and websphere 7.0.12
> Follws is before my issue: https://issues.apache.org/jira/browse/WW-3859
> I use as follows
> I create a class:
> public abstract class BaseAction extends ActionSupport implements
> ServletRequestAware, ServletResponseAware, ServletContextAware {
> protected HttpServletRequest request;
> protected HttpServletResponse response;
> protected HttpSession session;
> .........
> public String getServletPath(){ return request.getServletPath(); }
> ..........
> // get / set method
> public void setServletRequest(HttpServletRequest request) {
> this.request = request;
> }
> public void setServletResponse(HttpServletResponse response) {
> this.response = response;
> }
> public void setServletContext(ServletContext context) {
> this.context = context;
> }
> }
> now ,in tomcat 5.5 run environment,getServletPath() method can return correct value,but in websphere 7,it return null.first,i distrust it is some problem in webphere.so i create a simple jsp file and write above code in new jsp file,very magical,it return correct value.i arrive the net to look for the answer.but,nothing i find.it's struts bug?Looking forward to reply.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3862) help,request.getServletPath() still
return null
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-3862:
------------------------------
Fix Version/s: 2.3.5
> help,request.getServletPath() still return null
> -----------------------------------------------
>
> Key: WW-3862
> URL: https://issues.apache.org/jira/browse/WW-3862
> Project: Struts 2
> Issue Type: Bug
> Components: Dispatch Filter
> Affects Versions: 2.3.1
> Environment: websphere 7.0.12,struts2.3.1.1,jdk1.5
> Reporter: hou wj
> Fix For: 2.3.5
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I tried the URL you provided like this,【http://struts.apache.org/2.x/docs/websphere.html】。
> I don’t want a temporary fix,so I try the solution of servlet LaunchServlet as you provided like this:
> 1) add a servlet that initializes the Struts Dispatcher with the servlet context:
> import org.apache.struts2.dispatcher.Dispatcher;
>
> public class LaunchServlet extends HttpServlet implements Servlet {
>
> public LaunchServlet() {
> super();
> }
>
> public void init(ServletConfig arg0) throws ServletException {
>
> // this works around a bug in the websphere classloader.
> super.init(arg0);
> Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String, String>());
>
> }
>
> }
> 2) launch it at start-up (web.xml):
> <servlet>
> <servlet-name>dummyaction</servlet-name>
> <servlet-class>com.xxx.yyyyyy.service.LaunchServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> 3) Run application and everything should work.
> But it not works ,the method request.getServletPath() still return null
> I use struts2.3.1,and websphere 7.0.12
> Follws is before my issue: https://issues.apache.org/jira/browse/WW-3859
> I use as follows
> I create a class:
> public abstract class BaseAction extends ActionSupport implements
> ServletRequestAware, ServletResponseAware, ServletContextAware {
> protected HttpServletRequest request;
> protected HttpServletResponse response;
> protected HttpSession session;
> .........
> public String getServletPath(){ return request.getServletPath(); }
> ..........
> // get / set method
> public void setServletRequest(HttpServletRequest request) {
> this.request = request;
> }
> public void setServletResponse(HttpServletResponse response) {
> this.response = response;
> }
> public void setServletContext(ServletContext context) {
> this.context = context;
> }
> }
> now ,in tomcat 5.5 run environment,getServletPath() method can return correct value,but in websphere 7,it return null.first,i distrust it is some problem in webphere.so i create a simple jsp file and write above code in new jsp file,very magical,it return correct value.i arrive the net to look for the answer.but,nothing i find.it's struts bug?Looking forward to reply.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3862) help,request.getServletPath() still
return null
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437888#comment-13437888 ]
Lukasz Lenart commented on WW-3862:
-----------------------------------
Could you first ask such a question on the "Struts Users Mailing List" <us...@struts.apache.org>" and not to open another issue ?
> help,request.getServletPath() still return null
> -----------------------------------------------
>
> Key: WW-3862
> URL: https://issues.apache.org/jira/browse/WW-3862
> Project: Struts 2
> Issue Type: Bug
> Components: Dispatch Filter
> Affects Versions: 2.3.1
> Environment: websphere 7.0.12,struts2.3.1.1,jdk1.5
> Reporter: hou wj
> Fix For: 2.3.5
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I tried the URL you provided like this,【http://struts.apache.org/2.x/docs/websphere.html】。
> I don’t want a temporary fix,so I try the solution of servlet LaunchServlet as you provided like this:
> 1) add a servlet that initializes the Struts Dispatcher with the servlet context:
> import org.apache.struts2.dispatcher.Dispatcher;
>
> public class LaunchServlet extends HttpServlet implements Servlet {
>
> public LaunchServlet() {
> super();
> }
>
> public void init(ServletConfig arg0) throws ServletException {
>
> // this works around a bug in the websphere classloader.
> super.init(arg0);
> Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String, String>());
>
> }
>
> }
> 2) launch it at start-up (web.xml):
> <servlet>
> <servlet-name>dummyaction</servlet-name>
> <servlet-class>com.xxx.yyyyyy.service.LaunchServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> 3) Run application and everything should work.
> But it not works ,the method request.getServletPath() still return null
> I use struts2.3.1,and websphere 7.0.12
> Follws is before my issue: https://issues.apache.org/jira/browse/WW-3859
> I use as follows
> I create a class:
> public abstract class BaseAction extends ActionSupport implements
> ServletRequestAware, ServletResponseAware, ServletContextAware {
> protected HttpServletRequest request;
> protected HttpServletResponse response;
> protected HttpSession session;
> .........
> public String getServletPath(){ return request.getServletPath(); }
> ..........
> // get / set method
> public void setServletRequest(HttpServletRequest request) {
> this.request = request;
> }
> public void setServletResponse(HttpServletResponse response) {
> this.response = response;
> }
> public void setServletContext(ServletContext context) {
> this.context = context;
> }
> }
> now ,in tomcat 5.5 run environment,getServletPath() method can return correct value,but in websphere 7,it return null.first,i distrust it is some problem in webphere.so i create a simple jsp file and write above code in new jsp file,very magical,it return correct value.i arrive the net to look for the answer.but,nothing i find.it's struts bug?Looking forward to reply.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira