public void setAttribute(String name, Object o) { if (null == o) { removeAttribute(name); } else { Object oldValue = attributes.put(name, o); if (null != oldValue) { attributeReplaced(name, o); } else { attributeAdded(name, o); } } }
public void removeAttribute(String name) { // TODO - inform listeners Object removed = attributes.remove(name); if (null != removed) { attributeRemoved(name, removed); } }
public ServletInputStream getInputStream() throws IOException { String body = getRequestBody(); if(null != body){ final ByteArrayInputStream input = new ByteArrayInputStream(body.getBytes(getCharacterEncoding())); return new ServletInputStream(){ @Override public int read() throws IOException { // TODO Auto-generated method stub return input.read(); } }; } return null; }
public int getContentLength() { String body = getRequestBody(); return null == body ? -1 : body.length(); }
public StringBuffer getRequestURL() { StringBuffer requestURL = new StringBuffer(HTTP + "://" + LOCALHOST + getRequestURI()); return requestURL; }
@Override public int getLocalPort() { int port = url.getPort(); if(port < 0){ port = super.getLocalPort(); } return port; } /*
public long getDateHeader(String name) { String value = headers.get(name); if(null != value){ try { return DateFormat.getDateInstance(DateFormat.FULL, getLocale()).parse(value).getTime(); } catch (ParseException e) { throw new IllegalArgumentException(e.getMessage()); } } return -1; }
public int getContentLength() { String body = getRequestBody(); return null == body ? -1 : body.length(); }
public StringBuffer getRequestURL() { StringBuffer requestURL = new StringBuffer(HTTP + "://" + LOCALHOST + getRequestURI()); return requestURL; }
@Override public int getLocalPort() { int port = url.getPort(); if(port < 0){ port = super.getLocalPort(); } return port; } /*
public long getDateHeader(String name) { String value = headers.get(name); if(null != value){ try { return DateFormat.getDateInstance(DateFormat.FULL, getLocale()).parse(value).getTime(); } catch (ParseException e) { throw new IllegalArgumentException(e.getMessage()); } } return -1; }
public void setAttribute(String name, Object o) { if (null == o) { removeAttribute(name); } else { Object oldValue = attributes.put(name, o); if (null != oldValue) { attributeReplaced(name, o); } else { attributeAdded(name, o); } } }
public ServletInputStream getInputStream() throws IOException { String body = getRequestBody(); if(null != body){ final ByteArrayInputStream input = new ByteArrayInputStream(body.getBytes(getCharacterEncoding())); return new ServletInputStream(){ @Override public int read() throws IOException { // TODO Auto-generated method stub return input.read(); } }; } return null; }
public BufferedReader getReader() throws IOException { String body = getRequestBody(); if(null != body){ return new BufferedReader(new StringReader(body)); } return null; }
public void removeAttribute(String name) { // TODO - inform listeners Object removed = attributes.remove(name); if (null != removed) { attributeRemoved(name, removed); } }
public BufferedReader getReader() throws IOException { String body = getRequestBody(); if(null != body){ return new BufferedReader(new StringReader(body)); } return null; }