Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2013 GiavaCms.org.
   *
   * Licensed under the Eclipse Public License version 1.0, available at
   * http://www.eclipse.org/legal/epl-v10.html
   */
  package org.giavacms.resolver.resolver;
  
 import java.net.URL;
 
 
 public class DBURLConnection extends URLConnection
 {
 
    private String form;
    Logger logger = Logger.getLogger(getClass());
    private String content = null;
    private Page currentPage;
 
    public DBURLConnection(URL u)
    {
       super(u);
    }
 
    @Override
    public synchronized InputStream getInputStream() throws IOException
    {
       // if (!connected)
       connect();
       if (this. != null)
       {
          return IOUtils.toInputStream(this.);
       }
       else
       {
          return null;
       }
 
    }
 
    public String getContentType()
    {
       return "text/html";
    }
 
    public synchronized void connect() throws IOException
    {
       if (true || !)
       {
          .debug("url: " + );
          .debug("url file: " + .getFile());
          if (.getFile().contains("?"))
          {
             this. = .getFile().substring(0,
                      .getFile().lastIndexOf("?"));
          }
          else
          {
             this. = .getFile();
          }
 
          if (this..endsWith(".xhtml"))
          {
             this. = this..substring(0, this..length() - 6);
          }
 
          .debug("form: " + this.);
          try
          {
             this. = BeanUtils.getBean(PageRepository.class)
                      .fetch(this.);
             PageRequestController pageRequestController = BeanUtils
                      .getBean(PageRequestController.class);
 
             pageRequestController.setElement();
 
             PageUtils.generateContent(this.);
             this. = this..getContent();
 
          }
          catch (Exception e)
          {
             // e.printStackTrace();
             .error(e.getMessage());
          }
          this. = true;
       }
    }
 
   public long getExpiration()
   {
      return -1l;
   }
   public long getLastModified()
   {
      return -1l;
   }
New to GrepCode? Check out our FAQ X