Examples of HttpHeader


Examples of net.matuschek.http.HttpHeader

        filename = "//" + host + filename;
      }
      // get the mimetype and put in the http header
      String mimetypestr = getMimeTypeForFilename(filename);
      if (mimetypestr != null) {
        HttpHeader header = new HttpHeader("content-type", mimetypestr);
        doc.addHeader(header);
      }
     
      // get the content from the file
      File file = new File(filename);
View Full Code Here

Examples of org.apache.tuscany.sca.binding.http.HTTPHeader

    Enumeration<?> headerNames =  request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        String headerName = (String) headerNames.nextElement();
        Object headerValue = request.getHeader(headerName);
        HTTPHeader header = new HTTPHeader(headerName, headerValue);
        headers.add(header);
    }
    return headers;
  }
View Full Code Here

Examples of org.apache.tuscany.sca.common.http.HTTPHeader

                        // header name/value pair
                        String name = getString(reader, NAME);
                        String value = getURIString(reader, VALUE);

                        if(name != null) {
                            restBinding.getHttpHeaders().add(new HTTPHeader(name, value));
                        }
                        break;

                    } else if (RESPONSE_QNAME.equals(elementName)) {
View Full Code Here

Examples of org.apache.woden.wsdl20.extensions.http.HTTPHeader

            return null;
        }
        List<HTTPHeaderMessage> httpHeaderMessages = new ArrayList<HTTPHeaderMessage>();

        for (int i = 0; i < httpHeaders.length; i++) {
            HTTPHeader httpHeader = (HTTPHeader) httpHeaders[i];
            HTTPHeaderMessage httpHeaderMessage = new HTTPHeaderMessage();
            httpHeaderMessage.setqName(((HTTPHeaderElement)httpHeader).getTypeName());
            httpHeaderMessage.setName(httpHeader.getName());
            httpHeaderMessage.setRequired(httpHeader.isRequired().booleanValue());
            httpHeaderMessages.add(httpHeaderMessage);
        }
        return httpHeaderMessages;
    }
View Full Code Here

Examples of org.b3log.latke.urlfetch.HTTPHeader

    public String httpPost(String url, String queryString) throws Exception {
        String ret = null;
        final HTTPRequest request = new HTTPRequest();
        request.setURL(new URL(url));
        request.setRequestMethod(HTTPRequestMethod.POST);
        request.addHeader(new HTTPHeader("Content-Type",
                                         "application/x-www-form-urlencoded"));
        if (queryString != null && !queryString.equals("")) {
            request.setPayload(queryString.getBytes("UTF-8"));
        }
View Full Code Here

Examples of org.eclipse.jetty.http.HttpHeader

                    LOG.debug("Bad credentials for {}", request);
                forwardSuccessComplete(request, response);
                return;
            }

            HttpHeader header = getAuthenticateHeader();
            List<Authentication.HeaderInfo> headerInfos = parseAuthenticateHeader(response, header);
            if (headerInfos.isEmpty())
            {
                if (LOG.isDebugEnabled())
                    LOG.debug("Authentication challenge without {} header", header);
View Full Code Here

Examples of org.glassfish.grizzly.http.HttpHeader

        final Connection grizzlyConnection = ctx.getConnection();
        final org.glassfish.tyrus.spi.Connection tyrusConnection = TYRUS_CONNECTION.get(grizzlyConnection);

        // Get the HTTP header
        final HttpHeader header = message.getHttpHeader();

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, "handleRead websocket: {0} content-size={1} headers=\n{2}",
                    new Object[]{tyrusConnection, message.getContent().remaining(), header});
        }

        // client
        if (tyrusConnection != null) {
            // this is websocket with completed handshake
            if (message.getContent().hasRemaining()) {

                // get the frame(s) content
                Buffer buffer = message.getContent();
                final ByteBuffer webSocketBuffer = buffer.toByteBuffer();
                message.recycle();
                final ReadHandler readHandler = tyrusConnection.getReadHandler();

                TaskProcessor taskProcessor = TASK_PROCESSOR.get(ctx.getConnection());
                taskProcessor.processTask(new ProcessTask(webSocketBuffer, readHandler));
            }
            return ctx.getStopAction();
        }

        // tyrusConnection == null

        // proxy
        final HttpStatus httpStatus = ((HttpResponsePacket) message.getHttpHeader()).getHttpStatus();

        if (httpStatus.getStatusCode() != 101) {
            if (proxy && !PROXY_CONNECTED.get(grizzlyConnection)) {
                if (httpStatus == HttpStatus.OK_200) {

                    PROXY_CONNECTED.set(grizzlyConnection, true);

                    // TYRUS-221: Proxy handshake is complete, we need to enable SSL layer for secure ("wss")
                    // connections now.
                    if (sslFilter != null) {
                        ((GrizzlyClientSocket.FilterWrapper) sslFilter).enable();
                    }

                    httpCodecFilter.resetResponseProcessing(grizzlyConnection);

                    final UpgradeRequest upgradeRequest = UPGRADE_REQUEST.get(grizzlyConnection);
                    ctx.write(getHttpContent(upgradeRequest));
                    UPGRADE_REQUEST.remove(grizzlyConnection);
                } else {
                    throw new IOException(String.format("Proxy error. %s: %s", httpStatus.getStatusCode(),
                            new String(httpStatus.getReasonPhraseBytes(), "UTF-8")));
                }

                return ctx.getInvokeAction();
            }
        }

        // If websocket is null - it means either non-websocket Connection
        if (!UpgradeRequest.WEBSOCKET.equalsIgnoreCase(header.getUpgrade()) && message.getHttpHeader().isRequest()) {
            // if it's not a websocket connection - pass the processing to the next filter
            return ctx.getInvokeAction();
        }

        // Handle handshake
View Full Code Here

Examples of org.jboss.soa.esb.http.HttpHeader

        // Http headers...
        Enumeration enumeration = request.getHeaderNames();
    while (enumeration.hasMoreElements()) {
      String name = (String) enumeration.nextElement();
      String value = request.getHeader(name);
      requestInfo.getHeaders().add(new HttpHeader(name, value));
    }

        return requestInfo;
  }
View Full Code Here

Examples of org.jwall.web.http.HttpHeader

        partialHeader.append( HttpHeader.CRLF );

        //
        // an empty line signals the end of a http-header
        //
        HttpHeader head = null;
       
        try {
            head = new HttpHeader( partialHeader.toString() );
        } catch (Exception e){
            //e.printStackTrace();
            log.error(this + " Exception: " + e.getMessage() );
            log.error(this + " PartialHeader: "+partialHeader);
        }

        // if this header signals a request-body then we
        // switch into the READ_BODY state
        //
        if( head.getContentLength() > 0 )
            state = STATE_READING_BODY;
       
        partialHeader = new StringBuffer();
        log.debug("Completed reading the current header, leaving HttpRequestStream.readHeader()");
        touch();
View Full Code Here

Examples of org.jwat.common.HttpHeader

    }
    else {
      in = r.pbin;
    }
    Payload payload = null;
    HttpHeader httpHeader = null;
    if (ArcReaderFactory.isArcRecord(in)) {
      r.arcReader = ArcReaderFactory.getReaderUncompressed();
      r.arcReader.setUriProfile(UriProfile.RFC3986_ABS_16BIT_LAX);
      r.arcReader.setBlockDigestEnabled(false);
      r.arcReader.setPayloadDigestEnabled(false);
      r.arcRecord = r.arcReader.getNextRecordFrom(in, offset);
      if (r.arcRecord != null) {
        payload = r.arcRecord.getPayload();
        if (payload != null) {
          httpHeader = r.arcRecord.getHttpHeader();
        }
        if (httpHeader != null) {
          r.payloadStream = httpHeader.getPayloadInputStream();
          r.length = httpHeader.payloadLength;
          r.status = httpHeader.statusCode;
        } else if (payload != null) {
          r.payloadStream = payload.getInputStreamComplete();
          r.length = payload.getTotalLength();
          r.status = 200;
        } else {
          r.payloadStream = new ByteArrayInputStream(new byte[0]);
          r.length = 0;
          r.status = 200;
        }
      }
    }
    else if ( WarcReaderFactory.isWarcRecord(in) ) {
      r.warcReader = WarcReaderFactory.getReaderUncompressed();
      r.warcReader.setWarcTargetUriProfile(UriProfile.RFC3986_ABS_16BIT_LAX);
      r.warcReader.setBlockDigestEnabled(false);
      r.warcReader.setPayloadDigestEnabled(false);
      r.warcRecord = r.warcReader.getNextRecordFrom(in, offset);
      if (r.warcRecord != null) {
        payload = r.warcRecord.getPayload();
        if (payload != null) {
          httpHeader = r.warcRecord.getHttpHeader();
        }
        if (httpHeader != null) {
          r.payloadStream = httpHeader.getPayloadInputStream();
          r.length = httpHeader.payloadLength;
          r.status = httpHeader.statusCode;
        } else if (payload != null) {
          r.payloadStream = payload.getInputStreamComplete();
          r.length = payload.getTotalLength();
          r.status = 200;
        } else {
          r.payloadStream = new ByteArrayInputStream(new byte[0]);
          r.length = 0;
          r.status = 200;
        }
      }
    }
    else {
      throw new ResourceNotAvailableException("Unknown archive record");
    }
    if (r.payloadStream == null) {
      r.close();
      r = null;
    } else {
      r.setInputStream(r.payloadStream);
          r.headers = new Hashtable<String,String>();
      if (httpHeader != null) {
        Iterator<HeaderLine> headerLines = httpHeader.getHeaderList().iterator();
        HeaderLine headerLine;
        while (headerLines.hasNext()) {
          headerLine = headerLines.next();
          r.headers.put(headerLine.name.toLowerCase(), headerLine.value);
        }
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.