You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Olof Jönsson (JIRA)" <ji...@apache.org> on 2007/11/27 16:48:43 UTC

[jira] Commented: (AXIS2-1220) AxisServlet.initContextRoot assumes 1 level deep context

    [ https://issues.apache.org/jira/browse/AXIS2-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545880 ] 

Olof Jönsson commented on AXIS2-1220:
-------------------------------------

I've embedded axis2 into OSGi and I'm using the HTTP service. Unfortunately, I get the same problem here where the endpoint references lack the actual path to the servlet. I get http://localhost:8080/service/... directly in the WSDL instead of http://localhost:8080/axis2/service when the servlet is deployed on "/axis2". Isn't the problem here that getServletPath() isn't used? I changed the following lines of initContextRoot():

        String contextPath = req.getContextPath();
        //handling ROOT scenario, for servlets in the default (root) context, this method returns ""
        if (contextPath != null && contextPath.length() == 0) {
            contextPath = "/";
        }
        this.contextRoot = contextPath;

into this single line:

        this.contextRoot =  req.getContextPath() + req.getServletPath();

which corrected the problem for me.



> AxisServlet.initContextRoot assumes 1 level deep context
> --------------------------------------------------------
>
>                 Key: AXIS2-1220
>                 URL: https://issues.apache.org/jira/browse/AXIS2-1220
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.1
>         Environment: all
>            Reporter: Bob Stevenson
>            Assignee: Deepal Jayasinghe
>
> initContextRoot only grabs the first part of the context.  My context is /shop/wsengine , but this routine sets the contextRoot to only /shop.
> Then getEPRsForService() seems to rely on this for building the endpoints, which are incorrect.
> if (contextRoot == null) {
>             String [] parts = JavaUtils.split(req.getContextPath(), '/');
>             if (parts != null) {
>                 for (int i = 0; i < parts.length; i++) {
>                     if (parts[i].length() > 0) {
>                         contextRoot = parts[i];                 
>                         break;
>                     }
>                 }
>             }
>             if (contextRoot == null || req.getContextPath().equals("/")) {
>                 contextRoot = "/";
>             }
>                         log.warn("contextRoot2: " + req.getContextPath());
>             //configContext.setContextRoot(contextRoot);
>             configContext.setContextRoot(req.getContextPath());
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org