Example usage for java.net URI getFragment

List of usage examples for java.net URI getFragment

Introduction

In this page you can find the example usage for java.net URI getFragment.

Prototype

public String getFragment() 

Source Link

Document

Returns the decoded fragment component of this URI.

Usage

From source file:org.eclipse.orion.server.git.servlets.GitCloneHandlerV1.java

private boolean handlePost(HttpServletRequest request, HttpServletResponse response, String pathString)
        throws IOException, JSONException, ServletException, URISyntaxException, CoreException, NoHeadException,
        NoMessageException, ConcurrentRefUpdateException, WrongRepositoryStateException {
    // make sure required fields are set
    JSONObject toAdd = OrionServlet.readJSONRequest(request);
    if (toAdd.optBoolean(GitConstants.KEY_PULL, false)) {
        GitUtils.createGitCredentialsProvider(toAdd);
        GitCredentialsProvider cp = GitUtils.createGitCredentialsProvider(toAdd);
        boolean force = toAdd.optBoolean(GitConstants.KEY_FORCE, false);
        return pull(request, response, cp, pathString, force);
    }//from   w  w w . j  a v a 2s . co  m

    Clone clone = new Clone();
    String url = toAdd.optString(GitConstants.KEY_URL, null);
    // method handles repository clone or just repository init
    // decision is based on existence of GitUrl argument
    boolean initOnly;
    if (url == null || url.isEmpty())
        initOnly = true;
    else {
        initOnly = false;
        if (!validateCloneUrl(url, request, response))
            return true;
        clone.setUrl(new URIish(url));
    }
    String cloneName = toAdd.optString(ProtocolConstants.KEY_NAME, null);
    if (cloneName == null)
        cloneName = request.getHeader(ProtocolConstants.HEADER_SLUG);
    // expected path /workspace/{workspaceId}
    String workspacePath = ServletResourceHandler.toOrionLocation(request,
            toAdd.optString(ProtocolConstants.KEY_LOCATION, null));
    // expected path /file/{workspaceId}/{projectName}[/{path}]
    String filePathString = ServletResourceHandler.toOrionLocation(request,
            toAdd.optString(ProtocolConstants.KEY_PATH, null));
    IPath filePath = filePathString == null ? null : new Path(filePathString);
    if (filePath != null && filePath.segmentCount() < 3)
        filePath = null;
    if (filePath == null && workspacePath == null) {
        String msg = NLS.bind("Either {0} or {1} should be provided: {2}",
                new Object[] { ProtocolConstants.KEY_PATH, ProtocolConstants.KEY_LOCATION, toAdd });
        return statusHandler.handleRequest(request, response,
                new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
    }
    // only during init operation filePath or cloneName must be provided
    // during clone operation, name can be obtained from URL
    if (initOnly && filePath == null && cloneName == null) {
        String msg = NLS.bind("Either {0} or {1} should be provided: {2}",
                new Object[] { ProtocolConstants.KEY_PATH, GitConstants.KEY_NAME, toAdd });
        return statusHandler.handleRequest(request, response,
                new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
    }
    if (!validateCloneName(cloneName, request, response))
        return true;

    // prepare the WebClone object, create a new project if necessary
    ProjectInfo project = null;
    boolean webProjectExists = false;
    if (filePath != null) {
        //path format is /file/{workspaceId}/{projectName}/[filePath]
        clone.setId(filePath.toString());
        project = GitUtils.projectFromPath(filePath);
        //workspace path format needs to be used if project does not exist
        if (project == null) {
            String msg = NLS.bind("Specified project does not exist: {0}", filePath.segment(2));
            return statusHandler.handleRequest(request, response,
                    new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
        }
        webProjectExists = true;
        clone.setContentLocation(
                project.getProjectStore().getFileStore(filePath.removeFirstSegments(3)).toURI());
        if (cloneName == null)
            cloneName = filePath.segmentCount() > 2 ? filePath.lastSegment() : project.getFullName();
    } else if (workspacePath != null) {
        IPath path = new Path(workspacePath);
        // TODO: move this to CloneJob
        // if so, modify init part to create a new project if necessary
        final IMetaStore metaStore = OrionConfiguration.getMetaStore();
        WorkspaceInfo workspace = metaStore.readWorkspace(path.segment(1));
        if (cloneName == null)
            cloneName = new URIish(url).getHumanishName();
        cloneName = getUniqueProjectName(workspace, cloneName);
        webProjectExists = false;
        project = new ProjectInfo();
        project.setFullName(cloneName);
        project.setWorkspaceId(workspace.getUniqueId());

        try {
            //creating project in the backing store will assign a project id
            metaStore.createProject(project);
        } catch (CoreException e) {
            return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR,
                    HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Error persisting project state", e));
        }
        try {
            WorkspaceResourceHandler.computeProjectLocation(request, project, null, false);
            metaStore.updateProject(project);
        } catch (CoreException e) {
            //delete the project so we don't end up with a project in a bad location
            try {
                metaStore.deleteProject(workspace.getUniqueId(), project.getFullName());
            } catch (CoreException e1) {
                //swallow secondary error
                LogHelper.log(e1);
            }
            //we are unable to write in the platform location!
            String msg = NLS.bind("Failed to create project: {0}", project.getFullName());
            return statusHandler.handleRequest(request, response,
                    new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e));
        }

        URI baseLocation = getURI(request);
        baseLocation = new URI(baseLocation.getScheme(), baseLocation.getUserInfo(), baseLocation.getHost(),
                baseLocation.getPort(), workspacePath, baseLocation.getQuery(), baseLocation.getFragment());
        clone.setId(GitUtils.pathFromProject(workspace, project).toString());
        clone.setContentLocation(project.getProjectStore().toURI());
    }
    clone.setName(cloneName);
    clone.setBaseLocation(getURI(request));
    JSONObject cloneObject = clone.toJSON();
    String cloneLocation = cloneObject.getString(ProtocolConstants.KEY_LOCATION);

    String gitUserName = toAdd.optString(GitConstants.KEY_NAME, null);
    String gitUserMail = toAdd.optString(GitConstants.KEY_MAIL, null);
    Boolean initProject = toAdd.optBoolean(GitConstants.KEY_INIT_PROJECT, false);
    if (initOnly) {
        // git init
        InitJob job = new InitJob(clone, TaskJobHandler.getUserId(request), request.getRemoteUser(),
                cloneLocation, gitUserName, gitUserMail);
        return TaskJobHandler.handleTaskJob(request, response, job, statusHandler);
    }
    // git clone
    // prepare creds
    GitCredentialsProvider cp = GitUtils.createGitCredentialsProvider(toAdd);
    cp.setUri(new URIish(clone.getUrl()));

    // if all went well, clone
    CloneJob job = new CloneJob(clone, TaskJobHandler.getUserId(request), cp, request.getRemoteUser(),
            cloneLocation,
            webProjectExists ? null : project /* used for cleaning up, so null when not needed */, gitUserName,
            gitUserMail, initProject);
    return TaskJobHandler.handleTaskJob(request, response, job, statusHandler);
}

From source file:net.xy.jcms.shared.adapter.HttpRequestDataAccessContext.java

@Override
public String buildUriWithParams(final String requestString, final Map<Object, Object> parameters) {
    // 1. should not alter external links
    // 2. should convert absolute uris to relatives if possible
    try {/*w w  w.jav  a2s .c  o m*/
        URI build; // the initial request
        try {
            // first asume its already an proper url
            build = new URI(requestString);
        } catch (final URISyntaxException ex) {
            // second encode to an proper url
            final String requestUri = URLEncoder.encode(requestString, "UTF-8");
            build = new URI(requestUri);
        }
        if (!build.isAbsolute()) {
            build = rootUrl.resolve(build); // make it absolute
        }
        final String path = StringUtils.isNotBlank(build.getPath()) ? build.getPath() : "/";
        build = new URI(build.getScheme(), build.getUserInfo(), build.getHost(), build.getPort(), path,
                buildQuery(parameters), build.getFragment());
        final URI relBuild = rootUrl.relativize(build);
        final String ret;
        if (!relBuild.isAbsolute()) {
            // because we relativate it always to docroot, which is the
            // servlet container in JEE
            ret = contextPath + relBuild.toASCIIString().replace("+", "%20");
        } else {
            ret = relBuild.toASCIIString();
        }
        return ret;
    } catch (final URISyntaxException e) {
        throw new IllegalArgumentException("URL couldn't be build from given parameters. "
                + DebugUtils.printFields(requestString, parameters), e);
    } catch (final UnsupportedEncodingException e) {
        throw new IllegalArgumentException(
                " Encoding is not supported " + DebugUtils.printFields(requestString, parameters), e);
    }
}

From source file:com.legstar.codegen.tasks.SourceToXsdCobolTask.java

/**
 * Converts a URI into a package name. We assume a hierarchical,
 * server-based URI with the following syntax:
 * [scheme:][//host[:port]][path][?query][#fragment]
 * The package name is derived from host, path and fragment.
 * //from w ww  .j  a  v a 2 s  .c  o m
 * @param namespaceURI the input namespace URI
 * @return the result package name
 */
public static String packageFromURI(final URI namespaceURI) {

    StringBuilder result = new StringBuilder();
    URI nURI = namespaceURI.normalize();
    boolean firstToken = true;

    /*
     * First part of package name is built from host with tokens in
     * reverse order.
     */
    if (nURI.getHost() != null && nURI.getHost().length() != 0) {
        Vector<String> v = new Vector<String>();
        StringTokenizer t = new StringTokenizer(nURI.getHost(), ".");
        while (t.hasMoreTokens()) {
            v.addElement(t.nextToken());
        }

        for (int i = v.size(); i > 0; i--) {
            if (!firstToken) {
                result.append('.');
            } else {
                firstToken = false;
            }
            result.append(v.get(i - 1));
        }
    }

    /* Next part of package is built from the path tokens */
    if (nURI.getPath() != null && nURI.getPath().length() != 0) {
        Vector<String> v = new Vector<String>();
        StringTokenizer t = new StringTokenizer(nURI.getPath(), "/");
        while (t.hasMoreTokens()) {
            v.addElement(t.nextToken());
        }

        for (int i = 0; i < v.size(); i++) {
            String token = v.get(i);
            /* ignore situations such as /./../ */
            if (token.equals(".") || token.equals("..")) {
                continue;
            }
            if (!firstToken) {
                result.append('.');
            } else {
                firstToken = false;
            }
            result.append(v.get(i));
        }
    }

    /* Finally append any fragment */
    if (nURI.getFragment() != null && nURI.getFragment().length() != 0) {
        if (!firstToken) {
            result.append('.');
        } else {
            firstToken = false;
        }
        result.append(nURI.getFragment());
    }

    /*
     * By convention, namespaces are lowercase and should not contain
     * invalid Java identifiers
     */
    String s = result.toString().toLowerCase();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < s.length(); i++) {
        Character c = s.charAt(i);
        if (Character.isJavaIdentifierPart(c) || c.equals('.')) {
            sb.append(c);
        } else {
            sb.append("_");
        }
    }
    return sb.toString();
}

From source file:com.gistlabs.mechanize.util.apache.URIBuilder.java

private void digestURI(final URI uri) {
    this.scheme = uri.getScheme();
    this.encodedSchemeSpecificPart = uri.getRawSchemeSpecificPart();
    this.encodedAuthority = uri.getRawAuthority();
    this.host = uri.getHost();
    this.port = uri.getPort();
    this.encodedUserInfo = uri.getRawUserInfo();
    this.userInfo = uri.getUserInfo();
    this.encodedPath = uri.getRawPath();
    this.path = uri.getPath();
    this.encodedQuery = uri.getRawQuery();
    this.queryParams = parseQuery(uri.getRawQuery(), Consts.UTF_8);
    this.encodedFragment = uri.getRawFragment();
    this.fragment = uri.getFragment();
}

From source file:org.cloudsmith.stackhammer.api.client.StackHammerClient.java

/**
 * Executes a HTTP GET request. The http response is expected to be a JSON representation of
 * an object of the specified <code>type</code>. The object is parsed and returned.
 * //  ww  w . j av  a  2 s.  c o m
 * @param urlStr The URL of the request
 * @param params Parameters to include in the URL
 * @param type The expected type of the result
 * @return An object of the expected type
 * @throws IOException if the request could not be completed
 */
public <V> V get(String urlStr, Map<String, String> params, Class<V> type) throws IOException {
    URI uri;
    try {
        uri = new URI(createUri(urlStr));
        if (params != null && !params.isEmpty()) {
            List<NameValuePair> queryParams = new ArrayList<NameValuePair>(params.size());
            for (Map.Entry<String, String> param : params.entrySet())
                queryParams.add(new BasicNameValuePair(param.getKey(), param.getValue()));

            uri = URIUtils.createURI(uri.getScheme(), uri.getHost(), uri.getPort(), uri.getPath(),
                    URLEncodedUtils.format(queryParams, UTF_8.name()), uri.getFragment());
        }
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e);
    }

    HttpGet request = new HttpGet(uri);
    configureRequest(request);
    return executeRequest(request, type);
}

From source file:de.thingweb.thing.Thing.java

public String resolvePropertyUri(String name, int index) {

    URI uri = getUri(index);

    Property p = getProperty(name);/*w w w  . j  ava2s  .c o m*/

    if (p != null) {
        try {
            // String scheme, String userInfo, String host, int port, String path, String query, String fragment
            String path = uri.getPath();
            if (path.endsWith("/")) {
                path = path + p.getHrefs().get(index);
            } else {
                path = path + "/" + p.getHrefs().get(index);
            }
            uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), path,
                    uri.getQuery(), uri.getFragment());
        } catch (URISyntaxException e) {
            throw new RuntimeException("TD with malformed hrefs");
        }
    } else {
        throw new RuntimeException("No such Property");
    }

    return uri.toString();
}

From source file:annis.sqlgen.GraphWithClauseGenerator.java

private String singleMatchClause(int matchNumber, List<URI> saltURIs, TableAccessStrategy tas,
        AnnotateQueryData annotateQueryData, List<Long> corpusList, int numOfNodes, String indent) {
    String indent2 = indent + TABSTOP;
    StringBuilder sb = new StringBuilder();

    // SELECT/*ww  w.  ja  v  a2  s .c o  m*/
    sb.append(indent).append("SELECT\n");
    sb.append(indent2).append(matchNumber).append(" AS n, \n").append(indent2);

    for (int i = 1; i <= numOfNodes; i++) {
        // factsN.id AS idN
        sb.append(tas.tableName(NODE_TABLE)).append(i).append(".").append(tas.columnName(NODE_TABLE, "id"))
                .append(" AS ").append("id").append(i).append(", ");

        sb.append(tas.tableName(NODE_TABLE)).append(i).append(".")
                .append(tas.columnName(NODE_TABLE, "text_ref")).append(" AS ").append("text").append(i)
                .append(", ");

        sb.append(tas.tableName(NODE_TABLE)).append(i).append(".")
                .append(tas.columnName(NODE_TABLE, "left_token"));

        if (annotateQueryData.getSegmentationLayer() == null) {
            sb.append(" - ").append(annotateQueryData.getLeft());
        }
        sb.append(" AS ").append("min").append(i).append(", ");

        sb.append(tas.tableName(NODE_TABLE)).append(i).append(".")
                .append(tas.columnName(NODE_TABLE, "right_token"));
        if (annotateQueryData.getSegmentationLayer() == null) {
            sb.append(" + ").append(annotateQueryData.getRight());
        }
        sb.append(" AS ").append("max").append(i).append(", ");

        sb.append(tas.tableName(NODE_TABLE)).append(i).append(".")
                .append(tas.columnName(NODE_TABLE, "corpus_ref")).append(" AS ").append("corpus").append(i)
                .append(", ");

        sb.append(tas.tableName(NODE_TABLE)).append(i).append(".")
                .append(tas.columnName(NODE_TABLE, "node_name")).append(" AS ").append("name").append(i);

        if (i == numOfNodes) {
            sb.append("\n");
        } else {
            sb.append(", \n").append(indent2);
        }
    }

    // FROM
    sb.append(indent).append("FROM\n");
    for (int i = 1; i <= numOfNodes; i++) {
        sb.append(indent2).append(tas.tableName(NODE_TABLE)).append(" AS ").append(tas.tableName(NODE_TABLE))
                .append(i).append(", ").append(tas.tableName(CORPUS_TABLE)).append(" AS ")
                .append(tas.tableName(CORPUS_TABLE)).append(i);

        if (i == numOfNodes) {
            sb.append("\n");
        } else {
            sb.append(",\n").append(indent2);
        }

    }

    // WHERE
    sb.append(indent).append("WHERE\n");
    for (int i = 1; i <= numOfNodes; i++) {
        URI uri = saltURIs.get(i - 1);

        // check for corpus/document by it's path
        sb.append(indent2).append(tas.tableName(CORPUS_TABLE)).append(i).append(".path_name = ")
                .append(generatePathName(uri)).append(" AND\n");

        // join the found corpus/document to the facts table
        sb.append(indent2).append(tas.tableName(NODE_TABLE)).append(i).append(".corpus_ref = ")
                .append(tas.tableName(CORPUS_TABLE)).append(i).append(".id AND\n");

        // filter the node with the right name
        sb.append(indent2).append(tas.tableName(NODE_TABLE)).append(i).append(".node_name = ").append("'")
                .append(uri.getFragment()).append("'").append(" AND\n");

        // use the toplevel partioning
        sb.append(indent2).append(tas.tableName(NODE_TABLE)).append(i).append(".toplevel_corpus IN ( ")
                .append(StringUtils.join(corpusList, ",")).append(") ");

        if (i < numOfNodes) {
            sb.append("AND\n");
        } else {
            sb.append("\n");
        }
    }

    // LIMIT to one row
    sb.append(indent).append("LIMIT 1\n");

    return sb.toString();
}

From source file:org.eclipse.orion.server.tests.servlets.files.FileSystemTest.java

protected URI addSchemeHostPort(URI uri) {
    String scheme = uri.getScheme();
    String host = uri.getHost();//from   w ww. ja va 2  s  .  c  o m
    int port = uri.getPort();
    if (scheme == null) {
        scheme = "http";
    }
    if (host == null) {
        host = "localhost";
    }
    if (port == -1) {
        port = 8080;
    }
    try {
        return new URI(scheme, uri.getUserInfo(), host, port, uri.getPath(), uri.getQuery(), uri.getFragment());
    } catch (URISyntaxException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.android.idtt.http.client.util.URIBuilder.java

private void digestURI(final URI uri) {
    this.scheme = uri.getScheme();
    this.encodedSchemeSpecificPart = uri.getRawSchemeSpecificPart();
    this.encodedAuthority = uri.getRawAuthority();
    this.host = uri.getHost();
    this.port = uri.getPort();
    this.encodedUserInfo = uri.getRawUserInfo();
    this.userInfo = uri.getUserInfo();
    this.encodedPath = uri.getRawPath();
    this.path = uri.getPath();
    this.encodedQuery = uri.getRawQuery();
    this.queryParams = parseQuery(uri.getRawQuery(), Charset.forName(HTTP.UTF_8));
    this.encodedFragment = uri.getRawFragment();
    this.fragment = uri.getFragment();
}

From source file:org.apache.synapse.transport.nhttp.ClientWorker.java

/**
 * Create the thread that would process the response message received for the outgoing message
 * context sent/*w  w w.  j av a 2  s.co  m*/
 * @param cfgCtx the Axis2 configuration context
 * @param in the InputStream to read the body of the response message received
 * @param response HTTP response received from the server
 * @param outMsgCtx the original outgoing message context (i.e. corresponding request)
 * @param endpointURLPrefix The endpoint URL prefix
 */
public ClientWorker(ConfigurationContext cfgCtx, InputStream in, HttpResponse response,
        MessageContext outMsgCtx, String endpointURLPrefix) {

    this.cfgCtx = cfgCtx;
    this.in = in;
    this.response = response;
    this.endpointURLPrefix = endpointURLPrefix;
    this.outMsgCtx = outMsgCtx;

    try {
        responseMsgCtx = outMsgCtx.getOperationContext().getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
        // fix for RM to work because of a soapAction and wsaAction conflict
        if (responseMsgCtx != null) {
            responseMsgCtx.setSoapAction("");
        }
    } catch (AxisFault af) {
        log.error("Error getting IN message context from the operation context", af);
        return;
    }

    // this conditional block is to support Sandesha, as it uses an out-in mep, but without
    // creating the message context to write the response and adding it into the operation
    // context, as it may get a 202 accepted or 200. So if the operation is complete ignore
    // this message, else, create a new message context and handle this
    if (responseMsgCtx == null && outMsgCtx.getOperationContext().isComplete()) {

        if (log.isDebugEnabled()) {
            log.debug("Error getting IN message context from the operation context. "
                    + "Possibly an RM terminate sequence message");
        }

    } else {
        if (responseMsgCtx == null) {
            responseMsgCtx = new MessageContext();
            responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext());
        }

        responseMsgCtx.setProperty(MessageContext.IN_MESSAGE_CONTEXT, outMsgCtx);
        responseMsgCtx.setServerSide(true);
        responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST());
        responseMsgCtx.setProperty(MessageContext.TRANSPORT_IN,
                outMsgCtx.getProperty(MessageContext.TRANSPORT_IN));
        responseMsgCtx.setTransportIn(outMsgCtx.getTransportIn());
        responseMsgCtx.setTransportOut(outMsgCtx.getTransportOut());

        // set any transport headers received
        Header[] headers = response.getAllHeaders();
        if (headers != null && headers.length > 0) {

            Map<String, String> headerMap = new TreeMap<String, String>(new Comparator<String>() {
                public int compare(String o1, String o2) {
                    return o1.compareToIgnoreCase(o2);
                }
            });

            String servicePrefix = (String) outMsgCtx.getProperty(NhttpConstants.SERVICE_PREFIX);
            for (int i = 0; i < headers.length; i++) {
                Header header = headers[i];

                // if this header is already added
                if (headerMap.containsKey(header.getName())) {
                    /* this is a multi-value header */
                    // generate the key
                    String key = NhttpConstants.EXCESS_TRANSPORT_HEADERS;
                    // get the old value
                    String oldValue = headerMap.get(header.getName());
                    // adds additional values to a list in a property of
                    // message context
                    Map map;
                    if (responseMsgCtx.getProperty(key) != null) {
                        map = (Map) responseMsgCtx.getProperty(key);
                        map.put(header.getName(), oldValue);
                    } else {
                        map = new MultiValueMap();
                        map.put(header.getName(), oldValue);
                        // set as a property in message context
                        responseMsgCtx.setProperty(key, map);
                    }

                }

                if ("Location".equals(header.getName()) && endpointURLPrefix != null && servicePrefix != null) {
                    //Here, we are changing only the host name and the port of the new URI - value of the Location
                    //header.
                    //If the new URI is again referring to a resource in the server to which the original request
                    //is sent, then replace the hostname and port of the URI with the hostname and port of synapse
                    //We are not changing the request url here, only the host name and the port.
                    try {
                        URI serviceURI = new URI(servicePrefix);
                        URI endpointURI = new URI(endpointURLPrefix);
                        URI locationURI = new URI(header.getValue());

                        if ((locationURI.getHost().equalsIgnoreCase(endpointURI.getHost()))
                                && (locationURI.getPort() == endpointURI.getPort())) {
                            URI newURI = new URI(locationURI.getScheme(), locationURI.getUserInfo(),
                                    serviceURI.getHost(), serviceURI.getPort(), locationURI.getPath(),
                                    locationURI.getQuery(), locationURI.getFragment());
                            headerMap.put(header.getName(), newURI.toString());
                            responseMsgCtx.setProperty(NhttpConstants.SERVICE_PREFIX,
                                    outMsgCtx.getProperty(NhttpConstants.SERVICE_PREFIX));
                        } else {
                            headerMap.put(header.getName(), header.getValue());
                        }
                    } catch (URISyntaxException e) {
                        log.error(e.getMessage(), e);
                    }
                } else {
                    headerMap.put(header.getName(), header.getValue());
                }
            }
            responseMsgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, headerMap);
        }

        responseMsgCtx.setAxisMessage(outMsgCtx.getOperationContext().getAxisOperation()
                .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
        responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext());
        responseMsgCtx.setConfigurationContext(outMsgCtx.getConfigurationContext());
        responseMsgCtx.setTo(null);

        // Ensure MessageContext has a ClientConnectionDebug attached before we start streaming
        ClientConnectionDebug cd = (ClientConnectionDebug) outMsgCtx
                .getProperty(ClientHandler.CLIENT_CONNECTION_DEBUG);
        if (cd != null) {
            responseMsgCtx.setProperty(ClientHandler.CLIENT_CONNECTION_DEBUG, cd);
        }
    }
    setServerContextAttribute(NhttpConstants.CLIENT_WORKER_INIT_TIME, System.currentTimeMillis(), outMsgCtx);
}