Examples of HostService


Examples of ca.eandb.jdcp.job.HostService

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.Display#finish()
   */
  @Override
  public void finish() {
    HostService service = JdcpUtil.getHostService();
    try {
      FileOutputStream os = (service != null) ? service
          .createFileOutputStream(fileName) : new FileOutputStream(
          fileName);

      picture.write(os);
    } catch (IOException e) {
View Full Code Here

Examples of ca.eandb.jdcp.job.HostService

   * Gets the <code>OutputStream</code> to write to.
   * @return The <code>OutputStream</code> to write to.
   * @throws FileNotFoundException If the file cannot be created.
   */
  private FileOutputStream getOutputStream() throws FileNotFoundException {
    HostService service = JdcpUtil.getHostService();
    if (service != null) {
      return service.createFileOutputStream(fileName);
    } else {
      return new FileOutputStream(fileName);
    }
  }
View Full Code Here

Examples of ca.eandb.jdcp.job.HostService

   * Gets the <code>OutputStream</code> to write to.
   * @return The <code>OutputStream</code> to write to.
   * @throws FileNotFoundException If the file cannot be created.
   */
  private FileOutputStream getOutputStream() throws FileNotFoundException {
    HostService service = JdcpUtil.getHostService();
    if (service != null) {
      return service.createFileOutputStream(fileName);
    } else {
      return new FileOutputStream(fileName);
    }
  }
View Full Code Here

Examples of ca.eandb.jdcp.job.HostService

   */
  @Override
  public void finish() {
    try {
      ImageOutputStream out;
      HostService service = JdcpUtil.getHostService();
      if (service != null) {
        RandomAccessFile file = service.createRandomAccessFile(fileName);
        out = new FileImageOutputStream(file);
      } else {
        out = new FileImageOutputStream(new File(fileName));
      }
      image.write(out);
View Full Code Here

Examples of ca.eandb.jdcp.job.HostService

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.Display#finish()
   */
  @Override
  public void finish() {
    HostService service = JdcpUtil.getHostService();
    try {
      FileOutputStream os = (service != null) ? service
          .createFileOutputStream(fileName) : new FileOutputStream(
          fileName);

      picture.write(os);
    } catch (IOException e) {
View Full Code Here

Examples of ca.eandb.jdcp.job.HostService

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.Display#finish()
   */
  public void finish() {
    HostService service = JdcpUtil.getHostService();
    try {
      int width = image.rows();
      int height = image.columns();
      BufferedImage bi = new BufferedImage(width, height,
          BufferedImage.TYPE_INT_RGB);

      FileOutputStream os = (service != null) ? service
          .createFileOutputStream(fileName) : new FileOutputStream(
          fileName);

      String formatName = FileUtil.getExtension(fileName);
      if (formatName.equals("")) {
View Full Code Here

Examples of com.adito.boot.HostService

                    HttpServletResponse response) throws Exception {
        ActionForward fwd = super.unspecified(mapping, form, request, response);
        String hostField = request.getHeader("Host");
        ((WebForwardsForm) form).initialise(getSessionInfo(request).getNavigationContext() == SessionInfo.MANAGEMENT_CONSOLE_CONTEXT ?
                        WebForwardDatabaseFactory.getInstance().getWebForwards(getSessionInfo(request).getUser().getRealm().getRealmID()) :
                            ResourceUtil.getGrantedResource(getSessionInfo(request), getResourceType()), hostField == null ? null : new HostService(hostField), this.getSessionInfo(request));
        ((WebForwardsForm) form).checkSelectedView(request, response);
        return fwd;
    }
View Full Code Here

Examples of com.adito.boot.HostService

    public WrappedFavoriteItem createWrappedFavoriteItem(int resourceId, HttpServletRequest request, String type) throws Exception {
        WebForward wf = WebForwardDatabaseFactory.getInstance().getWebForward(resourceId);
        SessionInfo sessionInfo = LogonControllerFactory.getInstance().getSessionInfo(request);
        WebForwardItem wfi;
        String hostField = request.getHeader("Host");
        HostService aditoHost = hostField == null ? null : new HostService(hostField);
        if (wf != null) {
            wfi = new WebForwardItem(wf, aditoHost, PolicyDatabaseFactory.getInstance().getPoliciesAttachedToResource(wf,
                sessionInfo.getUser().getRealm()), wf.sessionPasswordRequired(sessionInfo));
            return new WrappedFavoriteItem(wfi, type);
        }
View Full Code Here

Examples of com.adito.boot.HostService

      throw new Exception("Invalid host '" + request.getServerName() + "'; only FQDNs are valid for Active DNS forwarding");

    String path;
    String url = wf.getDestinationURL();
    String hostField = request.getHeader("Host");
    HostService hostService = hostField == null ? null : new HostService(hostField);
    SessionInfo session = getSessionInfo(request);

    try {
      launchSession.checkAccessRights(null, session);

      /*
       * This requires more thought.
       *
       * 1. We can only have on launch session per resource
       * 2. This doesn't take into account other features of reverse proxy
       *    (authentication, encoding, host headers etc)
       *
       */
     
      /**
       * Setup other reverse proxies so they have access to each other. Only
       * reverse proxies with the same policy attached will be allowed.
      List resources = ResourceUtil.getGrantedResource(launchSession.getSession(), WebForwardPlugin.WEBFORWARD_RESOURCE_TYPE);
     
      Resource resource;
      for(Iterator it = resources.iterator(); it.hasNext();) {
        resource = (Resource) it.next();
        if(resource instanceof ReverseProxyWebForward && resource.getResourceId()!=launchSession.getResource().getResourceId()) {
          if(PolicyDatabaseFactory.getInstance().isResourceAttachedToPolicy(resource, launchSession.getPolicy(), launchSession.getSession().getRealm())) {
            LaunchSession ls = LaunchSessionFactory.getInstance().createLaunchSession(launchSession.getSession(), resource, launchSession.getPolicy());
            ls.checkAccessRights(null, session);
          }
         
        }
      }
       */
     
      VariableReplacement r = new VariableReplacement();
      r.setServletRequest(request);
      r.setLaunchSession(launchSession);
      url = r.replace(url);

      CoreEvent evt = new ResourceAccessEvent(this,
                            WebForwardEventConstants.WEB_FORWARD_STARTED,
              wf,
              launchSession.getPolicy(),
              launchSession.getSession(),
              CoreEvent.STATE_SUCCESSFUL).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
        ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(wf.getType())).getName())
              .addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, url);

      CoreServlet.getServlet().fireCoreEvent(evt);

      // Get the URL to redirect to
      if (wf.getActiveDNS()) {
        URL u = new URL(url);
        URL adu;
        if (Property.getPropertyInt(new SystemConfigKey("webforward.activeDNSFormat")) == 1) {
          adu = new URL("https", launchSession.getId() + "." + hostService.getHost(), hostService.getPort() == 0 ? -1
            : hostService.getPort(), u.getFile());
        } else {
          int idx = hostService.getHost().indexOf('.');
          adu = new URL("https",
                  launchSession.getId() + "." + hostService.getHost().substring(idx + 1),
                  hostService.getPort() == 0 ? -1 : hostService.getPort(),
                  u.getFile());
        }
        path = adu.toExternalForm();

      } else if (wf.getHostHeader() != null && !wf.getHostHeader().equals("")) {
        URL u = new URL(url);

        URL adu = new URL("https", wf.getHostHeader(), hostService.getPort() == 0 ? -1 : hostService.getPort(), u.getFile());

        path = adu.toExternalForm();

        if (adu.getQuery() == null || adu.getQuery().equals("")) {
          path += "?" + LaunchSession.LAUNCH_ID + "=" + launchSession.getId();
        } else {
          path += "&" + LaunchSession.LAUNCH_ID + "=" + launchSession.getId();
        }

        /**
         * Why do we need to use a JSP redirect? Because the new host
         * will be created in a new session and we need the JSESSIONID
         * which is only set once the first response has been returned
         * to the browser. This redirect allows the browser to load a
         * page on the new host and set the session cookie before an
         * automatic redirect takes the user to the correct reverse
         * proxy page.
         */
        URL adu2 = new URL("https",
            /**
             * LDP Not sure why this was using hostService.getHost because my comment above
             * clearly indicates that we have to redirect from the new host
             */
            wf.getHostHeader(),
            hostService.getPort() == 0 ? -1 : hostService.getPort(),
            "/reverseProxyRedirect.jsp?redirectURL=" + Util.urlEncode(path));

        return new ActionForward(adu2.toExternalForm(), true);

      } else {
        URL u = new URL(url);
        path = u.getPath();
        if (u.getQuery() == null || u.getQuery().equals("")) {
          path += "?" + LaunchSession.LONG_LAUNCH_ID + "=" + launchSession.getId();
        } else {
          path += "?" + u.getQuery() + "&" + LaunchSession.LONG_LAUNCH_ID + "=" + launchSession.getId();
        }
       
        URL redir = new URL("https",
          hostService.getHost(),
          hostService.getPort() == 0 ? -1 : hostService.getPort(),
          path);
        path = redir.toExternalForm();
      }
    } catch (NoPermissionException npe) {

View Full Code Here

Examples of com.adito.boot.HostService

    cookie2.setPath("/");
    // We now set the domain on the cookie so the new Active DNS feature for
    // Reverse Proxy works correctly
    String host = request.getField("Host");
    if (host != null) {
      HostService hostService = new HostService(host);
      cookie2.setDomain(hostService.getHost());
    }
    cookie2.setSecure(true);
    response.addCookie(cookie2);
   
   
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.