Examples of MimeHeaders


Examples of com.sun.grizzly.util.http.MimeHeaders

    protected void send503Response(Request request, Response response) {
        SocketChannelOutputBuffer outputBuffer = (SocketChannelOutputBuffer) response.getOutputBuffer();
        response.setStatus(503);
        response.setMessage(
                LoadBalancerProxyConstants.SERVICE_UNAVAILABLE);       
        MimeHeaders headers = response.getMimeHeaders();
        headers.setValue(LoadBalancerProxyConstants.HTTP_CONNECTION_HEADER).
                setString(LoadBalancerProxyConstants.HTTP_CONNECTION_CLOSE_VALUE);
        headers.setValue(LoadBalancerProxyConstants.SERVER_HEADER)
                .setString(SelectorThread.SERVER_NAME);
        headers.setValue(LoadBalancerProxyConstants.CONTENT_LENGTH_HEADER)
                .setInt(
                LoadBalancerProxyConstants.SERVICE_UNAVAILABLE_LENGTH);
        headers.setValue(LoadBalancerProxyConstants.CONTENT_TYPE_HEADER)
                .setString("text/html");
        outputBuffer.sendStatus();
        int size = headers.size();
        for (int i = 0; i < size; i++) {
            outputBuffer.sendHeader(headers.getName(i), headers.getValue(i));
        }
        outputBuffer.endHeaders();
        try {
            /**Browsers are not happy with the status alone, need to send
             * some html message so that it can be displayed to user.
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

              try {
                // Set SOAPAction
                if (soapAction != null) {
                  // Setting soap action using both approaches, as CXF needs one and JBossWS-Native the other
                  proxy.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, soapAction);
                  MimeHeaders hd = soapRequestMessage.getMimeHeaders();
                  hd.addHeader("SOAPAction", soapAction);
                } else if (log.isDebugEnabled()) {
                  log.debug("SOAPAction not set");
                }

                // Set client side timeout for the invocation
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

                 
                  // Set SOAPAction
                  if (soapAction != null) {
                    // Setting soap action using both approaches, as CXF needs one and JBossWS-Native the other
                    proxy.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, soapAction);
                    MimeHeaders hd = soapRequestMessage.getMimeHeaders();
                    hd.addHeader("SOAPAction", soapAction);
                  } else if (log.isDebugEnabled()) {
                    log.debug("SOAPAction not set");
                  }
                 
                  proxy.invokeOneWay(soapRequestMessage);
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

            marshaller.marshal(null, header);
            //marshaller.marshal(expectedJAXBElements[i],
            //                   header);
            EasyMock.expectLastCall();
        }
        MimeHeaders mimeHeaders = control.createMock(MimeHeaders.class);
        message.getMimeHeaders();
        EasyMock.expectLastCall().andReturn(mimeHeaders);
        mimeHeaders.getHeader("SOAPAction");
        if (preExistingSOAPAction) {
            EasyMock.expectLastCall().andReturn(new String[] {"foobar"});
            String soapAction =
                "\"" + ((AttributedURIType)expectedValues[5]).getValue() + "\"";
            mimeHeaders.setHeader("SOAPAction", soapAction);
            EasyMock.expectLastCall();
        } else {
            EasyMock.expectLastCall().andReturn(null);
        }
        if (invalidMAP) {
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

     * @param message the SOAP message
     */
    private void propogateAction(AttributedURIType action,
                                 SOAPMessage message) {
        if (!(action == null || "".equals(action.getValue()))) {
            MimeHeaders mimeHeaders = message.getMimeHeaders();
            String[] soapActionHeaders =
                mimeHeaders.getHeader(Names.SOAP_ACTION_HEADER);
            // only propogate to SOAPAction header if currently non-empty
            if (!(soapActionHeaders == null
                  || soapActionHeaders.length == 0
                  || "".equals(soapActionHeaders[0]))) {
                LOG.log(Level.INFO,
                        "encoding wsa:Action in SOAPAction header {0}",
                        action.getValue());
                String soapAction = "\"" + action.getValue() + "\"";
                mimeHeaders.setHeader(Names.SOAP_ACTION_HEADER, soapAction);
            }
        }
    }
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

        }
        SOAPMessageContext soapCtx = SOAPMessageContext.class.cast(context);
        SOAPMessage soapMessage;
        QName code = faultCode;
        try {
            MimeHeaders headers = new MimeHeaders();
            Map<String, List<String>> httpHeaders;
           
            if (isServer) {
                httpHeaders = (Map<String, List<String>>)soapCtx.get(MessageContext.HTTP_REQUEST_HEADERS);
            } else {
                httpHeaders = (Map<String, List<String>>)soapCtx.get(MessageContext.HTTP_RESPONSE_HEADERS);
            }
            if (httpHeaders != null) {
                for (String key : httpHeaders.keySet()) {
                    if (null != key) {
                        List<String> values = httpHeaders.get(key);
                        for (String value : values) {
                            headers.addHeader(key, value);
                        }
                    }
                }
            }
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

    @SuppressWarnings("unchecked")
    public void updateHeaders(MessageContext ctx, SOAPMessage msg) throws SOAPException {
        if (msg.saveRequired()) {
            msg.saveChanges();
        }
        MimeHeaders headers = msg.getMimeHeaders();
        Map<String, List<String>> reqHead;
        String inOutKey = MessageContext.HTTP_REQUEST_HEADERS;
        if (isServer) {
            inOutKey = MessageContext.HTTP_RESPONSE_HEADERS;
        }
        reqHead = (Map<String, List<String>>)ctx.get(inOutKey);
        if (reqHead == null) {
            reqHead = new HashMap<String, List<String>>();
            ctx.put(inOutKey, reqHead);
        }
        Iterator it = headers.getAllHeaders();
        while (it.hasNext()) {
            MimeHeader header = (MimeHeader)it.next();
            if (!"Content-Length".equals(header.getName())) {
                List<String> vals = reqHead.get(header.getName());
                if (null == vals) {
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

    try
    {
      MessageFactory mf = MessageFactory.newInstance();
      SOAPMessage message = mf.createMessage();

      MimeHeaders mh = message.getMimeHeaders();
      mh.setHeader("SOAPAction", "\"urn:schemas-microsoft-com:xml-analysis:Execute\"");

      SOAPPart soapPart = message.getSOAPPart();
      SOAPEnvelope envelope = soapPart.getEnvelope();
      SOAPBody body = envelope.getBody();
      Name nEx = envelope.createName("Execute", "", XMLA_URI);
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

  }

  public void invoke(InputStream is, OutputStream os)
    throws Throwable
  {
    SOAPMessage request = _factory.createMessage(new MimeHeaders(), is);
    SOAPMessage response = (SOAPMessage) _provider.invoke(request);

    response.writeTo(os);
    os.flush();
  }
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

                synCtx.setResponse(true);
                try {
                    MessageFactory mf = MessageFactory.newInstance();
                    SOAPMessage smsg;
                    if (synCtx.isSOAP11()) {
                        smsg = mf.createMessage(new MimeHeaders(),
                                new ByteArrayInputStream(cachedObj.getResponseEnvelope()));
                    } else {
                        MimeHeaders mimeHeaders = new MimeHeaders();
                        mimeHeaders.addHeader("Content-ID", IDGenerator.generateID());
                        mimeHeaders.addHeader("content-type",
                                HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML);
                        smsg = mf.createMessage(mimeHeaders,
                                new ByteArrayInputStream((cachedObj).getResponseEnvelope()));
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.