Package javax.portlet

Examples of javax.portlet.BaseURL


   {
      seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
      {
         protected Response run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
         {
            BaseURL url = response.createRenderURL();

            //
            try
            {
               url.write(new Writer()
               {
                  public void write(char cbuf[], int off, int len) throws IOException
                  {
                     throw new IOException();
                  }
View Full Code Here


          //
          ControllerHandler handler = bridge.getApplication().resolveBean(ControllerService.class).getDescriptor().getMethodByHandle(target);

          //
          BaseURL url;
          if (handler.getPhase() == Phase.ACTION) {
            url = mimeResp.createActionURL();
          } else if (handler.getPhase() == Phase.VIEW) {
            url = mimeResp.createRenderURL();
          } else if (handler.getPhase() == Phase.RESOURCE) {
            url = mimeResp.createResourceURL();
          } else {
            throw new AssertionError();
          }

          // Set generic parameters
          for (ResponseParameter parameter : parameters.values()) {
            url.setParameter(parameter.getName(), parameter.toArray());
          }

          //
          boolean escapeXML = false;
          if (properties != null) {
            Boolean escapeXMLProperty = properties.getValue(PropertyType.ESCAPE_XML);
            if (escapeXMLProperty != null && Boolean.TRUE.equals(escapeXMLProperty)) {
              escapeXML = true;
            }

            // Handle portlet mode
            PortletMode portletModeProperty = properties.getValue(JuzuPortlet.PORTLET_MODE);
            if (portletModeProperty != null) {
              if (url instanceof PortletURL) {
                try {
                  ((PortletURL)url).setPortletMode(portletModeProperty);
                }
                catch (PortletModeException e) {
                  throw new IllegalArgumentException(e);
                }
              }
              else {
                throw new IllegalArgumentException();
              }
            }

            // Handle window state
            WindowState windowStateProperty = properties.getValue(JuzuPortlet.WINDOW_STATE);
            if (windowStateProperty != null) {
              if (url instanceof PortletURL) {
                try {
                  ((PortletURL)url).setWindowState(windowStateProperty);
                }
                catch (WindowStateException e) {
                  throw new IllegalArgumentException(e);
                }
              }
              else {
                throw new IllegalArgumentException();
              }
            }

            // Set method id
            url.setParameter("juzu.op", handler.getId());
          }

          //
          if (escapeXML) {
            StringWriter writer = new StringWriter();
            url.write(writer, true);
            appendable.append(writer.toString());
          }
          else {
            appendable.append(url.toString());
          }
        } else {
          throw new IllegalStateException("Cannot render an URL during phase " + phase);
        }
      }
View Full Code Here

  }

  @Override
  protected BaseURL toBaseURL() throws MalformedURLException {

    BaseURL baseURL = null;

    // If the URL is opaque, meaning it starts with something like "portlet:" or "mailto:" and
    // doesn't have the double-forward-slash like "http://" does, then
    if (isOpaque()) {
View Full Code Here

  }

  @Override
  protected BaseURL toBaseURL() throws MalformedURLException {

    BaseURL baseURL = null;

    if (url != null) {

      if (url.startsWith("http")) {
        baseURL = new BaseURLNonEncodedStringImpl(url, getParameterMap());
View Full Code Here

    String stringValue = null;

    try {

      // Ask the Portlet Container for a BaseURL that contains the modified parameters.
      BaseURL baseURL = toBaseURL();

      // If the URL string has escaped characters (like %20 for space, etc) then ask the
      // portlet container to create an escaped representation of the URL string.
      if (isEscaped()) {
        StringWriter urlWriter = new StringWriter();

        try {
          baseURL.write(urlWriter, true);
        }
        catch (IOException e) {
          logger.error(e);
          stringValue = baseURL.toString();
        }

        stringValue = urlWriter.toString();
      }

      // Otherwise, ask the portlet container to create a normal (non-escaped) string
      // representation of the URL string.
      else {
        stringValue = baseURL.toString();
      }
    }
    catch (MalformedURLException e) {
      logger.error(e);
    }
View Full Code Here

  }

  @Override
  protected BaseURL toBaseURL() throws MalformedURLException {

    BaseURL baseURL = null;

    // If this is executing during the ACTION_PHASE of the portlet lifecycle, then
    if (BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.ACTION_PHASE) {

      // TCK NOTE: The only use-case in which the TCK will invoke this method is
View Full Code Here

  }

  @Override
  protected BaseURL toBaseURL() throws MalformedURLException {

    BaseURL baseURL = null;

    // If this is executing during the ACTION_PHASE of the portlet lifecycle, then
    PortletPhase portletRequestPhase = BridgeUtil.getPortletRequestPhase();

    if (portletRequestPhase == Bridge.PortletPhase.ACTION_PHASE) {
View Full Code Here

      }
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL =  super.generateURL();

      if (!properties.isEmpty())
      {
         for (String name : properties.keySet())
         {
            List<String> props = properties.get(name);
            for (String prop : props)
            {
               newPortletURL.setProperty(name, prop);
            }
         }
      }

      return newPortletURL;
View Full Code Here

      return EVAL_BODY_INCLUDE;
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL = getBasePortletEnvironmentAndURL();

      setSecure(newPortletURL);

      // Include parameters as part of the tag request.

      if (!parameters.isEmpty())
      {
         newPortletURL.setParameters(getURLParameters());
      }
      return newPortletURL;
   }
View Full Code Here

      return typeParameter;
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL =  super.generateURL();

      setId((ResourceURL)newPortletURL);
      setCacheability((ResourceURL)newPortletURL);

      return newPortletURL;
View Full Code Here

TOP

Related Classes of javax.portlet.BaseURL

Copyright © 2018 www.massapicom. 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.