Java 类javax.portlet.ClientDataRequest 实例源码

项目:spring4-understanding    文件:PortletAnnotationMappingUtils.java   
/**
 * Check whether the given request matches the specified request methods.
 * @param methods the request methods to check against
 * @param request the current request to check
 */
public static boolean checkRequestMethod(RequestMethod[] methods, PortletRequest request) {
    if (methods.length == 0) {
        return true;
    }
    if (!(request instanceof ClientDataRequest)) {
        return false;
    }
    String method = ((ClientDataRequest) request).getMethod();
    for (RequestMethod candidate : methods) {
        if (method.equals(candidate.name())) {
            return true;
        }
    }
    return false;
}
项目:spring4-understanding    文件:DefaultAnnotationHandlerMapping.java   
@Override
public void validate(PortletRequest request) throws PortletException {
    if (!PortletAnnotationMappingUtils.checkHeaders(this.headers, request)) {
        throw new PortletRequestBindingException("Header conditions \"" +
                StringUtils.arrayToDelimitedString(this.headers, ", ") +
                "\" not met for actual request");
    }
    if (!this.methods.isEmpty()) {
        if (!(request instanceof ClientDataRequest)) {
            throw new PortletRequestMethodNotSupportedException(StringUtils.toStringArray(this.methods));
        }
        String method = ((ClientDataRequest) request).getMethod();
        if (!this.methods.contains(method)) {
            throw new PortletRequestMethodNotSupportedException(method, StringUtils.toStringArray(this.methods));
        }
    }
}
项目:class-guard    文件:PortletAnnotationMappingUtils.java   
/**
 * Check whether the given request matches the specified request methods.
 * @param methods the request methods to check against
 * @param request the current request to check
 */
public static boolean checkRequestMethod(RequestMethod[] methods, PortletRequest request) {
    if (methods.length == 0) {
        return true;
    }
    if (!(request instanceof ClientDataRequest)) {
        return false;
    }
    String method = ((ClientDataRequest) request).getMethod();
    for (RequestMethod candidate : methods) {
        if (method.equals(candidate.name())) {
            return true;
        }
    }
    return false;
}
项目:class-guard    文件:DefaultAnnotationHandlerMapping.java   
public void validate(PortletRequest request) throws PortletException {
    if (!PortletAnnotationMappingUtils.checkHeaders(this.headers, request)) {
        throw new PortletRequestBindingException("Header conditions \"" +
                StringUtils.arrayToDelimitedString(this.headers, ", ") +
                "\" not met for actual request");
    }
    if (!this.methods.isEmpty()) {
        if (!(request instanceof ClientDataRequest)) {
            throw new PortletRequestMethodNotSupportedException(StringUtils.toStringArray(this.methods));
        }
        String method = ((ClientDataRequest) request).getMethod();
        if (!this.methods.contains(method)) {
            throw new PortletRequestMethodNotSupportedException(method, StringUtils.toStringArray(this.methods));
        }
    }
}
项目:spring4-understanding    文件:PortletAnnotationMappingUtils.java   
/**
 * Check whether the given request matches the specified request methods.
 * @param methods the request methods to check against
 * @param request the current request to check
 */
public static boolean checkRequestMethod(Set<String> methods, PortletRequest request) {
    if (!methods.isEmpty()) {
        if (!(request instanceof ClientDataRequest)) {
            return false;
        }
        String method = ((ClientDataRequest) request).getMethod();
        if (!methods.contains(method)) {
            return false;
        }
    }
    return true;
}
项目:class-guard    文件:PortletAnnotationMappingUtils.java   
/**
 * Check whether the given request matches the specified request methods.
 * @param methods the request methods to check against
 * @param request the current request to check
 */
public static boolean checkRequestMethod(Set<String> methods, PortletRequest request) {
    if (!methods.isEmpty()) {
        if (!(request instanceof ClientDataRequest)) {
            return false;
        }
        String method = ((ClientDataRequest) request).getMethod();
        if (!methods.contains(method)) {
            return false;
        }
    }
    return true;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public String getCharacterEncoding() {
   if (isClosed) return null;
   if (preq instanceof ClientDataRequest) {
      return ((ClientDataRequest) preq).getCharacterEncoding();
   }
   return null;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public void setCharacterEncoding(String enc) throws UnsupportedEncodingException {
   if (isClosed) return;
   if (preq instanceof ClientDataRequest) {
      ((ClientDataRequest) preq).setCharacterEncoding(enc);
   }
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public int getContentLength() {
   if (isClosed) return 0;
   if (preq instanceof ClientDataRequest) {
      return ((ClientDataRequest) preq).getContentLength();
   }
   return 0;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public long getContentLengthLong() {
   if (isClosed) return 0L;
   if (preq instanceof ClientDataRequest) {
      return ((ClientDataRequest) preq).getContentLengthLong();
   }
   return 0L;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public String getContentType() {
   if (isClosed) return null;
   if (preq instanceof ClientDataRequest) {
      return ((ClientDataRequest) preq).getContentType();
   }
   return null;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public ServletInputStream getInputStream() throws IOException {
   if (isClosed) return null;
   if (preq instanceof ClientDataRequest) {
      return (ServletInputStream) ((ClientDataRequest) preq).getPortletInputStream();
   }
   return null;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public BufferedReader getReader() throws IOException {
   if (preq instanceof ClientDataRequest) {
      return ((ClientDataRequest) preq).getReader();
   }
   return null;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public Part getPart(String name) throws IOException, ServletException {
   if (preq instanceof ClientDataRequest) {
      try {
         return ((ClientDataRequest) preq).getPart(name);
      } catch (PortletException e) {
         throw new ServletException(e.getCause());
      }
   }
   return null;
}
项目:portals-pluto    文件:HttpServletPortletRequestWrapper.java   
@Override
public Collection<Part> getParts() throws IOException, ServletException {
   if (preq instanceof ClientDataRequest) {
      try {
         return ((ClientDataRequest) preq).getParts();
      } catch (PortletException e) {
         throw new ServletException(e.getCause());
      }
   }
   return null;
}
项目:portals-pluto    文件:PortletArtifactProducer.java   
/**
 * Producer method for the ClientDataRequest.
 */
@Produces @PortletRequestScoped @Named("clientDataRequest") @Typed(ClientDataRequest.class)
public static ClientDataRequest produceClientDataRequest() {
   PortletArtifactProducer pap = producers.get();
   assert pap != null;
   ClientDataRequest req = null;
   if (pap.req instanceof ClientDataRequest) {
      req = (ClientDataRequest) pap.req;
   }
   return req;
}
项目:portletbox    文件:HttpServletRequestAdapter.java   
public void setCharacterEncoding(String enc)
        throws UnsupportedEncodingException {
    PortletRequest portletRequest = getWrapped();

    if (portletRequest instanceof ClientDataRequest) {
        ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;

        clientDataRequest.setCharacterEncoding(enc);
    } else {
        throw new UnsupportedOperationException();
    }
}
项目:portletbox    文件:HttpServletRequestAdapter.java   
public int getContentLength() {

        PortletRequest portletRequest = getWrapped();

        if (portletRequest instanceof ClientDataRequest) {
            ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;

            return clientDataRequest.getContentLength();
        } else {
            throw new UnsupportedOperationException();
        }
    }
项目:portletbox    文件:HttpServletRequestAdapter.java   
public String getContentType() {

        PortletRequest portletRequest = getWrapped();

        if (portletRequest instanceof ClientDataRequest) {
            ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;

            return clientDataRequest.getContentType();
        } else {
            throw new UnsupportedOperationException();
        }
    }
项目:portletbox    文件:HttpServletRequestAdapter.java   
public String getMethod() {

        PortletRequest portletRequest = getWrapped();

        if (portletRequest instanceof ClientDataRequest) {
            ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;

            return clientDataRequest.getMethod();
        } else {
            throw new UnsupportedOperationException();
        }
    }
项目:portletbox    文件:HttpServletRequestAdapter.java   
public BufferedReader getReader() throws IOException {

        PortletRequest portletRequest = getWrapped();

        if (portletRequest instanceof ClientDataRequest) {
            ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;

            return clientDataRequest.getReader();
        } else {
            throw new UnsupportedOperationException();
        }
    }
项目:spring4-understanding    文件:AnnotationMethodHandlerAdapter.java   
@Override
protected Object resolveStandardArgument(Class<?> parameterType, NativeWebRequest webRequest)
        throws Exception {

    PortletRequest request = webRequest.getNativeRequest(PortletRequest.class);
    PortletResponse response = webRequest.getNativeResponse(PortletResponse.class);

    if (PortletRequest.class.isAssignableFrom(parameterType) ||
            MultipartRequest.class.isAssignableFrom(parameterType)) {
        Object nativeRequest = webRequest.getNativeRequest(parameterType);
        if (nativeRequest == null) {
            throw new IllegalStateException(
                    "Current request is not of type [" + parameterType.getName() + "]: " + request);
        }
        return nativeRequest;
    }
    else if (PortletResponse.class.isAssignableFrom(parameterType)) {
        Object nativeResponse = webRequest.getNativeResponse(parameterType);
        if (nativeResponse == null) {
            throw new IllegalStateException(
                    "Current response is not of type [" + parameterType.getName() + "]: " + response);
        }
        return nativeResponse;
    }
    else if (PortletSession.class.isAssignableFrom(parameterType)) {
        return request.getPortletSession();
    }
    else if (PortletPreferences.class.isAssignableFrom(parameterType)) {
        return request.getPreferences();
    }
    else if (PortletMode.class.isAssignableFrom(parameterType)) {
        return request.getPortletMode();
    }
    else if (WindowState.class.isAssignableFrom(parameterType)) {
        return request.getWindowState();
    }
    else if (PortalContext.class.isAssignableFrom(parameterType)) {
        return request.getPortalContext();
    }
    else if (Principal.class.isAssignableFrom(parameterType)) {
        return request.getUserPrincipal();
    }
    else if (Locale.class == parameterType) {
        return request.getLocale();
    }
    else if (InputStream.class.isAssignableFrom(parameterType)) {
        if (!(request instanceof ClientDataRequest)) {
            throw new IllegalStateException("InputStream can only get obtained for Action/ResourceRequest");
        }
        return ((ClientDataRequest) request).getPortletInputStream();
    }
    else if (Reader.class.isAssignableFrom(parameterType)) {
        if (!(request instanceof ClientDataRequest)) {
            throw new IllegalStateException("Reader can only get obtained for Action/ResourceRequest");
        }
        return ((ClientDataRequest) request).getReader();
    }
    else if (OutputStream.class.isAssignableFrom(parameterType)) {
        if (!(response instanceof MimeResponse)) {
            throw new IllegalStateException("OutputStream can only get obtained for Render/ResourceResponse");
        }
        return ((MimeResponse) response).getPortletOutputStream();
    }
    else if (Writer.class.isAssignableFrom(parameterType)) {
        if (!(response instanceof MimeResponse)) {
            throw new IllegalStateException("Writer can only get obtained for Render/ResourceResponse");
        }
        return ((MimeResponse) response).getWriter();
    }
    else if (Event.class == parameterType) {
        if (!(request instanceof EventRequest)) {
            throw new IllegalStateException("Event can only get obtained from EventRequest");
        }
        return ((EventRequest) request).getEvent();
    }
    return super.resolveStandardArgument(parameterType, webRequest);
}
项目:class-guard    文件:AnnotationMethodHandlerAdapter.java   
@Override
protected Object resolveStandardArgument(Class<?> parameterType, NativeWebRequest webRequest)
        throws Exception {

    PortletRequest request = webRequest.getNativeRequest(PortletRequest.class);
    PortletResponse response = webRequest.getNativeResponse(PortletResponse.class);

    if (PortletRequest.class.isAssignableFrom(parameterType) ||
            MultipartRequest.class.isAssignableFrom(parameterType)) {
        Object nativeRequest = webRequest.getNativeRequest(parameterType);
        if (nativeRequest == null) {
            throw new IllegalStateException(
                    "Current request is not of type [" + parameterType.getName() + "]: " + request);
        }
        return nativeRequest;
    }
    else if (PortletResponse.class.isAssignableFrom(parameterType)) {
        Object nativeResponse = webRequest.getNativeResponse(parameterType);
        if (nativeResponse == null) {
            throw new IllegalStateException(
                    "Current response is not of type [" + parameterType.getName() + "]: " + response);
        }
        return nativeResponse;
    }
    else if (PortletSession.class.isAssignableFrom(parameterType)) {
        return request.getPortletSession();
    }
    else if (PortletPreferences.class.isAssignableFrom(parameterType)) {
        return request.getPreferences();
    }
    else if (PortletMode.class.isAssignableFrom(parameterType)) {
        return request.getPortletMode();
    }
    else if (WindowState.class.isAssignableFrom(parameterType)) {
        return request.getWindowState();
    }
    else if (PortalContext.class.isAssignableFrom(parameterType)) {
        return request.getPortalContext();
    }
    else if (Principal.class.isAssignableFrom(parameterType)) {
        return request.getUserPrincipal();
    }
    else if (Locale.class.equals(parameterType)) {
        return request.getLocale();
    }
    else if (InputStream.class.isAssignableFrom(parameterType)) {
        if (!(request instanceof ClientDataRequest)) {
            throw new IllegalStateException("InputStream can only get obtained for Action/ResourceRequest");
        }
        return ((ClientDataRequest) request).getPortletInputStream();
    }
    else if (Reader.class.isAssignableFrom(parameterType)) {
        if (!(request instanceof ClientDataRequest)) {
            throw new IllegalStateException("Reader can only get obtained for Action/ResourceRequest");
        }
        return ((ClientDataRequest) request).getReader();
    }
    else if (OutputStream.class.isAssignableFrom(parameterType)) {
        if (!(response instanceof MimeResponse)) {
            throw new IllegalStateException("OutputStream can only get obtained for Render/ResourceResponse");
        }
        return ((MimeResponse) response).getPortletOutputStream();
    }
    else if (Writer.class.isAssignableFrom(parameterType)) {
        if (!(response instanceof MimeResponse)) {
            throw new IllegalStateException("Writer can only get obtained for Render/ResourceResponse");
        }
        return ((MimeResponse) response).getWriter();
    }
    else if (Event.class.equals(parameterType)) {
        if (!(request instanceof EventRequest)) {
            throw new IllegalStateException("Event can only get obtained from EventRequest");
        }
        return ((EventRequest) request).getEvent();
    }
    return super.resolveStandardArgument(parameterType, webRequest);
}
项目:portals-pluto    文件:DefineObjectsTag362.java   
@Override
protected void setPortletRequestResponseAttribute(PortletRequest request, PortletResponse response) {

   PortletContext poco = request.getPortletContext();
   setAttribute(poco, "portletContext");

   PortletConfig config = (PortletConfig) pageContext.getRequest().getAttribute(Constants.PORTLET_CONFIG);
   setAttribute(config.getPortletName(), "portletName");

   setAttribute(request.getRenderParameters(), "renderParams");
   setAttribute(request.getPortletMode(), "portletMode");
   setAttribute(request.getWindowState(), "windowState");
   setAttribute(request.getCookies(), "cookies");
   setAttribute(Collections.list(request.getLocales()).toArray(new Locale[0]), "locales");
   setAttribute(request.getLocale(), "locale");
   setAttribute(request.getWindowID(), "windowId");
   setAttribute(request.getContextPath(), "contextPath");
   setAttribute(response.getNamespace(), "namespace");

   if (request instanceof ClientDataRequest) {
      setAttribute(request, "clientDataRequest");
      if (request instanceof ActionRequest) {
         setAttribute(((ActionRequest) request).getActionParameters(), "actionParameters");
      } else {
         setAttribute(((ResourceRequest) request).getResourceParameters(), "resourceParameters");
      }
   }

   if (response instanceof StateAwareResponse) {
      setAttribute(response, "stateAwareResponse");
      setAttribute(((StateAwareResponse) response).getRenderParameters(), "mutableRenderParams");
   }

   if (response instanceof MimeResponse) {
      setAttribute(response, "mimeResponse");
   }

   if(request instanceof HeaderRequest){
      setAttribute(request, "headerRequest");
      setAttribute(response, "headerResponse");
   }     

   super.setPortletRequestResponseAttribute(request, response);
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
/**
 * @param request
 */
public ClientDataRequestWrapper(ClientDataRequest request) {
   super(request);
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
public InputStream getPortletInputStream() throws IOException {
   return ((ClientDataRequest)wrapped).getPortletInputStream();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
public void setCharacterEncoding(String enc) throws UnsupportedEncodingException {
   ((ClientDataRequest)wrapped).setCharacterEncoding(enc);
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
public BufferedReader getReader() throws UnsupportedEncodingException, IOException {
   return ((ClientDataRequest)wrapped).getReader();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
public String getCharacterEncoding() {
   return ((ClientDataRequest)wrapped).getCharacterEncoding();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
public String getContentType() {
   return ((ClientDataRequest)wrapped).getContentType();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
public int getContentLength() {
   return ((ClientDataRequest)wrapped).getContentLength();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
@Override
public long getContentLengthLong() {
   return ((ClientDataRequest)wrapped).getContentLengthLong();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
public String getMethod() {
   return ((ClientDataRequest)wrapped).getMethod();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
@Override
public Part getPart(String name) throws IOException, PortletException {
   return ((ClientDataRequest)wrapped).getPart(name);
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
@Override
public Collection<Part> getParts() throws IOException, PortletException {
   return ((ClientDataRequest)wrapped).getParts();
}
项目:portletbox    文件:HttpServletRequestAdapter.java   
public String getCharacterEncoding() {

        PortletRequest portletRequest = getWrapped();

        if (portletRequest instanceof ClientDataRequest) {
            ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;

            return clientDataRequest.getCharacterEncoding();
        } else {

            return null;
        }
    }
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
/**
 * Return the wrapped request object.
 * 
 * @return the wrapped request
 */
public ClientDataRequest getRequest() {
   return (ClientDataRequest) super.getRequest();
}
项目:portals-pluto    文件:ClientDataRequestWrapper.java   
/**
 * Sets the request object being wrapped.
 * 
 * @param request
 *           the request to set
 * @throws java.lang.IllegalArgumentException
 *            if the request is null.
 */
public void setRequest(ClientDataRequest request) {
   super.setRequest(request);
}